Files
egg d7f7166a2d feat: unify environment scripts with start.sh
- Add unified start.sh script with subcommands (all/backend/frontend)
- Add process management (--stop, --status)
- Remove separate start_backend.sh and start_frontend.sh
- Update setup_dev_env.sh with pre-flight checks and --cpu-only/--skip-db options
- Update .env.example to remove sensitive data and add DIFY translation config
- Add .pid/ to .gitignore for process management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 12:48:52 +08:00

74 lines
2.2 KiB
Markdown

# Development Environment
This capability defines the development environment setup and service management for Tool_OCR.
## ADDED Requirements
### Requirement: Unified Service Startup
The system SHALL provide a single startup script that can launch all services or individual components.
#### Scenario: Start all services
- **WHEN** developer runs `./start.sh`
- **THEN** both backend and frontend services start
- **AND** service URLs are displayed
#### Scenario: Start only backend
- **WHEN** developer runs `./start.sh backend`
- **THEN** only the backend service starts on port 8000
#### Scenario: Start only frontend
- **WHEN** developer runs `./start.sh frontend`
- **THEN** only the frontend service starts on port 5173
### Requirement: Service Process Management
The system SHALL provide commands to check status and stop running services.
#### Scenario: Check service status
- **WHEN** developer runs `./start.sh --status`
- **THEN** the script displays which services are running with their PIDs
#### Scenario: Stop all services
- **WHEN** developer runs `./start.sh --stop`
- **THEN** all running services are gracefully terminated
### Requirement: Environment Setup Validation
The setup script SHALL validate that all required dependencies are correctly installed.
#### Scenario: Validate Python environment
- **WHEN** setup script runs
- **THEN** Python version is checked (3.10+)
- **AND** virtual environment is created or verified
- **AND** all pip packages are installed
#### Scenario: Validate Node.js environment
- **WHEN** setup script runs
- **THEN** Node.js LTS version is installed via nvm
- **AND** npm dependencies are installed
#### Scenario: Validate GPU support (optional)
- **WHEN** setup script runs on a system with NVIDIA GPU
- **THEN** CUDA version is detected
- **AND** appropriate PaddlePaddle GPU version is installed
- **AND** GPU availability is verified
### Requirement: Environment Configuration
The system SHALL use `.env.example` files to document all required environment variables.
#### Scenario: New developer setup
- **WHEN** developer clones the repository
- **THEN** `.env.example` files document all required variables
- **AND** developer copies to `.env.local` and fills in values