yg-team-cli 2.3.10 → 2.3.12
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/dist/cli.js +135 -51
- package/dist/cli.js.map +1 -1
- package/dist/index.js +135 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -903,7 +903,6 @@ var init_template_version = __esm({
|
|
|
903
903
|
|
|
904
904
|
// src/lib/module-registry.ts
|
|
905
905
|
import path5 from "path";
|
|
906
|
-
import fs3 from "fs-extra";
|
|
907
906
|
var ModuleManager;
|
|
908
907
|
var init_module_registry = __esm({
|
|
909
908
|
"src/lib/module-registry.ts"() {
|
|
@@ -912,6 +911,111 @@ var init_module_registry = __esm({
|
|
|
912
911
|
init_utils();
|
|
913
912
|
ModuleManager = class {
|
|
914
913
|
static MODULES = [
|
|
914
|
+
// ========== 云谷公共模块 (新增) ==========
|
|
915
|
+
{
|
|
916
|
+
id: "yungu-user-context",
|
|
917
|
+
name: "\u7528\u6237\u4E0A\u4E0B\u6587 (UserContext)",
|
|
918
|
+
description: "RequestScope\u7EA7\u522B\u7684\u7528\u6237\u4FE1\u606F\u83B7\u53D6\uFF0C\u652F\u6301\u591A\u8EAB\u4EFD\u548CMock",
|
|
919
|
+
type: "local",
|
|
920
|
+
specs: ["yungu-user-context/spec.md"],
|
|
921
|
+
backendFragments: [
|
|
922
|
+
{
|
|
923
|
+
source: "yungu/UserContext.java",
|
|
924
|
+
target: "common/yungu/UserContext.java"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
source: "yungu/domain/UserBaseInfo.java",
|
|
928
|
+
target: "common/yungu/domain/UserBaseInfo.java"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
source: "yungu/domain/UserAccount.java",
|
|
932
|
+
target: "common/yungu/domain/UserAccount.java"
|
|
933
|
+
}
|
|
934
|
+
],
|
|
935
|
+
dependencies: ["org.yungu:login-client"]
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
id: "yungu-auth",
|
|
939
|
+
name: "\u7528\u6237\u8BA4\u8BC1\u4E0E\u9274\u6743",
|
|
940
|
+
description: "CAS\u5355\u70B9\u767B\u5F55\u96C6\u6210\u3001\u7528\u6237\u4E0A\u4E0B\u6587\u62E6\u622A\u5668",
|
|
941
|
+
type: "local",
|
|
942
|
+
specs: ["yungu-auth/spec.md"],
|
|
943
|
+
requires: ["yungu-user-context"],
|
|
944
|
+
backendFragments: [
|
|
945
|
+
{
|
|
946
|
+
source: "yungu/intercepter/UserContextInterceptor.java",
|
|
947
|
+
target: "common/yungu/intercepter/UserContextInterceptor.java"
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
source: "yungu/config/InterceptorConfiguration.java",
|
|
951
|
+
target: "config/yungu/InterceptorConfiguration.java"
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
dependencies: ["org.yungu:login-client", "org.yungu:acl-api"]
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
id: "yungu-managers",
|
|
958
|
+
name: "\u901A\u7528\u670D\u52A1\u5C01\u88C5",
|
|
959
|
+
description: "\u7528\u6237\u670D\u52A1\u3001\u5B66\u6821\u670D\u52A1\u7B49Dubbo\u670D\u52A1\u8C03\u7528\u5C01\u88C5",
|
|
960
|
+
type: "local",
|
|
961
|
+
specs: ["yungu-managers/spec.md"],
|
|
962
|
+
backendFragments: [
|
|
963
|
+
{
|
|
964
|
+
source: "yungu/managers/UserServiceManager.java",
|
|
965
|
+
target: "common/yungu/managers/UserServiceManager.java"
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
source: "yungu/managers/SchoolManager.java",
|
|
969
|
+
target: "common/yungu/managers/SchoolManager.java"
|
|
970
|
+
}
|
|
971
|
+
],
|
|
972
|
+
dependencies: ["org.yungu:user-service-api"]
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
id: "yungu-utils",
|
|
976
|
+
name: "\u5DE5\u5177\u7C7B\u6A21\u5757",
|
|
977
|
+
description: "\u901A\u7528\u5DE5\u5177\u7C7B (CommonUtils\u7B49)",
|
|
978
|
+
type: "local",
|
|
979
|
+
specs: ["yungu-utils/spec.md"],
|
|
980
|
+
backendFragments: [
|
|
981
|
+
{
|
|
982
|
+
source: "yungu/utils/CommonUtils.java",
|
|
983
|
+
target: "common/yungu/utils/CommonUtils.java"
|
|
984
|
+
}
|
|
985
|
+
]
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
id: "yungu-logging",
|
|
989
|
+
name: "\u65E5\u5FD7\u4E0E\u76D1\u63A7",
|
|
990
|
+
description: "\u65B9\u6CD5\u8017\u65F6\u65E5\u5FD7\u8BB0\u5F55 (LogAspect)",
|
|
991
|
+
type: "local",
|
|
992
|
+
specs: ["yungu-logging/spec.md"],
|
|
993
|
+
backendFragments: [
|
|
994
|
+
{
|
|
995
|
+
source: "yungu/config/LogAspect.java",
|
|
996
|
+
target: "config/yungu/LogAspect.java"
|
|
997
|
+
}
|
|
998
|
+
]
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
id: "yungu-i18n",
|
|
1002
|
+
name: "\u56FD\u9645\u5316\u652F\u6301",
|
|
1003
|
+
description: "\u4E2D\u82F1\u6587\u5207\u6362\u3001\u591A\u8BED\u8A00\u679A\u4E3E",
|
|
1004
|
+
type: "local",
|
|
1005
|
+
specs: ["yungu-i18n/spec.md"],
|
|
1006
|
+
requires: ["yungu-user-context"],
|
|
1007
|
+
backendFragments: [
|
|
1008
|
+
{
|
|
1009
|
+
source: "yungu/enums/LanguageEnum.java",
|
|
1010
|
+
target: "common/yungu/enums/LanguageEnum.java"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
source: "yungu/constant/LanguageConstant.java",
|
|
1014
|
+
target: "common/yungu/constant/LanguageConstant.java"
|
|
1015
|
+
}
|
|
1016
|
+
]
|
|
1017
|
+
},
|
|
1018
|
+
// ========== 原有模块 ==========
|
|
915
1019
|
{
|
|
916
1020
|
id: "acl",
|
|
917
1021
|
name: "ACL (Access Control List)",
|
|
@@ -976,17 +1080,18 @@ var init_module_registry = __esm({
|
|
|
976
1080
|
}
|
|
977
1081
|
}
|
|
978
1082
|
if (module.type === "local" && module.backendFragments) {
|
|
979
|
-
const
|
|
980
|
-
const
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1083
|
+
const backendJavaDir = path5.join(projectPath, "backend/src/main/java");
|
|
1084
|
+
const commonBasePath = path5.join(backendJavaDir, "org/yungu/common");
|
|
1085
|
+
for (const fragment of module.backendFragments) {
|
|
1086
|
+
const sourcePath = path5.join(templatesDir, "modules", fragment.source);
|
|
1087
|
+
const targetPath = path5.join(commonBasePath, fragment.target);
|
|
1088
|
+
if (await FileUtils.exists(sourcePath)) {
|
|
1089
|
+
await FileUtils.ensureDir(path5.dirname(targetPath));
|
|
1090
|
+
let content = await FileUtils.read(sourcePath);
|
|
1091
|
+
const targetPackage = "org.yungu.common." + path5.dirname(fragment.target).replace(/\//g, ".");
|
|
1092
|
+
content = content.replace(/^package\s+[^;]+;/m, `package ${targetPackage};`);
|
|
1093
|
+
await FileUtils.write(targetPath, content);
|
|
1094
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
990
1095
|
}
|
|
991
1096
|
}
|
|
992
1097
|
} else if (module.type === "remote") {
|
|
@@ -1009,27 +1114,6 @@ var init_module_registry = __esm({
|
|
|
1009
1114
|
`;
|
|
1010
1115
|
await FileUtils.write(targetPath, content);
|
|
1011
1116
|
}
|
|
1012
|
-
/**
|
|
1013
|
-
* 自动探测项目的 Base Package
|
|
1014
|
-
*/
|
|
1015
|
-
static async findBasePackage(searchDir) {
|
|
1016
|
-
if (!await FileUtils.exists(searchDir)) return null;
|
|
1017
|
-
const files = await FileUtils.findFiles("**/Application.java", searchDir);
|
|
1018
|
-
if (files.length > 0) {
|
|
1019
|
-
return path5.dirname(path5.join(searchDir, files[0]));
|
|
1020
|
-
}
|
|
1021
|
-
let current = searchDir;
|
|
1022
|
-
while (true) {
|
|
1023
|
-
const items = await fs3.readdir(current);
|
|
1024
|
-
const dirs = items.filter((c) => fs3.statSync(path5.join(current, c)).isDirectory());
|
|
1025
|
-
if (dirs.length === 1 && !["model", "controller", "service", "mapper", "config", "common"].includes(dirs[0])) {
|
|
1026
|
-
current = path5.join(current, dirs[0]);
|
|
1027
|
-
} else {
|
|
1028
|
-
break;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
return current;
|
|
1032
|
-
}
|
|
1033
1117
|
};
|
|
1034
1118
|
}
|
|
1035
1119
|
});
|
|
@@ -1472,7 +1556,7 @@ var init_gitlab_api = __esm({
|
|
|
1472
1556
|
import { Command } from "commander";
|
|
1473
1557
|
import inquirer from "inquirer";
|
|
1474
1558
|
import path7 from "path";
|
|
1475
|
-
import
|
|
1559
|
+
import fs3 from "fs-extra";
|
|
1476
1560
|
import os3 from "os";
|
|
1477
1561
|
import { Listr } from "listr2";
|
|
1478
1562
|
async function generateTechStack(projectPath) {
|
|
@@ -2051,10 +2135,10 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
|
|
|
2051
2135
|
stdio: "pipe"
|
|
2052
2136
|
});
|
|
2053
2137
|
const latestTag = tags.split("\n")[0] || void 0;
|
|
2054
|
-
await
|
|
2138
|
+
await fs3.copy(tempDir, backendPath, {
|
|
2055
2139
|
filter: (src) => !src.includes(".git")
|
|
2056
2140
|
});
|
|
2057
|
-
await
|
|
2141
|
+
await fs3.remove(tempDir);
|
|
2058
2142
|
const gitDir = path7.join(backendPath, ".git");
|
|
2059
2143
|
if (await FileUtils.exists(gitDir)) {
|
|
2060
2144
|
await FileUtils.remove(gitDir);
|
|
@@ -2092,10 +2176,10 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
|
|
|
2092
2176
|
cloneArgs.push(repository, tempDir);
|
|
2093
2177
|
await e("git", cloneArgs);
|
|
2094
2178
|
const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], { cwd: tempDir });
|
|
2095
|
-
await
|
|
2179
|
+
await fs3.copy(tempDir, frontendPath, {
|
|
2096
2180
|
filter: (src) => !src.includes(".git")
|
|
2097
2181
|
});
|
|
2098
|
-
await
|
|
2182
|
+
await fs3.remove(tempDir);
|
|
2099
2183
|
await updateTemplateVersion(projectPath, "frontend", commit.trim(), {
|
|
2100
2184
|
tag: versionOptions.tag || latestTag,
|
|
2101
2185
|
branch: versionOptions.branch
|
|
@@ -2146,9 +2230,9 @@ docker push \${REGISTRY}/\${PROJECT_NAME}:latest
|
|
|
2146
2230
|
|
|
2147
2231
|
echo "\u2705 \u90E8\u7F72\u5B8C\u6210! \u955C\u50CF\u5730\u5740: \${REGISTRY}/\${IMAGE_TAG}"
|
|
2148
2232
|
`;
|
|
2149
|
-
await
|
|
2150
|
-
await
|
|
2151
|
-
await
|
|
2233
|
+
await fs3.writeFile(path7.join(backendPath, "Dockerfile"), dockerfile);
|
|
2234
|
+
await fs3.writeFile(path7.join(backendPath, "deploy.sh"), deploySh);
|
|
2235
|
+
await fs3.chmod(path7.join(backendPath, "deploy.sh"), 493);
|
|
2152
2236
|
}
|
|
2153
2237
|
async function initGit(projectPath, projectName) {
|
|
2154
2238
|
try {
|
|
@@ -5444,7 +5528,7 @@ import { Command as Command13 } from "commander";
|
|
|
5444
5528
|
import path18 from "path";
|
|
5445
5529
|
import { execa as execa4 } from "execa";
|
|
5446
5530
|
import inquirer9 from "inquirer";
|
|
5447
|
-
import
|
|
5531
|
+
import fs4 from "fs-extra";
|
|
5448
5532
|
async function performUpdate(projectPath, updates) {
|
|
5449
5533
|
logger.newLine();
|
|
5450
5534
|
logger.info("\u5F00\u59CB\u66F4\u65B0\u6A21\u677F...");
|
|
@@ -5483,7 +5567,7 @@ async function performUpdate(projectPath, updates) {
|
|
|
5483
5567
|
}
|
|
5484
5568
|
const ref = updateOptions?.tag || updateOptions?.branch || "HEAD";
|
|
5485
5569
|
const backupDir = path18.join(projectPath, `.backup-${Date.now()}`);
|
|
5486
|
-
await
|
|
5570
|
+
await fs4.copy(targetPath, path18.join(backupDir, targetDir));
|
|
5487
5571
|
logger.info(`\u5DF2\u521B\u5EFA\u5907\u4EFD: ${backupDir}`);
|
|
5488
5572
|
if (updateOptions?.dryRun) {
|
|
5489
5573
|
logger.info("[Dry Run] \u5C06\u4F1A\u66F4\u65B0\u5230\u4EE5\u4E0B\u7248\u672C:");
|
|
@@ -5512,15 +5596,15 @@ async function performUpdate(projectPath, updates) {
|
|
|
5512
5596
|
if (!keepFiles.includes(file)) {
|
|
5513
5597
|
const filePath = path18.join(targetPath, file);
|
|
5514
5598
|
try {
|
|
5515
|
-
await
|
|
5599
|
+
await fs4.remove(filePath);
|
|
5516
5600
|
} catch {
|
|
5517
5601
|
}
|
|
5518
5602
|
}
|
|
5519
5603
|
}
|
|
5520
|
-
await
|
|
5604
|
+
await fs4.copy(tempDir, targetPath, {
|
|
5521
5605
|
filter: (src) => !src.includes(".git")
|
|
5522
5606
|
});
|
|
5523
|
-
await
|
|
5607
|
+
await fs4.remove(tempDir);
|
|
5524
5608
|
await updateTemplateVersion(projectPath, type, commit.trim(), {
|
|
5525
5609
|
tag: updateOptions?.tag || latestTag,
|
|
5526
5610
|
branch: updateOptions?.branch
|
|
@@ -5531,9 +5615,9 @@ async function performUpdate(projectPath, updates) {
|
|
|
5531
5615
|
} catch (error) {
|
|
5532
5616
|
logger.error(`\u66F4\u65B0\u5931\u8D25: ${error.message}`);
|
|
5533
5617
|
logger.info("\u6B63\u5728\u6062\u590D\u5907\u4EFD...");
|
|
5534
|
-
await
|
|
5535
|
-
await
|
|
5536
|
-
await
|
|
5618
|
+
await fs4.remove(targetPath);
|
|
5619
|
+
await fs4.copy(path18.join(backupDir, targetDir), targetPath);
|
|
5620
|
+
await fs4.remove(backupDir);
|
|
5537
5621
|
logger.info("\u5DF2\u6062\u590D\u5230\u66F4\u65B0\u524D\u7684\u72B6\u6001");
|
|
5538
5622
|
}
|
|
5539
5623
|
}
|
|
@@ -6137,7 +6221,7 @@ var init_diff = __esm({
|
|
|
6137
6221
|
var index_exports = {};
|
|
6138
6222
|
import { Command as Command16 } from "commander";
|
|
6139
6223
|
import chalk4 from "chalk";
|
|
6140
|
-
import
|
|
6224
|
+
import fs5 from "fs-extra";
|
|
6141
6225
|
import path19 from "path";
|
|
6142
6226
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6143
6227
|
function showHelp() {
|
|
@@ -6217,7 +6301,7 @@ var init_index = __esm({
|
|
|
6217
6301
|
init_config();
|
|
6218
6302
|
init_diff();
|
|
6219
6303
|
__dirname2 = path19.dirname(fileURLToPath2(import.meta.url));
|
|
6220
|
-
pkg =
|
|
6304
|
+
pkg = fs5.readJsonSync(path19.join(__dirname2, "../package.json"));
|
|
6221
6305
|
program = new Command16();
|
|
6222
6306
|
program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version(pkg.version);
|
|
6223
6307
|
program.option("-v, --verbose", "\u8BE6\u7EC6\u8F93\u51FA\u6A21\u5F0F").option("--debug", "\u8C03\u8BD5\u6A21\u5F0F");
|