feat: 重构项目结构并添加平台同步基础架构

- 重构项目目录结构,将功能模块移至 modules/ 目录
- 创建平台同步基础架构,包括发布器基类和 GitHub 发布器
- 新增 UI 状态管理模块 (modules/ui/state.py) 统一管理会话状态
- 更新依赖配置,添加平台同步所需依赖 (httpx, pyperclip)
- 整理文档结构,将所有文档分类移至 docs/ 目录
- 添加 .cursorrules 文件定义项目开发规范
- 清理根目录重复文件,保持项目结构整洁
This commit is contained in:
刘国栋
2026-01-30 10:21:29 +08:00
parent 77d5ec70f8
commit 8f7f082c3d
102 changed files with 33742 additions and 1526 deletions
+124
View File
@@ -0,0 +1,124 @@
"""
更新所有文档文件中的路径引用
"""
import re
from pathlib import Path
# 项目根目录
root = Path(__file__).parent
# 文档路径映射(旧路径 -> 新路径)
doc_path_mappings = {
# 功能文档
r'`([A-Z_]+_FEATURE\.md)`': r'`docs/features/\1`',
r'\(([A-Z_]+_FEATURE\.md)\)': r'(docs/features/\1)',
r'([A-Z_]+_FEATURE\.md)': r'docs/features/\1',
# 分析报告
r'`(ANALYSIS_ACCURACY_REPORT\.md)`': r'`docs/analysis/\1`',
r'`(CODE_DOCUMENTATION_ANALYSIS\.md)`': r'`docs/analysis/\1`',
r'`(DOCUMENTATION_REVERSE_VERIFICATION\.md)`': r'`docs/analysis/\1`',
r'`(FEATURE_ANALYSIS\.md)`': r'`docs/analysis/\1`',
r'`(FEATURE_PRIORITY_ANALYSIS\.md)`': r'`docs/analysis/\1`',
r'`(FUNCTION_VERIFICATION_REPORT\.md)`': r'`docs/analysis/\1`',
r'`(GEO_COMPLIANCE_ANALYSIS\.md)`': r'`docs/analysis/\1`',
# 指南文档
r'`(QUICK_START_GUIDE\.md)`': r'`docs/guides/\1`',
r'`(STORAGE_GUIDE\.md)`': r'`docs/guides/\1`',
r'`(PLATFORM_SETUP\.md)`': r'`docs/guides/\1`',
r'`(LAYOUT_UPGRADE_GUIDE\.md)`': r'`docs/guides/\1`',
r'`(DECISION_GUIDE\.md)`': r'`docs/guides/\1`',
# 实现文档
r'`(IMPLEMENTATION_SUMMARY\.md)`': r'`docs/implementation/\1`',
r'`(PLATFORM_SYNC_ANALYSIS\.md)`': r'`docs/implementation/\1`',
r'`(PLATFORM_SYNC_IMPLEMENTATION\.md)`': r'`docs/implementation/\1`',
r'`(PLATFORM_SYNC_TEST\.md)`': r'`docs/implementation/\1`',
r'`(INTEGRATION_NOTES\.md)`': r'`docs/implementation/\1`',
r'`(FEATURES_COMPLETE_LIST\.md)`': r'`docs/implementation/\1`',
r'`(ADVANCED_FEATURES\.md)`': r'`docs/implementation/\1`',
# 模块文件路径
r'`([a-z_]+\.py)`': r'`modules/\1`',
r'\(([a-z_]+\.py)\)': r'(modules/\1)',
}
# 需要更新的模块文件名
module_files = [
"data_storage.py",
"keyword_tool.py",
"content_scorer.py",
"eeat_enhancer.py",
"semantic_expander.py",
"fact_density_enhancer.py",
"schema_generator.py",
"topic_cluster.py",
"multimodal_prompt.py",
"roi_analyzer.py",
"workflow_automation.py",
"keyword_mining.py",
"optimization_techniques.py",
"content_metrics.py",
"technical_config_generator.py",
"negative_monitor.py",
"resource_recommender.py",
"config_optimizer.py",
]
def update_doc_references(file_path: Path):
"""更新单个文档文件中的路径引用"""
try:
content = file_path.read_text(encoding='utf-8')
original_content = content
updated = False
# 更新文档路径引用
for pattern, replacement in doc_path_mappings.items():
if re.search(pattern, content):
content = re.sub(pattern, replacement, content)
updated = True
# 更新模块文件路径(更精确的匹配)
for module_file in module_files:
# 匹配 `module_file` 或 (module_file) 格式
patterns = [
(rf'`{re.escape(module_file)}`', f'`modules/{module_file}`'),
(rf'\({re.escape(module_file)}\)', f'(modules/{module_file})'),
(rf'([^/]){re.escape(module_file)}', rf'\1modules/{module_file}'),
]
for pattern, replacement in patterns:
if re.search(pattern, content):
content = re.sub(pattern, replacement, content)
updated = True
if updated and content != original_content:
file_path.write_text(content, encoding='utf-8')
print(f"✓ Updated: {file_path.relative_to(root)}")
return True
return False
except Exception as e:
print(f"✗ Error updating {file_path.name}: {e}")
return False
def main():
"""更新所有文档文件中的路径引用"""
updated_count = 0
# 更新README.md
readme = root / "README.md"
if readme.exists():
if update_doc_references(readme):
updated_count += 1
# 更新docs目录下的所有.md文件
docs_dir = root / "docs"
if docs_dir.exists():
for md_file in docs_dir.rglob("*.md"):
if update_doc_references(md_file):
updated_count += 1
print(f"\n✅ Updated {updated_count} documentation files")
if __name__ == "__main__":
main()