feat: CutThenThink v3.0 初始版本
完整实现 Tauri + Vanilla JS 轻量级截图工具 Phase 1 - 项目搭建 - Tauri 2.x 项目初始化 - Vite 前端项目搭建 - 基础 UI 框架(CSS 变量、组件库) - 构建配置优化 Phase 2 - 核心截图功能 - 全屏/区域/窗口截图 - 截图预览和管理 - 文件命名和缩略图 - 全局快捷键集成 Phase 3 - 上传与存储 - 多图床上传(GitHub/Imgur/自定义) - 配置管理系统 - SQLite 数据库 Phase 4 - OCR 集成 - 云端 OCR(百度/腾讯云) - 插件管理系统 - 本地 OCR 插件(Go) - OCR 结果处理 Phase 5 - AI 分类系统 - Claude/OpenAI API 集成 - Prompt 模板引擎 - 模板管理界面 - 自动分类流程 Phase 6 - 历史记录与管理 - 图库视图(网格/列表) - 搜索与筛选 - 批量操作 - 导出功能(JSON/CSV/ZIP) Phase 7 - 打包与发布 - 多平台构建配置 - CI/CD 工作流 - 图标和资源 - 安装包配置 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
81
scripts/build.sh
Normal file
81
scripts/build.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
# Build script for CutThenThink Lite
|
||||
set -e
|
||||
|
||||
echo "Building CutThenThink Lite..."
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Detect OS
|
||||
OS="unknown"
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
OS="linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
OS="macos"
|
||||
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
||||
OS="windows"
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Detected OS: $OS${NC}"
|
||||
|
||||
# Check dependencies
|
||||
if [ "$OS" == "linux" ]; then
|
||||
echo -e "${YELLOW}Checking Linux dependencies...${NC}"
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo -e "${YELLOW}Note: Some dependencies may require sudo${NC}"
|
||||
fi
|
||||
|
||||
# Check for required packages
|
||||
MISSING=()
|
||||
for pkg in libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf; do
|
||||
if ! dpkg -l | grep -q "$pkg"; then
|
||||
MISSING+=("$pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#MISSING[@]} -gt 0 ]; then
|
||||
echo -e "${RED}Missing dependencies: ${MISSING[*]}${NC}"
|
||||
echo -e "${YELLOW}Install them with:${NC}"
|
||||
echo "sudo apt-get install -y ${MISSING[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}All dependencies installed${NC}"
|
||||
fi
|
||||
|
||||
# Check Node.js
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo -e "${RED}Node.js is not installed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check npm
|
||||
if ! command -v npm &> /dev/null; then
|
||||
echo -e "${RED}npm is not installed${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Rust/Cargo
|
||||
if ! command -v cargo &> /dev/null; then
|
||||
echo -e "${RED}Rust/Cargo is not installed${NC}"
|
||||
echo -e "${YELLOW}Install from: https://rustup.rs/${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Installing Node dependencies...${NC}"
|
||||
npm ci
|
||||
|
||||
echo -e "${GREEN}Building frontend...${NC}"
|
||||
npm run build
|
||||
|
||||
echo -e "${GREEN}Building Tauri application...${NC}"
|
||||
npm run tauri build
|
||||
|
||||
echo -e "${GREEN}Build complete!${NC}"
|
||||
echo -e "Output directory: src-tauri/target/release/bundle/"
|
||||
163
scripts/check-build.sh
Normal file
163
scripts/check-build.sh
Normal file
@@ -0,0 +1,163 @@
|
||||
#!/bin/bash
|
||||
# Build status check script for CutThenThink Lite
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo "Checking build status for CutThenThink Lite..."
|
||||
echo ""
|
||||
|
||||
# Check function
|
||||
check() {
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
else
|
||||
echo -e "${RED}✗${NC} $1"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check Node.js
|
||||
echo "Checking Node.js..."
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_VERSION=$(node --version)
|
||||
check "Node.js installed ($NODE_VERSION)"
|
||||
else
|
||||
echo -e "${RED}✗${NC} Node.js not installed"
|
||||
fi
|
||||
|
||||
# Check npm
|
||||
echo ""
|
||||
echo "Checking npm..."
|
||||
if command -v npm &> /dev/null; then
|
||||
NPM_VERSION=$(npm --version)
|
||||
check "npm installed ($NPM_VERSION)"
|
||||
else
|
||||
echo -e "${RED}✗${NC} npm not installed"
|
||||
fi
|
||||
|
||||
# Check Rust
|
||||
echo ""
|
||||
echo "Checking Rust..."
|
||||
if command -v rustc &> /dev/null; then
|
||||
RUSTC_VERSION=$(rustc --version)
|
||||
check "Rust installed ($RUSTC_VERSION)"
|
||||
else
|
||||
echo -e "${RED}✗${NC} Rust not installed"
|
||||
echo -e "${YELLOW} Install from: https://rustup.rs/${NC}"
|
||||
fi
|
||||
|
||||
if command -v cargo &> /dev/null; then
|
||||
CARGO_VERSION=$(cargo --version)
|
||||
check "Cargo installed ($CARGO_VERSION)"
|
||||
else
|
||||
echo -e "${RED}✗${NC} Cargo not installed"
|
||||
fi
|
||||
|
||||
# Check Tauri CLI
|
||||
echo ""
|
||||
echo "Checking Tauri CLI..."
|
||||
if command -v tauri &> /dev/null; then
|
||||
TAURI_VERSION=$(tauri --version || echo "unknown")
|
||||
check "Tauri CLI installed ($TAURI_VERSION)"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} Tauri CLI not found (will be installed by npm)"
|
||||
fi
|
||||
|
||||
# Check Linux dependencies (Linux only)
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
echo ""
|
||||
echo "Checking Linux dependencies..."
|
||||
|
||||
DEPS=(
|
||||
"libgtk-3-dev"
|
||||
"libwebkit2gtk-4.0-dev"
|
||||
"libappindicator3-dev"
|
||||
"librsvg2-dev"
|
||||
"patchelf"
|
||||
)
|
||||
|
||||
MISSING=()
|
||||
for dep in "${DEPS[@]}"; do
|
||||
if dpkg -l | grep -q "$dep"; then
|
||||
check "$dep installed"
|
||||
else
|
||||
echo -e "${RED}✗${NC} $dep not installed"
|
||||
MISSING+=("$dep")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#MISSING[@]} -gt 0 ]; then
|
||||
echo ""
|
||||
echo -e "${YELLOW}Missing dependencies. Install with:${NC}"
|
||||
echo "sudo apt-get install -y ${MISSING[*]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check project structure
|
||||
echo ""
|
||||
echo "Checking project structure..."
|
||||
|
||||
FILES=(
|
||||
"package.json"
|
||||
"vite.config.js"
|
||||
"src-tauri/Cargo.toml"
|
||||
"src-tauri/tauri.conf.json"
|
||||
"src-tauri/src/main.rs"
|
||||
"main.js"
|
||||
"index.html"
|
||||
)
|
||||
|
||||
for file in "${FILES[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
check "$file exists"
|
||||
else
|
||||
echo -e "${RED}✗${NC} $file missing"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check icons
|
||||
echo ""
|
||||
echo "Checking icons..."
|
||||
|
||||
ICONS=(
|
||||
"src-tauri/icons/32x32.png"
|
||||
"src-tauri/icons/128x128.png"
|
||||
"src-tauri/icons/icon.ico"
|
||||
"src-tauri/icons/icon.icns"
|
||||
)
|
||||
|
||||
for icon in "${ICONS[@]}"; do
|
||||
if [ -f "$icon" ]; then
|
||||
check "$icon exists"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} $icon missing (optional)"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check node_modules
|
||||
echo ""
|
||||
echo "Checking dependencies..."
|
||||
|
||||
if [ -d "node_modules" ]; then
|
||||
check "node_modules installed"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} node_modules not found"
|
||||
echo -e "${YELLOW} Run: npm install${NC}"
|
||||
fi
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo -e "${GREEN}================================${NC}"
|
||||
echo "Build status check complete!"
|
||||
echo -e "${GREEN}================================${NC}"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Install missing dependencies (if any)"
|
||||
echo " 2. Run: npm install"
|
||||
echo " 3. Run: npm run build"
|
||||
echo " 4. Run: npm run tauri:build"
|
||||
29
scripts/dev.sh
Normal file
29
scripts/dev.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Development build script for CutThenThink Lite
|
||||
set -e
|
||||
|
||||
echo "Building CutThenThink Lite (Debug)..."
|
||||
|
||||
# Check dependencies
|
||||
if ! command -v cargo &> /dev/null; then
|
||||
echo "Rust/Cargo is not installed"
|
||||
echo "Install from: https://rustup.rs/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "Node.js is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing Node dependencies..."
|
||||
npm ci
|
||||
|
||||
echo "Building frontend..."
|
||||
npm run build
|
||||
|
||||
echo "Building Tauri application (Debug)..."
|
||||
npm run tauri build --debug
|
||||
|
||||
echo "Build complete!"
|
||||
echo "Output directory: src-tauri/target/debug/bundle/"
|
||||
23
scripts/docker-build.sh
Normal file
23
scripts/docker-build.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Docker build script for CutThenThink Lite
|
||||
set -e
|
||||
|
||||
IMAGE_NAME="cutthink-lite-builder"
|
||||
CONTAINER_NAME="cutthink-lite-build-container"
|
||||
|
||||
echo "Building CutThenThink Lite using Docker..."
|
||||
|
||||
# Build Docker image
|
||||
echo "Building Docker image..."
|
||||
docker build -f Dockerfile.build -t $IMAGE_NAME .
|
||||
|
||||
# Run build in container
|
||||
echo "Running build in container..."
|
||||
docker run --rm -v $(pwd):/out $IMAGE_NAME bash -c "
|
||||
cp -r /app/src-tauri/target/release/bundle/* /out/
|
||||
"
|
||||
|
||||
echo "Build complete! Check the bundle directory for output."
|
||||
echo ""
|
||||
echo "To clean up:"
|
||||
echo " docker rmi $IMAGE_NAME"
|
||||
36
scripts/package-frontend.sh
Normal file
36
scripts/package-frontend.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Package frontend only for testing
|
||||
set -e
|
||||
|
||||
echo "Packaging CutThenThink Lite (Frontend Only)..."
|
||||
|
||||
# Build frontend
|
||||
echo "Building frontend..."
|
||||
npm run build
|
||||
|
||||
# Create package directory
|
||||
PACKAGE_DIR="cutthink-lite-frontend"
|
||||
rm -rf "$PACKAGE_DIR"
|
||||
mkdir -p "$PACKAGE_DIR"
|
||||
|
||||
# Copy built files
|
||||
cp -r dist/* "$PACKAGE_DIR/"
|
||||
|
||||
# Create archive
|
||||
echo "Creating archive..."
|
||||
tar -czf "${PACKAGE_DIR}.tar.gz" "$PACKAGE_DIR"
|
||||
if command -v zip &> /dev/null; then
|
||||
zip -rq "${PACKAGE_DIR}.zip" "$PACKAGE_DIR"
|
||||
echo "Package created:"
|
||||
echo " - ${PACKAGE_DIR}.tar.gz"
|
||||
echo " - ${PACKAGE_DIR}.zip"
|
||||
else
|
||||
echo "Package created:"
|
||||
echo " - ${PACKAGE_DIR}.tar.gz"
|
||||
echo " (zip not available, install with: sudo apt-get install zip)"
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$PACKAGE_DIR"
|
||||
|
||||
echo "Done!"
|
||||
135
scripts/phase4-check.sh
Normal file
135
scripts/phase4-check.sh
Normal file
@@ -0,0 +1,135 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Phase 4 - OCR 集成验证脚本
|
||||
|
||||
echo "======================================"
|
||||
echo "Phase 4 - OCR 集成验证"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
|
||||
# 颜色定义
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# 检查函数
|
||||
check_file() {
|
||||
if [ -f "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗${NC} $1 (不存在)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_dir() {
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${GREEN}✓${NC} $1 (目录)"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗${NC} $1 (目录不存在)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 项目根目录
|
||||
PROJECT_ROOT="/home/congsh/CodeSpace/ClaudeSpace/cutThink_lite"
|
||||
cd "$PROJECT_ROOT" || exit 1
|
||||
|
||||
echo "1. 检查后端模块结构..."
|
||||
echo "-----------------------------------"
|
||||
check_dir "src-tauri/src/ocr"
|
||||
check_file "src-tauri/src/ocr/mod.rs"
|
||||
check_file "src-tauri/src/ocr/cloud.rs"
|
||||
check_file "src-tauri/src/ocr/local.rs"
|
||||
check_file "src-tauri/src/ocr/result.rs"
|
||||
check_dir "src-tauri/src/plugin"
|
||||
check_file "src-tauri/src/plugin/mod.rs"
|
||||
check_file "src-tauri/src/secure_storage.rs"
|
||||
echo ""
|
||||
|
||||
echo "2. 检查 Go 插件项目..."
|
||||
echo "-----------------------------------"
|
||||
check_dir "src-ocr-plugin"
|
||||
check_file "src-ocr-plugin/go.mod"
|
||||
check_file "src-ocr-plugin/main.go"
|
||||
check_file "src-ocr-plugin/Makefile"
|
||||
check_file "src-ocr-plugin/README.md"
|
||||
echo ""
|
||||
|
||||
echo "3. 检查前端组件..."
|
||||
echo "-----------------------------------"
|
||||
check_file "src/components/views/OCRManager.vue"
|
||||
check_file "src/components/views/PluginManager.vue"
|
||||
echo ""
|
||||
|
||||
echo "4. 检查插件仓库..."
|
||||
echo "-----------------------------------"
|
||||
check_file "/home/congsh/CodeSpace/ClaudeSpace/CutThenThink/plugins/plugins.json"
|
||||
echo ""
|
||||
|
||||
echo "5. 检查 Cargo.toml 依赖..."
|
||||
echo "-----------------------------------"
|
||||
if grep -q "sha2" src-tauri/Cargo.toml; then
|
||||
echo -e "${GREEN}✓${NC} SHA2 依赖已添加"
|
||||
else
|
||||
echo -e "${RED}✗${NC} SHA2 依赖缺失"
|
||||
fi
|
||||
|
||||
if grep -q "aes-gcm" src-tauri/Cargo.toml; then
|
||||
echo -e "${GREEN}✓${NC} AES-GCM 依赖已添加"
|
||||
else
|
||||
echo -e "${RED}✗${NC} AES-GCM 依赖缺失"
|
||||
fi
|
||||
|
||||
if grep -q "futures-util" src-tauri/Cargo.toml; then
|
||||
echo -e "${GREEN}✓${NC} futures-util 依赖已添加"
|
||||
else
|
||||
echo -e "${RED}✗${NC} futures-util 依赖缺失"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "6. 功能模块统计..."
|
||||
echo "-----------------------------------"
|
||||
OCR_FILES=$(find src-tauri/src/ocr -name "*.rs" 2>/dev/null | wc -l)
|
||||
echo "OCR 模块文件数: $OCR_FILES"
|
||||
|
||||
PLUGIN_FILES=$(find src-tauri/src/plugin -name "*.rs" 2>/dev/null | wc -l)
|
||||
echo "插件管理文件数: $PLUGIN_FILES"
|
||||
|
||||
VUE_COMPONENTS=$(find src/components/views -name "*OCR*.vue" -o -name "*Plugin*.vue" 2>/dev/null | wc -l)
|
||||
echo "新增 Vue 组件: $VUE_COMPONENTS"
|
||||
echo ""
|
||||
|
||||
echo "7. 代码行数统计..."
|
||||
echo "-----------------------------------"
|
||||
if command -v cloc &> /dev/null; then
|
||||
echo "Rust 代码行数:"
|
||||
cloc src-tauri/src/ocr src-tauri/src/plugin src-tauri/src/secure_storage.rs 2>/dev/null | grep "Rust" | awk '{print " " $5 " 行代码"}'
|
||||
else
|
||||
echo "cloc 未安装,跳过代码行数统计"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
echo "8. TODO 验证清单..."
|
||||
echo "-----------------------------------"
|
||||
echo -e "${YELLOW}□${NC} 至少 2 种云端 OCR 测试通过 (需要 API 密钥)"
|
||||
echo -e "${YELLOW}□${NC} API 密钥安全存储 (已实现 AES-256-GCM 加密)"
|
||||
echo -e "${YELLOW}□${NC} 可获取远程插件列表 (已实现)"
|
||||
echo -e "${YELLOW}□${NC} 插件下载带进度显示 (已实现)"
|
||||
echo -e "${YELLOW}□${NC} SHA256 校验正确执行 (已实现)"
|
||||
echo -e "${YELLOW}□${NC} OCR 结果实时显示 (已实现前端组件)"
|
||||
echo ""
|
||||
|
||||
echo "======================================"
|
||||
echo "验证完成!"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
echo "后续步骤:"
|
||||
echo "1. 安装 Rust 工具链并编译: cd src-tauri && cargo build"
|
||||
echo "2. 安装 Go 工具链并编译插件: cd src-ocr-plugin && make"
|
||||
echo "3. 配置百度/腾讯云 OCR API 密钥"
|
||||
echo "4. 测试 OCR 功能"
|
||||
echo ""
|
||||
71
scripts/verify_phase3.sh
Normal file
71
scripts/verify_phase3.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Phase 3 验证脚本
|
||||
|
||||
echo "======================================"
|
||||
echo "Phase 3 - 上传与存储功能验证"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
|
||||
# 检查文件是否存在
|
||||
echo "检查 Rust 源文件..."
|
||||
|
||||
files=(
|
||||
"src-tauri/src/config.rs"
|
||||
"src-tauri/src/upload.rs"
|
||||
"src-tauri/src/database.rs"
|
||||
"src-tauri/src/lib.rs"
|
||||
"src-tauri/Cargo.toml"
|
||||
)
|
||||
|
||||
missing_files=0
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
echo " ✓ $file"
|
||||
else
|
||||
echo " ✗ $file (缺失)"
|
||||
missing_files=$((missing_files + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "检查前端文件..."
|
||||
|
||||
frontend_files=(
|
||||
"src/api/index.ts"
|
||||
"src/store/index.ts"
|
||||
"src/store/config.ts"
|
||||
"src/store/upload.ts"
|
||||
"src/store/records.ts"
|
||||
"src/store/settings.ts"
|
||||
"src/components/views/ConfigManager.vue"
|
||||
"src/components/views/UploadHistory.vue"
|
||||
)
|
||||
|
||||
for file in "${frontend_files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
echo " ✓ $file"
|
||||
else
|
||||
echo " ✗ $file (缺失)"
|
||||
missing_files=$((missing_files + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "======================================"
|
||||
echo "验证结果"
|
||||
echo "======================================"
|
||||
|
||||
if [ $missing_files -eq 0 ]; then
|
||||
echo "✓ 所有文件都已创建"
|
||||
echo ""
|
||||
echo "下一步:"
|
||||
echo "1. 如果已安装 Rust,运行 'cd src-tauri && cargo check' 检查编译"
|
||||
echo "2. 确保 Node.js 依赖已安装: 'npm install'"
|
||||
echo "3. 启动开发服务器: 'npm run tauri dev'"
|
||||
exit 0
|
||||
else
|
||||
echo "✗ 缺失 $missing_files 个文件"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user