重大发现:全球文明天崇拜和玉崇拜普遍性验证完成
- 验证了地球上所有文明都具备天崇拜和玉崇拜模式 - 覆盖亚洲、欧洲、非洲、美洲、大洋洲、中东等全球范围 - 确认K音文明传播网络的全球分布 - 完善昆仑38词汇系统的理论框架 - 更新坦桑尼亚玉石开采和埃及法老坟墓水银的考古证据 - 全球文明同源论取得重大突破
This commit is contained in:
220
unified-docs/start-system.sh
Executable file
220
unified-docs/start-system.sh
Executable file
@@ -0,0 +1,220 @@
|
||||
#!/bin/bash
|
||||
# 胡汉三千年统一文档管理系统启动脚本
|
||||
|
||||
# 设置颜色输出
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# 项目根目录
|
||||
PROJECT_ROOT="/home/ben/code/huhan3000"
|
||||
UNIFIED_DOCS="$PROJECT_ROOT/unified-docs"
|
||||
TOOLS_DIR="$UNIFIED_DOCS/tools"
|
||||
|
||||
# 函数:打印彩色消息
|
||||
print_info() {
|
||||
echo -e "${BLUE}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# 函数:检查依赖
|
||||
check_dependencies() {
|
||||
print_info "检查系统依赖..."
|
||||
|
||||
# 检查Python
|
||||
if command -v python3 &> /dev/null; then
|
||||
print_success "Python3 已安装"
|
||||
else
|
||||
print_error "Python3 未安装,请先安装Python3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查必要的Python包
|
||||
REQUIRED_PACKAGES=("hashlib" "json" "pathlib" "shutil" "datetime")
|
||||
for package in "${REQUIRED_PACKAGES[@]}"; do
|
||||
python3 -c "import $package" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "Python包 $package 可用"
|
||||
else
|
||||
print_error "Python包 $package 不可用"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 函数:显示系统状态
|
||||
show_system_status() {
|
||||
print_info "=== 系统状态 ==="
|
||||
|
||||
# 检查工具文件
|
||||
TOOLS=("doc-indexer.py" "search-tool.py" "version-manager.py" "doc-migrator.py")
|
||||
for tool in "${TOOLS[@]}"; do
|
||||
if [ -f "$TOOLS_DIR/$tool" ]; then
|
||||
print_success "工具 $tool 存在"
|
||||
else
|
||||
print_error "工具 $tool 不存在"
|
||||
fi
|
||||
done
|
||||
|
||||
# 检查配置文件
|
||||
if [ -f "$UNIFIED_DOCS/config/settings.json" ]; then
|
||||
print_success "配置文件存在"
|
||||
else
|
||||
print_error "配置文件不存在"
|
||||
fi
|
||||
|
||||
# 检查文档数量
|
||||
DOC_COUNT=$(find "$UNIFIED_DOCS" -name "*.md" -o -name "*.txt" | wc -l)
|
||||
print_info "当前文档数量: $DOC_COUNT"
|
||||
|
||||
# 检查版本数据库
|
||||
if [ -f "$UNIFIED_DOCS/.versions/version-db.json" ]; then
|
||||
print_success "版本数据库存在"
|
||||
else
|
||||
print_warning "版本数据库不存在(首次运行)"
|
||||
fi
|
||||
}
|
||||
|
||||
# 函数:更新文档索引
|
||||
update_index() {
|
||||
print_info "更新文档索引..."
|
||||
cd "$UNIFIED_DOCS"
|
||||
python3 "$TOOLS_DIR/doc-indexer.py"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "文档索引更新完成"
|
||||
else
|
||||
print_error "文档索引更新失败"
|
||||
fi
|
||||
}
|
||||
|
||||
# 函数:搜索文档
|
||||
search_documents() {
|
||||
if [ -z "$1" ]; then
|
||||
print_error "请提供搜索关键词"
|
||||
return 1
|
||||
fi
|
||||
|
||||
print_info "搜索文档: $1"
|
||||
cd "$UNIFIED_DOCS"
|
||||
python3 "$TOOLS_DIR/search-tool.py" "$1"
|
||||
}
|
||||
|
||||
# 函数:迁移文档
|
||||
migrate_documents() {
|
||||
print_info "开始文档迁移..."
|
||||
|
||||
# 先进行模拟迁移
|
||||
print_info "模拟迁移检查..."
|
||||
cd "$UNIFIED_DOCS"
|
||||
python3 "$TOOLS_DIR/doc-migrator.py" migrate --dry-run
|
||||
|
||||
# 询问是否继续实际迁移
|
||||
read -p "是否继续实际迁移?(y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
print_info "开始实际迁移..."
|
||||
python3 "$TOOLS_DIR/doc-migrator.py" migrate
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "文档迁移完成"
|
||||
# 迁移后更新索引
|
||||
update_index
|
||||
else
|
||||
print_error "文档迁移失败"
|
||||
fi
|
||||
else
|
||||
print_info "迁移已取消"
|
||||
fi
|
||||
}
|
||||
|
||||
# 函数:显示版本统计
|
||||
show_version_stats() {
|
||||
print_info "显示版本统计..."
|
||||
cd "$UNIFIED_DOCS"
|
||||
python3 "$TOOLS_DIR/version-manager.py" stats
|
||||
}
|
||||
|
||||
# 函数:显示帮助信息
|
||||
show_help() {
|
||||
echo -e "${BLUE}胡汉三千年统一文档管理系统${NC}"
|
||||
echo "用法: $0 [命令]"
|
||||
echo ""
|
||||
echo "可用命令:"
|
||||
echo " status - 显示系统状态"
|
||||
echo " index - 更新文档索引"
|
||||
echo " search <关键词> - 搜索文档"
|
||||
echo " migrate - 迁移文档到统一系统"
|
||||
echo " versions - 显示版本统计"
|
||||
echo " help - 显示此帮助信息"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo " $0 status"
|
||||
echo " $0 search 音韵"
|
||||
echo " $0 migrate"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
# 检查项目目录
|
||||
if [ ! -d "$PROJECT_ROOT" ]; then
|
||||
print_error "项目根目录不存在: $PROJECT_ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$UNIFIED_DOCS" ]; then
|
||||
print_error "统一文档目录不存在: $UNIFIED_DOCS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查依赖
|
||||
check_dependencies
|
||||
|
||||
# 处理命令
|
||||
case "$1" in
|
||||
"status")
|
||||
show_system_status
|
||||
;;
|
||||
"index")
|
||||
update_index
|
||||
;;
|
||||
"search")
|
||||
if [ -z "$2" ]; then
|
||||
print_error "请提供搜索关键词"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
search_documents "$2"
|
||||
;;
|
||||
"migrate")
|
||||
migrate_documents
|
||||
;;
|
||||
"versions")
|
||||
show_version_stats
|
||||
;;
|
||||
"help"|"")
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
print_error "未知命令: $1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user