ai-worktool 1.0.44 → 1.0.45
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/CHANGELOG.md +2 -1
- package/dist/tools/project.js +117 -1
- package/package.json +3 -3
- package/packages/{aicoder-1.0.44-linux → aicoder-1.0.45-linux} +0 -0
- package/packages/{aicoder-1.0.44-macos → aicoder-1.0.45-macos} +0 -0
- package/packages/{aicoder-1.0.44-win.exe → aicoder-1.0.45-win.exe} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## 1.0.
|
|
1
|
+
## 1.0.45 (2025-08-12)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
* **program:** 增加代码覆盖率报告展示功能 ([f693e27](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/f693e272ef0fe7e58083d2589339af17e45cff95))
|
|
112
112
|
* **project:** 优化项目类型检测逻辑 ([9bc024d](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/9bc024deeed239c05c9cab810f9f12a6a3306aab))
|
|
113
113
|
* **project:** 增加加载 aicoder 配置文件功能 ([b4dc70b](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/b4dc70b3afa88cf45135cf56e63cbb2ffa2fed82))
|
|
114
|
+
* **project:** 增加项目基本信息和 Git 配置检测 ([a81fcb0](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/a81fcb0505a49f8b5a5572d03c4a43493fda0e4d))
|
|
114
115
|
* Refactor CLI and program structure, update commands for testing and fixing code ([8dcbb19](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/8dcbb191fc8a95a40e07647de337452935926b10))
|
|
115
116
|
* **test/demo:** 添加用户成绩 API 路由 ([6f838c7](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/6f838c7fda9924b1e5a7556d0a429427a652b985))
|
|
116
117
|
* **testAgent:** 使测试环境设置可配置 ([53e0760](https://codeup.aliyun.com/666cf9ed29ecbe23053513a3/JianGuoKe/ai-worktools/commits/53e07602c1d65882ffedb5340d971fe4c3f76cef))
|
package/dist/tools/project.js
CHANGED
|
@@ -31,7 +31,13 @@ async function detectProjectConfig(projectRoot, defaultConfig) {
|
|
|
31
31
|
testFilePatterns: defaultConfig.testFilePatterns || [],
|
|
32
32
|
languages: defaultConfig.languages || [],
|
|
33
33
|
testConfigFile: defaultConfig.testConfigFile || undefined,
|
|
34
|
-
isInstalled: defaultConfig.isInstalled || undefined
|
|
34
|
+
isInstalled: defaultConfig.isInstalled || undefined,
|
|
35
|
+
// 初始化新增字段
|
|
36
|
+
name: defaultConfig.name,
|
|
37
|
+
displayName: defaultConfig.displayName,
|
|
38
|
+
version: defaultConfig.version,
|
|
39
|
+
description: defaultConfig.description,
|
|
40
|
+
gitConfig: defaultConfig.gitConfig
|
|
35
41
|
};
|
|
36
42
|
if (!projectRoot) {
|
|
37
43
|
throw new Error('项目文件夹未知.');
|
|
@@ -44,6 +50,8 @@ async function detectProjectConfig(projectRoot, defaultConfig) {
|
|
|
44
50
|
await detectPackageManager(projectRoot, config);
|
|
45
51
|
// 首先检查项目是否已安装
|
|
46
52
|
await checkProjectInstalled(projectRoot, config);
|
|
53
|
+
// 检测项目基本信息(名称、版本等)
|
|
54
|
+
await detectProjectBasicInfo(projectRoot, config);
|
|
47
55
|
// 检测使用的开发语言
|
|
48
56
|
await detectLanguages(projectRoot, config);
|
|
49
57
|
// 检测源代码目录
|
|
@@ -54,6 +62,8 @@ async function detectProjectConfig(projectRoot, defaultConfig) {
|
|
|
54
62
|
await detectProjectType(projectRoot, config);
|
|
55
63
|
// 检测框架信息
|
|
56
64
|
await detectFramework(projectRoot, config);
|
|
65
|
+
// 检测Git配置
|
|
66
|
+
await detectGitConfig(projectRoot, config);
|
|
57
67
|
// 检查项目目录中是否有aicoder.config.json有的直接加载作为配置信息
|
|
58
68
|
if (await fileExists(path_1.default.join(projectRoot, 'aicoder.config.json'))) {
|
|
59
69
|
const aicoderConfig = JSON.parse(await promises_1.default.readFile(path_1.default.join(projectRoot, 'aicoder.config.json'), 'utf8'));
|
|
@@ -558,4 +568,110 @@ async function hasFilesWithExtensionFiltered(rootDir, extension, dirFilter) {
|
|
|
558
568
|
return false;
|
|
559
569
|
}
|
|
560
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* 检测项目基本信息(名称、版本等)
|
|
573
|
+
*/
|
|
574
|
+
async function detectProjectBasicInfo(projectRoot, config) {
|
|
575
|
+
const packageJsonPath = path_1.default.join(projectRoot, 'package.json');
|
|
576
|
+
if (await fileExists(packageJsonPath)) {
|
|
577
|
+
try {
|
|
578
|
+
const packageJson = JSON.parse(await promises_1.default.readFile(packageJsonPath, 'utf8'));
|
|
579
|
+
config.name = packageJson.name;
|
|
580
|
+
config.version = packageJson.version;
|
|
581
|
+
config.description = packageJson.description;
|
|
582
|
+
// displayName优先取package.json中的displayName,没有则使用name
|
|
583
|
+
config.displayName = packageJson.displayName || packageJson.name;
|
|
584
|
+
}
|
|
585
|
+
catch (err) {
|
|
586
|
+
console.error('解析package.json获取项目信息失败:', err);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
// 如果没有package.json,尝试从目录名获取项目名称
|
|
590
|
+
if (!config.name) {
|
|
591
|
+
config.name = path_1.default.basename(projectRoot);
|
|
592
|
+
config.displayName = config.name;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* 检测Git配置信息
|
|
597
|
+
*/
|
|
598
|
+
async function detectGitConfig(projectRoot, config) {
|
|
599
|
+
const gitConfig = {};
|
|
600
|
+
const gitDir = path_1.default.join(projectRoot, '.git');
|
|
601
|
+
// 检查是否是git仓库
|
|
602
|
+
if (!(await directoryExists(gitDir))) {
|
|
603
|
+
config.gitConfig = gitConfig;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
// 读取git配置文件
|
|
607
|
+
const gitConfigPath = path_1.default.join(gitDir, 'config');
|
|
608
|
+
if (await fileExists(gitConfigPath)) {
|
|
609
|
+
try {
|
|
610
|
+
const configContent = await promises_1.default.readFile(gitConfigPath, 'utf8');
|
|
611
|
+
const lines = configContent.split('\n');
|
|
612
|
+
// 解析用户信息和远程仓库
|
|
613
|
+
let inRemoteSection = false;
|
|
614
|
+
for (const line of lines) {
|
|
615
|
+
const trimmedLine = line.trim();
|
|
616
|
+
// 检测远程仓库配置段
|
|
617
|
+
if (trimmedLine.startsWith('[remote')) {
|
|
618
|
+
inRemoteSection = true;
|
|
619
|
+
}
|
|
620
|
+
else if (trimmedLine.startsWith('[')) {
|
|
621
|
+
inRemoteSection = false;
|
|
622
|
+
}
|
|
623
|
+
// 提取远程仓库URL
|
|
624
|
+
if (inRemoteSection && trimmedLine.startsWith('url = ')) {
|
|
625
|
+
const url = trimmedLine.split('url = ')[1].trim();
|
|
626
|
+
if (url) {
|
|
627
|
+
if (!gitConfig.remoteUrls) {
|
|
628
|
+
gitConfig.remoteUrls = [];
|
|
629
|
+
}
|
|
630
|
+
gitConfig.remoteUrls.push(url);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
catch (err) {
|
|
636
|
+
console.error('读取.git/config失败:', err);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
// 读取当前分支
|
|
640
|
+
const headPath = path_1.default.join(gitDir, 'HEAD');
|
|
641
|
+
if (await fileExists(headPath)) {
|
|
642
|
+
try {
|
|
643
|
+
const headContent = await promises_1.default.readFile(headPath, 'utf8');
|
|
644
|
+
const branchMatch = headContent.match(/ref: refs\/heads\/(.*)/);
|
|
645
|
+
if (branchMatch && branchMatch[1]) {
|
|
646
|
+
gitConfig.branch = branchMatch[1];
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
catch (err) {
|
|
650
|
+
console.error('读取当前分支失败:', err);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
// 尝试读取全局git配置获取用户信息
|
|
654
|
+
try {
|
|
655
|
+
// 不同系统的全局git配置路径
|
|
656
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
657
|
+
if (homeDir) {
|
|
658
|
+
const globalGitConfigPath = path_1.default.join(homeDir, '.gitconfig');
|
|
659
|
+
if (await fileExists(globalGitConfigPath)) {
|
|
660
|
+
const globalConfigContent = await promises_1.default.readFile(globalGitConfigPath, 'utf8');
|
|
661
|
+
const nameMatch = globalConfigContent.match(/name = (.*)/);
|
|
662
|
+
const emailMatch = globalConfigContent.match(/email = (.*)/);
|
|
663
|
+
if (nameMatch && nameMatch[1]) {
|
|
664
|
+
gitConfig.userName = nameMatch[1].trim();
|
|
665
|
+
}
|
|
666
|
+
if (emailMatch && emailMatch[1]) {
|
|
667
|
+
gitConfig.userEmail = emailMatch[1].trim();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
catch (err) {
|
|
673
|
+
console.error('读取全局git配置失败:', err);
|
|
674
|
+
}
|
|
675
|
+
config.gitConfig = gitConfig;
|
|
676
|
+
}
|
|
561
677
|
//# sourceMappingURL=project.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-worktool",
|
|
3
3
|
"displayName": "吃豆豆:单测智能体",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.45",
|
|
5
5
|
"description": "单元测试智能体,帮你开发单元测试用例代码直到100%单测覆盖通过。",
|
|
6
6
|
"author": "jianguoke.cn",
|
|
7
7
|
"license": "MIT",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"createup": "node ./uposs.js create-local-folder",
|
|
24
24
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
25
25
|
"puball": "yarn ver && yarn exepack && yarn vspack && yarn pubvs && yarn pubovsx && yarn puboss && yarn pubnpm",
|
|
26
|
-
"exepack": "yarn createup && cross-env PKG_CACHE_PATH=./binaries pkg -o packages/aicoder-1.0.
|
|
26
|
+
"exepack": "yarn createup && cross-env PKG_CACHE_PATH=./binaries pkg -o packages/aicoder-1.0.45 . && yarn upicon",
|
|
27
27
|
"pubvs": "yarn remove-deps && yarn changelog && vsce publish --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
28
28
|
"pubovsx": "yarn remove-deps && ovsx publish -p 47621ff6-be56-4814-865e-d2a8e8a76f86 --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
29
29
|
"patch": "yarn remove-deps && vsce publish patch --yarn && yarn restore-deps",
|
|
30
|
-
"vspack": "yarn createup && yarn remove-deps && vsce package -o packages/aicoder-1.0.
|
|
30
|
+
"vspack": "yarn createup && yarn remove-deps && vsce package -o packages/aicoder-1.0.45.vsix --yarn --baseContentUrl https://aicoder.jianguoke.cn/assets && yarn restore-deps",
|
|
31
31
|
"puboss": "node ./uposs.js upload",
|
|
32
32
|
"pubnpm": "npm publish --registry=https://registry.npmjs.org",
|
|
33
33
|
"prepare": "husky"
|
|
index ebde69e..9153d97 100755
|
|
|
Binary file
|
|
index cd5b13b..2d75c17 100755
|
|
|
Binary file
|
|
index 28d20a2..11496dc 100644
|
|
|
Binary file
|