5.1 KiB
5.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
SVN Log Tool is a Java-based application that fetches SVN logs, exports them to Markdown, and uses DeepSeek AI to analyze logs and generate Excel workload reports.
Tech Stack: Java 8, Maven, Spring Boot 2.7.18, SVNKit, Apache POI, OkHttp
Entry Points:
- CLI:
com.svnlog.Main- Interactive SVN log fetcher - Web:
com.svnlog.WebApplication- Web workbench with REST API (port 8080) - AI Processor:
com.svnlog.DeepSeekLogProcessor- Standalone AI analysis tool
Build & Run Commands
Build
# Compile only (fastest validation)
mvn clean compile
# Package with tests
mvn clean package
# Package without tests
mvn clean package -DskipTests
Run
# Web workbench (recommended)
mvn spring-boot:run -Dspring-boot.run.mainClass=com.svnlog.WebApplication
# Access at http://localhost:8080
# CLI tool
java -jar target/svn-log-tool-1.0.0-jar-with-dependencies.jar
# AI processor
java -cp target/svn-log-tool-1.0.0-jar-with-dependencies.jar com.svnlog.DeepSeekLogProcessor
Test
# Run all tests
mvn test
# Run single test class
mvn -Dtest=ClassName test
# Run single test method
mvn -Dtest=ClassName#methodName test
Architecture
Core Components
SVN Layer (com.svnlog):
SVNLogFetcher- SVN connection, log fetching, user filteringLogEntry- Log data modelMain- CLI interaction and Markdown generation
AI Layer (com.svnlog):
DeepSeekLogProcessor- Calls DeepSeek API, generates Excel workload reports
Web Layer (com.svnlog.web):
controller/AppController- REST API endpointscontroller/GlobalExceptionHandler- Centralized error handlingservice/TaskService- Async task orchestrationservice/SvnWorkflowService- SVN fetch workflowservice/AiWorkflowService- AI analysis workflowservice/TaskPersistenceService- Task history persistenceservice/HealthService- System health checksservice/SettingsService- API key and output directory managementservice/SvnPresetService- Preset SVN projectsservice/OutputFileService- File listing and downloadsservice/AiInputValidator- Input validation (max 20 files, 2MB each)service/RetrySupport- Retry logic for external calls
Frontend (src/main/resources/static):
index.html- Main web interfaceapp.js- Frontend logicstyles.css- Styling
Data Flow
- SVN Fetch: User input →
SVNLogFetcher→ Markdown file (outputs/md/*.md) - AI Analysis: Markdown →
DeepSeekLogProcessor→ Excel file (outputs/excel/*.xlsx) - Web Mode: REST API → Async tasks → Task history (
outputs/task-history.json)
Output Directory Structure
outputs/
├── md/ # SVN log Markdown files
├── excel/ # AI-generated Excel reports
└── task-history.json # Task persistence (survives restarts)
Key REST API Endpoints
POST /api/svn/test-connection- Test SVN connectionPOST /api/svn/fetch- Async SVN log fetchGET /api/svn/presets- List preset SVN projectsPOST /api/ai/analyze- Async AI analysisGET /api/tasks- List all tasksGET /api/tasks/query?status=&type=&keyword=&page=1&size=10- Query tasksPOST /api/tasks/{taskId}/cancel- Cancel running taskGET /api/health- System health statusGET /api/files- List output filesGET /api/files/download?path=...- Download fileGET /api/settings- Get settingsPUT /api/settings- Update settings
DeepSeek API Configuration
API Key Priority (highest to lowest):
- Request-level
apiKeyparameter - Runtime settings (via
/api/settings) - Environment variable
DEEPSEEK_API_KEY
Security: Never commit real API keys. Use environment variables in production.
Code Style Requirements
- Java 8 compatibility: No Java 9+ APIs
- Imports: No wildcards, explicit imports only, grouped by:
java.*/ third-party /com.svnlog.* - Formatting: 4 spaces, max 120 chars/line, always use braces for
if/for/while - Naming:
UpperCamelCasefor classes,lowerCamelCasefor methods/variables,UPPER_SNAKE_CASEfor constants - Resources: Use try-with-resources for I/O, explicit UTF-8 encoding
- Error handling: Never swallow exceptions, provide actionable error messages
Testing Strategy
- Test directory:
src/test/java/com/svnlog/ - Naming:
<ClassName>Test, methods:should<Behavior>When<Condition> - Minimal validation:
mvn clean compilemust pass
Important Notes
- Preset SVN projects are hardcoded in
Main.java(lines 14-18) - Task persistence enables history recovery after restart
- AI input limits: Max 20 files, 2MB each,
.mdonly - Async tasks run in background, tracked via
TaskService - Web frontend is a single-page app with vanilla JS
When Modifying Code
- SVN logic →
SVNLogFetcher - CLI interaction →
Main - AI/Excel logic →
DeepSeekLogProcessor - Web API →
AppController+ services - Always update
docs/if behavior changes - Run
mvn clean compilebefore committing