File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4141 - name : 检查目录结构
4242 run : |
4343 echo "验证项目目录结构..."
44- required_dirs=("rules" "docs" "examples" "templates ")
44+ required_dirs=("rules" "docs" "scripts ")
4545 for dir in "${required_dirs[@]}"; do
4646 if [ ! -d "$dir" ]; then
4747 echo "错误: 缺少必需目录 $dir"
Original file line number Diff line number Diff line change 11import glob
2- import yaml
3- from pathlib import Path
2+ import os
3+
44
55def check_translation_consistency ():
6+ """检查 rules/ 目录下所有 .cursorrules 文件的基本完整性。"""
67 errors = 0
7- for file in glob .glob ("rules/**/*.mdc" , recursive = True ):
8+ files_checked = 0
9+ for file in glob .glob ("rules/**/.cursorrules" , recursive = True ):
10+ files_checked += 1
11+ file_size = os .path .getsize (file )
12+ if file_size == 0 :
13+ print (f"❌ { file } 文件为空" )
14+ errors += 1
15+ continue
816 with open (file , encoding = 'utf-8' ) as f :
917 content = f .read ()
10- if "---" not in content :
11- print ( f"❌ { file } 缺少元数据头部" )
12- errors += 1
13- elif "description:" not in content :
14- print ( f"⚠️ { file } 缺少description描述" )
15- return errors
18+ # 检查是否包含中文内容(表明已翻译)
19+ has_chinese = any ( ' \u4e00 ' <= ch <= ' \u9fff ' for ch in content )
20+ if not has_chinese :
21+ print ( f"⚠️ { file } 可能未翻译(未检测到中文内容)" )
22+ return errors , files_checked
23+
1624
1725if __name__ == "__main__" :
1826 print ("开始翻译校验..." )
19- error_count = check_translation_consistency ()
20- print (f"校验完成,发现 { error_count } 处问题" )
27+ error_count , total = check_translation_consistency ()
28+ print (f"校验完成:共检查 { total } 个文件 ,发现 { error_count } 处问题" )
You can’t perform that action at this time.
0 commit comments