Files
moreminimore-vibe/README-SCRIPT-INTEGRATION.md
2025-12-22 10:14:05 +07:00

282 lines
7.5 KiB
Markdown

# MoreMinimore Script Integration Guide
This guide explains how to use the updated scripts to integrate your Moreminimore provider customizations when updating from the upstream Dyad repository.
## Overview
The script system has been updated to include all the latest Moreminimore provider changes, making it easy to re-apply your customizations after updating from upstream.
## Scripts Overview
### 1. `scripts/update-and-debrand.sh` - Main Integration Script
**Purpose**: Applies all Moreminimore customizations and removes Dyad branding.
**New Features Added**:
- ✅ Adds Moreminimore as a cloud provider in `language_model_constants.ts`
- ✅ Adds Moreminimore case to `get_model_client.ts` backend
- ✅ Updates provider settings UI to hide model selection for Moreminimore
- ✅ Updates button text to "Setup Moreminimore AI"
- ✅ All existing debranding and custom features
**Usage**:
```bash
# Apply all customizations
./scripts/update-and-debrand.sh
# Or run specific functions
source scripts/update-and-debrand.sh
add_moreminimore_provider
update_backend_model_client
update_provider_settings_ui
```
### 2. `scripts/integrate-custom-features.sh` - Custom Feature Integration
**Purpose**: Integrates custom features with upstream updates, includes Moreminimore provider support.
**New Features Added**:
- ✅ Moreminimore provider files in the file list
-`integrate_moreminimore_provider()` function
- ✅ Validation for Moreminimore configuration
**Usage**:
```bash
# Integrate all custom features
./scripts/integrate-custom-features.sh
# Validate current integration
./scripts/integrate-custom-features.sh validate
# Restore from backup
./scripts/integrate-custom-features.sh restore backup-20231201-120000
```
### 3. `scripts/build-moreminimore-app.sh` - Build Script with Validation
**Purpose**: Builds the MoreMinimore application with proper validation.
**New Features Added**:
-`validate_moreminimore_provider()` function
- ✅ Automatic Moreminimore provider validation during build
- ✅ Auto-fix missing Moreminimore configurations
**Usage**:
```bash
# Development build
./scripts/build-moreminimore-app.sh
# Production build (requires code signing)
./scripts/build-moreminimore-app.sh --production
# Clean build artifacts only
./scripts/build-moreminimore-app.sh --clean-only
# Verbose output
./scripts/build-moreminimore-app.sh --verbose
```
## What the Scripts Do
### Moreminimore Provider Integration
1. **Backend Provider Configuration**:
- Adds "moreminimore" to `CLOUD_PROVIDERS` in `language_model_constants.ts`
- Adds GLM-4.6 model configuration
- Sets up proper website URL and gateway prefix
2. **Backend Model Client**:
- Adds "moreminimore" case to `get_model_client.ts`
- Configures OpenAI-compatible client with fixed base URL
- Proper API key validation
3. **Frontend UI Updates**:
- Hides model selection UI for Moreminimore (fixed model)
- Updates button text to "Setup Moreminimore AI"
- Simplified provider configuration experience
### Existing Features Maintained
- ✅ Remove-limit feature integration
- ✅ Dyad branding removal
- ✅ Logo updates and icon generation
- ✅ Smart context liberation
- ✅ Pro feature removal
- ✅ YouTube section removal
- ✅ All existing customizations
## Update Workflow
When updating from upstream Dyad:
### Option 1: Full Integration (Recommended)
```bash
# 1. Update from upstream
git fetch upstream
git merge upstream/main
# 2. Apply all customizations
./scripts/update-and-debrand.sh
# 3. Build and test
./scripts/build-moreminimore-app.sh
```
### Option 2: Custom Feature Integration
```bash
# 1. Update from upstream
git fetch upstream
git merge upstream/main
# 2. Integrate custom features only
./scripts/integrate-custom-features.sh
# 3. Build and test
./scripts/build-moreminimore-app.sh
```
### Option 3: Manual Control
```bash
# 1. Update from upstream
git fetch upstream
git merge upstream/main
# 2. Run specific functions
source scripts/update-and-debrand.sh
add_moreminimore_provider
update_backend_model_client
update_provider_settings_ui
# 3. Build and test
./scripts/build-moreminimore-app.sh
```
## Validation and Testing
### Automatic Validation
The build script automatically validates:
- ✅ Moreminimore provider exists in `language_model_constants.ts`
- ✅ Moreminimore case exists in `get_model_client.ts`
- ✅ Provider settings UI is updated
- ✅ TypeScript compilation succeeds
### Manual Validation
```bash
# Validate custom features integration
./scripts/integrate-custom-features.sh validate
# Check TypeScript compilation
npm run ts
# Test the application
npm start
```
## File Changes Made
### Backend Files
1. **`src/ipc/shared/language_model_constants.ts`**:
- Added `moreminimore:` to `CLOUD_PROVIDERS`
- Added `moreminimore:` to `MODEL_OPTIONS`
2. **`src/ipc/utils/get_model_client.ts`**:
- Added `case "moreminimore":` in switch statement
- Configured OpenAI-compatible client
### Frontend Files
3. **`src/components/settings/ProviderSettingsPage.tsx`**:
- Updated ModelsSection condition to hide for Moreminimore
- Simplified provider handling
4. **`src/components/settings/ProviderSettingsHeader.tsx`**:
- Updated button text to "Setup Moreminimore AI"
## Troubleshooting
### Common Issues
1. **"Unsupported model provider: moreminimore"**:
```bash
# Re-run the backend model client update
source scripts/update-and-debrand.sh
update_backend_model_client
```
2. **Missing Moreminimore in provider list**:
```bash
# Re-add the provider
source scripts/update-and-debrand.sh
add_moreminimore_provider
```
3. **Model selection UI showing for Moreminimore**:
```bash
# Update the UI
source scripts/update-and-debrand.sh
update_provider_settings_ui
```
4. **Build failures**:
```bash
# Clean build with validation
./scripts/build-moreminimore-app.sh --clean-only
./scripts/build-moreminimore-app.sh --verbose
```
### Backup and Recovery
All scripts create automatic backups:
```bash
# Backups are stored in:
dyad-backup-YYYYMMDD-HHMMSS/
# Restore from backup (integrate-custom-features.sh)
./scripts/integrate-custom-features.sh restore backup-20231201-120000
```
## Testing the Integration
After running the scripts:
1. **Start the application**:
```bash
npm start
```
2. **Verify Moreminimore provider**:
- Go to Settings → AI Providers
- Select "MoreMinimore AI"
- Should show simplified configuration (no model selection)
- Button should say "Setup Moreminimore AI"
3. **Test API connection**:
- Configure your Moreminimore API key
- Click "Setup Moreminimore AI"
- Try sending a chat message
- Should work without "Unsupported model provider" error
## Script Maintenance
The scripts are designed to be:
- ✅ **Idempotent**: Safe to run multiple times
- ✅ **Validating**: Check for existing changes
- ✅ **Backup-safe**: Create backups before modifying
- ✅ **Error-handling**: Clear error messages and recovery options
## Future Updates
When new features are added to Moreminimore:
1. Update the relevant functions in `update-and-debrand.sh`
2. Add validation in `build-moreminimore-app.sh`
3. Update this documentation
## Support
For issues with the scripts:
1. Check the troubleshooting section above
2. Review the script output for specific error messages
3. Verify file permissions and directory structure
4. Test with verbose output: `--verbose` flag
The scripts are designed to handle most edge cases automatically and provide clear feedback when manual intervention is needed.