zero-ai 1.0.55 → 1.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zero-ai",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "Zero Ecotope AI",
5
5
  "main": "src/ai.js",
6
6
  "bin": {
@@ -14,6 +14,7 @@ module.exports = async (options) => {
14
14
  const cursorRulesTarget = path.resolve(outputPath, ".cursor/rules");
15
15
 
16
16
  Ec.execute(`准备从远程仓库下载 Cursor 规则配置...`);
17
+ Ec.info(`远程仓库地址:${repoUrl}`);
17
18
 
18
19
  if (!fs.existsSync(path.dirname(repoCache))) {
19
20
  fs.mkdirSync(path.dirname(repoCache), { recursive: true });
@@ -59,8 +60,11 @@ module.exports = async (options) => {
59
60
  }
60
61
 
61
62
  if (!fs.existsSync(cursorRulesSource)) {
62
- Ec.error(`仓库中不存在 .cursor/rules 目录!`);
63
- process.exit(1);
63
+ Ec.info(`仓库中不存在 .cursor/rules 目录,正在创建...`);
64
+ fs.mkdirSync(cursorRulesSource, { recursive: true });
65
+ Ec.info(`已创建 ${cursorRulesSource} 目录`);
66
+ Ec.info(`目录为空,请手动添加 .mdc 规则文件到远程仓库后重新运行`);
67
+ process.exit(0);
64
68
  }
65
69
 
66
70
  // 过滤出所有 .mdc 文件
@@ -70,8 +74,10 @@ module.exports = async (options) => {
70
74
  });
71
75
 
72
76
  if (ruleFiles.length === 0) {
73
- Ec.error(`.cursor/rules 目录中没有找到任何 .mdc 规则文件!`);
74
- process.exit(1);
77
+ Ec.info(`.cursor/rules 目录中没有找到任何 .mdc 规则文件`);
78
+ Ec.info(`目录路径:${cursorRulesSource}`);
79
+ Ec.info(`请手动添加 .mdc 规则文件到远程仓库后重新运行`);
80
+ process.exit(0);
75
81
  }
76
82
 
77
83
  Ec.execute(`找到 ${ruleFiles.length} 个 Cursor 规则文件 (.mdc)`);
@@ -132,35 +138,46 @@ module.exports = async (options) => {
132
138
  // 当前是 submodule,需要找到父仓库
133
139
  isSubmodule = true;
134
140
  Ec.info(`检测到当前仓库是 Git submodule`);
141
+ Ec.info(`当前目录:${outputPath}`);
135
142
 
136
143
  // 向上查找父仓库(包含 .git 目录的仓库)
137
144
  let currentPath = path.resolve(outputPath, "..");
138
145
  let foundParent = false;
139
146
 
147
+ Ec.info(`开始向上查找父仓库,起始路径:${currentPath}`);
148
+
140
149
  // 最多向上查找10层
141
150
  for (let i = 0; i < 10; i++) {
142
151
  const parentGitPath = path.join(currentPath, ".git");
152
+ Ec.info(`[${i}] 检查路径:${currentPath}`);
153
+ Ec.info(`[${i}] .git 路径:${parentGitPath}`);
143
154
 
144
155
  if (fs.existsSync(parentGitPath)) {
145
156
  const parentStats = fs.statSync(parentGitPath);
157
+ Ec.info(`[${i}] .git 存在,是目录:${parentStats.isDirectory()},是文件:${parentStats.isFile()}`);
158
+
146
159
  if (parentStats.isDirectory()) {
147
160
  parentRepoPath = currentPath;
148
161
  foundParent = true;
149
- Ec.info(`找到父仓库:${parentRepoPath}`);
162
+ Ec.info(`✓ 找到父仓库:${parentRepoPath}`);
150
163
  break;
151
164
  }
165
+ } else {
166
+ Ec.info(`[${i}] .git 不存在`);
152
167
  }
153
168
 
154
169
  // 到达根目录,停止查找
155
170
  const nextPath = path.resolve(currentPath, "..");
156
171
  if (nextPath === currentPath) {
172
+ Ec.info(`已到达根目录,停止查找`);
157
173
  break;
158
174
  }
159
175
  currentPath = nextPath;
160
176
  }
161
177
 
162
178
  if (!foundParent) {
163
- Ec.info(`未找到父仓库,将跳过 Git 排除规则配置`);
179
+ Ec.info(`✗ 未找到父仓库,将跳过 Git 排除规则配置`);
180
+ Ec.info(`parentRepoPath = ${parentRepoPath}`);
164
181
  parentRepoPath = null;
165
182
  }
166
183
  }