Files
moreminimore-vibe/scripts/update-and-debrand.sh
2025-12-22 10:14:05 +07:00

924 lines
38 KiB
Bash
Executable File

#!/bin/bash
# MoreMinimore Update and Debranding Script
# This script applies all custom features and removes Dyad branding/dependencies
# Usage: ./scripts/update-and-debrand.sh
set -e # Exit on any error
echo "🚀 Starting MoreMinimore update and debranding process..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
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 if we're in the right directory
if [ ! -f "package.json" ] || [ ! -d "src" ]; then
print_error "Please run this script from the project root directory"
exit 1
fi
# Create backup
print_status "Creating backup..."
BACKUP_DIR="dyad-backup-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BACKUP_DIR"
cp -r src "$BACKUP_DIR/"
cp package.json "$BACKUP_DIR/"
cp -r scripts "$BACKUP_DIR/" 2>/dev/null || true
print_success "Backup created: $BACKUP_DIR"
# Function to apply custom feature integration
apply_custom_features() {
print_status "Applying custom remove-limit feature..."
# Check if custom directory exists
if [ -d "src/custom" ]; then
# Apply remove-limit feature
if grep -q "REMOVE_LIMIT_ENABLED" src/custom/index.ts; then
print_success "Remove-limit feature already enabled"
else
echo "export const REMOVE_LIMIT_ENABLED = true;" >> src/custom/index.ts
print_success "Remove-limit feature enabled"
fi
else
mkdir -p src/custom
echo "export const REMOVE_LIMIT_ENABLED = true;" > src/custom/index.ts
print_success "Created custom directory and enabled remove-limit feature"
fi
}
# Function to remove Dyad API dependencies
remove_dyad_apis() {
print_status "Removing Dyad API dependencies..."
# Remove template API calls
if [ -f "src/ipc/utils/template_utils.ts" ]; then
sed -i.bak '/fetch("https:\/\/api\.dyad\.sh\/v1\/templates")/,/return \[\];/c\
// Dyad API templates removed - using local templates only\
return [...localTemplatesData];' src/ipc/utils/template_utils.ts
rm src/ipc/utils/template_utils.ts.bak
print_success "Removed Dyad template API"
fi
# Remove release note API calls
if [ -f "src/ipc/handlers/release_note_handlers.ts" ]; then
sed -i.bak '/const response = await fetch/,/return { exists: false };/c\
// Release notes disabled - removed Dyad API dependency\
logger.debug(`Release notes check disabled for version ${version}`);\
return { exists: false };' src/ipc/handlers/release_note_handlers.ts
rm src/ipc/handlers/release_note_handlers.ts.bak
print_success "Removed Dyad release notes API"
fi
# Remove auto-update API calls
if [ -f "src/main.ts" ]; then
sed -i.bak '/const host = `https:\/\/api\.dyad\.sh\/v1\/update/,/}); \/\/ additional configuration options available/c\
logger.info("Auto-update disabled - removed Dyad API dependency");\
// Auto-update functionality removed to eliminate Dyad API dependency\
// Users can manually update by downloading new releases from GitHub' src/main.ts
rm src/main.ts.bak
print_success "Removed Dyad auto-update API"
fi
}
# Function to remove Dyad Engine dependencies
remove_dyad_engine() {
print_status "Removing Dyad Engine dependencies..."
if [ -f "src/ipc/utils/get_model_client.ts" ]; then
sed -i.bak '/const dyadEngineUrl = process\.env\.DYAD_ENGINE_URL;/c\
// const dyadEngineUrl = process.env.DYAD_ENGINE_URL; // Removed - Dyad Engine dependency' src/ipc/utils/get_model_client.ts
sed -i.bak '/Handle Dyad Pro override/,/Fall through to regular provider logic if gateway prefix is missing/c\
// Dyad Pro functionality removed - eliminated Dyad Engine dependency\
// All models now use direct provider connections\
if (dyadApiKey && settings.enableDyadPro) {\
logger.warn(\
`Dyad Pro was enabled but has been disabled to remove Dyad API dependency. Falling back to direct provider connection.`,\
);\
// Fall through to regular provider logic\
}' src/ipc/utils/get_model_client.ts
sed -i.bak 's/import { createDyadEngine } from ".\/llm_engine_provider";/\/\/ import { createDyadEngine } from ".\/llm_engine_provider"; \/\/ Removed - Dyad Engine dependency/' src/ipc/utils/get_model_client.ts
rm src/ipc/utils/get_model_client.ts.bak
print_success "Removed Dyad Engine dependencies"
fi
}
# Function to remove pro features
remove_pro_features() {
print_status "Removing pro features..."
# Remove pro handlers from IPC host
if [ -f "src/ipc/ipc_host.ts" ]; then
sed -i.bak '/registerProHandlers();/d' src/ipc/ipc_host.ts
rm src/ipc/ipc_host.ts.bak
print_success "Removed pro handlers"
fi
# Remove pro imports from preload
if [ -f "src/preload.ts" ]; then
sed -i.bak '/"get-pro-status":/d' src/preload.ts
sed -i.bak '/"enable-dyad-pro":/d' src/preload.ts
rm src/preload.ts.bak
print_success "Removed pro IPC channels"
fi
# Remove ProModeSelector from ChatInputControls
if [ -f "src/components/ChatInputControls.tsx" ]; then
sed -i.bak '/import { ProModeSelector } from ".\/ProModeSelector";/d' src/components/ChatInputControls.tsx
sed -i.bak '/<ProModeSelector \/>/d' src/components/ChatInputControls.tsx
sed -i.bak '/<div className="w-1.5"><\/div>/d' src/components/ChatInputControls.tsx
rm src/components/ChatInputControls.tsx.bak
print_success "Removed ProModeSelector from chat controls"
fi
# Remove Pro restrictions from PreviewIframe (Annotator)
if [ -f "src/components/preview_panel/PreviewIframe.tsx" ]; then
# The file already uses Annotator directly, no Pro restrictions to remove
print_success "Annotator already available for all users"
fi
# Comment out ProBanner in home.tsx
if [ -f "src/pages/home.tsx" ]; then
sed -i.bak 's|// import { ProBanner } from "@/components/ProBanner";|// import { ProBanner } from "@/components/ProBanner";|g' src/pages/home.tsx
sed -i.bak 's|{<ProBanner />}|// {<ProBanner />}|g' src/pages/home.tsx
rm src/pages/home.tsx.bak
print_success "Commented out ProBanner"
fi
}
# Function to update branding
update_branding() {
print_status "Updating branding from Dyad to MoreMinimore..."
# Package.json already updated - keeping original @dyad-sh/supabase-management-js
print_success "Package.json configuration maintained"
# Update app name in main.ts
if [ -f "src/main.ts" ]; then
sed -i.bak 's/app\.setAsDefaultProtocolClient("dyad"/app.setAsDefaultProtocolClient("moreminimore"/g' src/main.ts
sed -i.bak 's/parsed\.protocol !== "dyad:"/parsed.protocol !== "moreminimore:"/g' src/main.ts
sed -i.bak 's/Expected dyad:\/\//Expected moreminimore:\/\//g' src/main.ts
rm src/main.ts.bak
print_success "Updated protocol handlers"
fi
}
# Function to convert smart context to standard feature
convert_smart_context() {
print_status "Converting smart context from pro to standard feature..."
# Update smart context store to remove pro restrictions
if [ -f "src/ipc/utils/smart_context_store.ts" ]; then
sed -i.bak '/settings\.enableDyadPro/c\
// Smart context now available for all users - removed pro restriction\
if (true {' src/ipc/utils/smart_context_store.ts
rm src/ipc/utils/smart_context_store.ts.bak
print_success "Converted smart context to standard feature"
fi
}
# Function to update UI text
update_ui_text() {
print_status "Updating UI text..."
# Update CodeBase Context button to Context Settings
find src/components -name "*.tsx" -type f -exec sed -i.bak 's/CodeBase Context/Context Settings/g' {} \;
find src/components -name "*.tsx" -type f -exec rm {}.bak \;
print_success "Updated UI text"
}
# Function to update forge configuration for Mission Control
update_forge_config() {
print_status "Updating forge configuration for Mission Control..."
if [ -f "forge.config.ts" ]; then
# Update protocol name and schemes
sed -i.bak 's/name: "Dyad"/name: "MoreMinimore"/g' forge.config.ts
sed -i.bak 's/schemes: \["dyad"\]/schemes: ["moreminimore"]/g' forge.config.ts
rm forge.config.ts.bak
print_success "Updated forge configuration for Mission Control"
else
print_warning "forge.config.ts not found"
fi
}
# Function to update component names from Dyad to MoreMinimore (Enhanced)
update_component_names() {
print_status "Updating component names from Dyad to MoreMinimore..."
# Update component imports and exports in chat components
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadThink/MoreMinimoreThink/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadTokenSavings/MoreMinimoreTokenSavings/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadCodebaseContext/MoreMinimoreCodebaseContext/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadMarkdownParser/MoreMinimoreMarkdownParser/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadEdit/MoreMinimoreEdit/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadWrite/MoreMinimoreWrite/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadRead/MoreMinimoreRead/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadRename/MoreMinimoreRename/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadDelete/MoreMinimoreDelete/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadSearchReplace/MoreMinimoreSearchReplace/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadCodeSearch/MoreMinimoreCodeSearch/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadCodeSearchResult/MoreMinimoreCodeSearchResult/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadWebSearch/MoreMinimoreWebSearch/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadWebSearchResult/MoreMinimoreWebSearchResult/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadWebCrawl/MoreMinimoreWebCrawl/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadExecuteSql/MoreMinimoreExecuteSql/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadOutput/MoreMinimoreOutput/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadAddDependency/MoreMinimoreAddDependency/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadAddIntegration/MoreMinimoreAddIntegration/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadMcpToolCall/MoreMinimoreMcpToolCall/g' {} \;
find src/components/chat -name "*.tsx" -type f -exec sed -i.bak 's/DyadMcpToolResult/MoreMinimoreMcpToolResult/g' {} \;
# Update markdown parser custom tags
find src -name "*.tsx" -type f -exec sed -i.bak 's/dyad-think/moreminimore-think/g' {} \;
find src -name "*.tsx" -type f -exec sed -i.bak 's/dyad-token-savings/moreminimore-token-savings/g' {} \;
# Update component references in file editors and preview panels
find src -name "*.tsx" -type f -exec sed -i.bak 's/MadeWithDyad/MadeWithMoreMinimore/g' {} \;
# Clean up backup files
find src -name "*.bak" -type f -delete
print_success "Updated component names"
}
# Function to fix capitalization consistency
fix_capitalization_consistency() {
print_status "Fixing capitalization consistency..."
# Ensure consistent "MoreMinimore" capitalization
find src -name "*.tsx" -type f -exec sed -i.bak 's/Moreminimore/MoreMinimore/g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's/Moreminimore/MoreMinimore/g' {} \;
# Fix inconsistent capitalization in UI text
find src -name "*.tsx" -type f -exec sed -i.bak 's/moreminimore/MoreMinimore/g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's/moreminimore/MoreMinimore/g' {} \;
# Clean up backup files
find src -name "*.bak" -type f -delete
print_success "Fixed capitalization consistency"
}
# Function to update GitHub repository references
update_github_references() {
print_status "Updating GitHub repository references..."
# Update GitHub URLs from dyad-sh/dyad to your repository
find src -name "*.tsx" -type f -exec sed -i.bak 's|github\.com/dyad-sh/dyad|github.com/kunthawat/moreminimore-vibe|g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's|github\.com/dyad-sh/dyad|github.com/kunthawat/moreminimore-vibe|g' {} \;
find . -name "*.md" -type f -exec sed -i.bak 's|github\.com/dyad-sh/dyad|github.com/kunthawat/moreminimore-vibe|g' {} \;
# Update issue reporting links
find src -name "*.tsx" -type f -exec sed -i.bak 's|https://github.com/dyad-sh/dyad/issues|https://github.com/kunthawat/moreminimore-vibe/issues|g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's|https://github.com/dyad-sh/dyad/issues|https://github.com/kunthawat/moreminimore-vibe/issues|g' {} \;
# Clean up backup files
find src -name "*.bak" -type f -delete
find . -name "*.md" -type f -exec rm -f {}.bak \;
print_success "Updated GitHub repository references"
}
# Function to remove made-with-dyad component from generated code
remove_made_with_dyad_component() {
print_status "Removing made-with-dyad component from generated code..."
# Remove the component file if it exists
if [ -f "src/components/made-with-dyad.tsx" ]; then
rm src/components/made-with-dyad.tsx
print_success "Removed made-with-dyad component file"
fi
# Remove imports and usage from scaffold templates
if [ -f "scaffold/src/pages/Index.tsx" ]; then
sed -i.bak '/import { MadeWithDyad } from "@\/components\/made-with-dyad";/d' scaffold/src/pages/Index.tsx
sed -i.bak '/<MadeWithDyad \/>/d' scaffold/src/pages/Index.tsx
rm scaffold/src/pages/Index.tsx.bak
fi
# Remove from test fixtures
find e2e-tests/fixtures -name "*.md" -type f -exec sed -i.bak '/import { MadeWithDyad } from "@\/components\/made-with-dyad";/d' {} \;
find e2e-tests/fixtures -name "*.md" -type f -exec sed -i.bak '/<MadeWithDyad \/>/d' {} \;
find e2e-tests/fixtures -name "*.md" -type f -exec rm -f {}.bak \;
# Remove from test snapshots
find e2e-tests/snapshots -name "*.txt" -type f -exec sed -i.bak '/import { MadeWithDyad } from "@\/components\/made-with-dyad";/d' {} \;
find e2e-tests/snapshots -name "*.txt" -type f -exec sed -i.bak '/<MadeWithDyad \/>/d' {} \;
find e2e-tests/snapshots -name "*.txt" -type f -exec sed -i.bak '/MadeWithDyad/d' {} \;
find e2e-tests/snapshots -name "*.txt" -type f -exec rm -f {}.bak \;
# Remove from aria.yml files
find e2e-tests/snapshots -name "*.aria.yml" -type f -exec sed -i.bak '/made-with-dyad/d' {} \;
find e2e-tests/snapshots -name "*.aria.yml" -type f -exec rm -f {}.bak \;
# Remove from fake LLM server
if [ -f "testing/fake-llm-server/chatCompletionHandler.ts" ]; then
sed -i.bak '/import { MadeWithDyad } from "@\/components\/made-with-dyad";/d' testing/fake-llm-server/chatCompletionHandler.ts
rm testing/fake-llm-server/chatCompletionHandler.ts.bak
fi
print_success "Removed made-with-dyad component from generated code"
}
# Function to update provider settings branding (preserves multi-provider functionality)
update_provider_settings_branding() {
print_status "Updating provider settings branding..."
if [ -f "src/components/settings/ProviderSettingsPage.tsx" ]; then
# Only update branding, preserve all multi-provider functionality
# Update Dyad references to Moreminimore
sed -i.bak 's/MoreMinimore/Moreminimore/g' src/components/settings/ProviderSettingsPage.tsx
# Update academy.dyad.sh URLs to moreminimore.com
sed -i.bak 's|academy\.dyad\.sh|moreminimore.com|g' src/components/settings/ProviderSettingsPage.tsx
# Update any remaining Dyad references
sed -i.bak 's/Dyad/Moreminimore/g' src/components/settings/ProviderSettingsPage.tsx
rm src/components/settings/ProviderSettingsPage.tsx.bak
print_success "Updated provider settings branding (multi-provider functionality preserved)"
else
print_warning "ProviderSettingsPage.tsx not found"
fi
}
# Function to update URLs and external links
update_urls() {
print_status "Updating URLs and external links..."
# Update Dyad URLs to MoreMinimore URLs
find src -name "*.tsx" -type f -exec sed -i.bak 's|https://dyad.sh|https://moreminimore.com|g' {} \;
find src -name "*.tsx" -type f -exec sed -i.bak 's|https://www.dyad.sh|https://www.moreminimore.com|g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's|https://dyad.sh|https://moreminimore.com|g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's|https://www.dyad.sh|https://www.moreminimore.com|g' {} \;
# Clean up backup files
find src -name "*.bak" -type f -delete
print_success "Updated URLs"
}
# Function to update branding text
update_branding_text() {
print_status "Updating branding text..."
# Update Dyad references to MoreMinimore
find src -name "*.tsx" -type f -exec sed -i.bak 's/Dyad Pro/MoreMinimore Pro/g' {} \;
find src -name "*.tsx" -type f -exec sed -i.bak 's/Dyad/MoreMinimore/g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's/Dyad Pro/MoreMinimore Pro/g' {} \;
find src -name "*.ts" -type f -exec sed -i.bak 's/Dyad/MoreMinimore/g' {} \;
# Clean up backup files
find src -name "*.bak" -type f -delete
print_success "Updated branding text"
}
# Function to update AI provider settings
update_ai_providers() {
print_status "Updating AI provider settings..."
# Update the auto provider in language model constants
if [ -f "src/ipc/shared/language_model_constants.ts" ]; then
sed -i.bak 's/displayName: "Dyad",/displayName: "MoreMinimore",/g' src/ipc/shared/language_model_constants.ts
sed -i.bak 's|websiteUrl: "https://academy.dyad.sh/settings"|websiteUrl: "https://moreminimore.com/settings"|g' src/ipc/shared/language_model_constants.ts
sed -i.bak 's/gatewayPrefix: "dyad\/",/gatewayPrefix: "moreminimore\/",/g' src/ipc/shared/language_model_constants.ts
sed -i.bak '/Use the same gateway prefix as Google Gemini for Dyad Pro compatibility./c\
// Use the same gateway prefix as Google Gemini for MoreMinimore Pro compatibility.' src/ipc/shared/language_model_constants.ts
rm src/ipc/shared/language_model_constants.ts.bak
print_success "Updated AI provider settings"
fi
# Add Moreminimore as a cloud provider
add_moreminimore_provider
}
# Function to add Moreminimore as a cloud provider
add_moreminimore_provider() {
print_status "Adding Moreminimore as a cloud provider..."
if [ -f "src/ipc/shared/language_model_constants.ts" ]; then
# Check if moreminimore provider already exists
if grep -q "moreminimore:" src/ipc/shared/language_model_constants.ts; then
print_success "Moreminimore provider already exists"
else
# Add moreminimore to CLOUD_PROVIDERS
sed -i.bak '/export const CLOUD_PROVIDERS: Record<string, CloudProvider> = {/a\
moreminimore: {\
displayName: "MoreMinimore AI",\
websiteUrl: "https://moreminimore.com/settings",\
hasFreeTier: false,\
gatewayPrefix: "moreminimore/",\
},' src/ipc/shared/language_model_constants.ts
# Add moreminimore model to MODEL_OPTIONS
sed -i.bak '/export const MODEL_OPTIONS: Record<string, LanguageModel\[\]> = {/a\
moreminimore: [\
{\
name: "zai-org/GLM-4.6",\
displayName: "GLM-4.6",\
description: "MoreMinimore AI model",\
contextWindow: 128000,\
maxOutputTokens: 4096,\
tag: "recommended",\
},\
],' src/ipc/shared/language_model_constants.ts
rm src/ipc/shared/language_model_constants.ts.bak
print_success "Added Moreminimore cloud provider"
fi
fi
}
# Function to update backend model client for Moreminimore
update_backend_model_client() {
print_status "Updating backend model client for Moreminimore..."
if [ -f "src/ipc/utils/get_model_client.ts" ]; then
# Check if moreminimore case already exists
if grep -q 'case "moreminimore":' src/ipc/utils/get_model_client.ts; then
print_success "Moreminimore case already exists in get_model_client.ts"
else
# Add moreminimore case before the default case
sed -i.bak '/default: {/i\
case "moreminimore": {\
if (!apiKey) {\
throw new Error(\
"Moreminimore API key is required. Please configure it in Settings.",\
);\
}\
const provider = createOpenAICompatible({\
name: "moreminimore",\
baseURL: "https://llmproxy.moreminimore.com/v1",\
apiKey,\
});\
return {\
modelClient: {\
model: provider(model.name),\
builtinProviderId: providerId,\
},\
backupModelClients: [],\
};\
}' src/ipc/utils/get_model_client.ts
rm src/ipc/utils/get_model_client.ts.bak
print_success "Added Moreminimore case to get_model_client.ts"
fi
fi
}
# Function to update provider settings UI for Moreminimore
update_provider_settings_ui() {
print_status "Updating provider settings UI for Moreminimore..."
if [ -f "src/components/settings/ProviderSettingsPage.tsx" ]; then
# Check if the simplified Moreminimore handling is already implemented
if grep -q "providerData && provider !== 'moreminimore'" src/components/settings/ProviderSettingsPage.tsx; then
print_success "Provider settings UI already updated for Moreminimore"
else
# Update ModelsSection condition to hide for Moreminimore
sed -i.bak 's/{supportsCustomModels && providerData && (/{
supportsCustomModels && providerData && provider !== "moreminimore" && (/' src/components/settings/ProviderSettingsPage.tsx
rm src/components/settings/ProviderSettingsPage.tsx.bak
print_success "Updated provider settings UI for Moreminimore"
fi
fi
if [ -f "src/components/settings/ProviderSettingsHeader.tsx" ]; then
# Check if button text is already updated
if grep -q "Setup Moreminimore AI" src/components/settings/ProviderSettingsHeader.tsx; then
print_success "Provider settings header already updated"
else
# Update button text for Moreminimore
sed -i.bak 's/Setup MoreMinimore Pro Subscription/Setup Moreminimore AI/g' src/components/settings/ProviderSettingsHeader.tsx
sed -i.bak 's/Manage MoreMinimore Pro Subscription/Manage Moreminimore AI/g' src/components/settings/ProviderSettingsHeader.tsx
rm src/components/settings/ProviderSettingsHeader.tsx.bak
print_success "Updated provider settings header for Moreminimore"
fi
fi
}
# Function to remove YouTube video section
remove_youtube_section() {
print_status "Removing YouTube video section..."
# Comment out OnboardingBanner import and usage in SetupBanner
if [ -f "src/components/SetupBanner.tsx" ]; then
sed -i.bak 's/import { OnboardingBanner } from ".\/home\/OnboardingBanner";/\/\/ import { OnboardingBanner } from ".\/home\/OnboardingBanner";/g' src/components/SetupBanner.tsx
sed -i.bak 's|<OnboardingBanner|{/* <OnboardingBanner|g' src/components/SetupBanner.tsx
sed -i.bak 's|setIsVisible={setIsOnboardingVisible} />|setIsVisible={setIsOnboardingVisible} /> */}|g' src/components/SetupBanner.tsx
sed -i.bak 's/Not sure what to do? Watch the Get Started video above ☝️/Not sure what to do? Follow the setup steps below to get started./g' src/components/SetupBanner.tsx
rm src/components/SetupBanner.tsx.bak
print_success "Removed YouTube video section"
fi
}
# Function to fix ChatInput.tsx references
fix_chat_input() {
print_status "Fixing ChatInput.tsx references..."
if [ -f "src/components/chat/ChatInput.tsx" ]; then
# Update the Pro URL
sed -i.bak 's|https://dyad.sh/pro|https://moreminimore.com/pro|g' src/components/chat/ChatInput.tsx
rm src/components/chat/ChatInput.tsx.bak
print_success "Fixed ChatInput.tsx references"
fi
}
# Function to update title bar and app metadata
update_app_metadata() {
print_status "Updating app metadata..."
# Update title bar
if [ -f "src/app/TitleBar.tsx" ]; then
sed -i.bak 's/Dyad/MoreMinimore/g' src/app/TitleBar.tsx
rm src/app/TitleBar.tsx.bak
print_success "Updated title bar"
fi
# Update package.json description (keep name as is for compatibility)
if [ -f "package.json" ]; then
sed -i.bak 's/"description": ".*"/"description": "MoreMinimore - AI-powered development environment"/g' package.json
rm package.json.bak
print_success "Updated package.json description"
fi
}
# Function to clean up imports
cleanup_imports() {
print_status "Cleaning up unused imports..."
# Remove unused imports from main.ts
if [ -f "src/main.ts" ]; then
sed -i.bak '/import.*update-electron-app.*from.*update-electron-app";/c\
// import { updateElectronApp, UpdateSourceType } from "update-electron-app"; // Removed - Dyad API dependency' src/main.ts
rm src/main.ts.bak
fi
# Remove unused imports from release_note_handlers.ts
if [ -f "src/ipc/handlers/release_note_handlers.ts" ]; then
sed -i.bak '/import fetch from "node-fetch";/d' src/ipc/handlers/release_note_handlers.ts
rm src/ipc/handlers/release_note_handlers.ts.bak
fi
print_success "Cleaned up unused imports"
}
# Function to check for required image processing tools
check_image_tools() {
print_status "Checking for image processing tools..."
local tools_available=true
if ! command -v convert &> /dev/null; then
print_warning "ImageMagick 'convert' command not found. Installing..."
if [[ "$OSTYPE" == "darwin"* ]]; then
if command -v brew &> /dev/null; then
brew install imagemagick
else
print_error "Homebrew not found. Please install ImageMagick manually: brew install imagemagick"
tools_available=false
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y imagemagick
elif command -v yum &> /dev/null; then
sudo yum install -y ImageMagick
else
print_error "Please install ImageMagick manually: apt-get install imagemagick or yum install ImageMagick"
tools_available=false
fi
else
print_error "Please install ImageMagick manually for your platform"
tools_available=false
fi
fi
if [ "$tools_available" = true ]; then
print_success "Image processing tools available"
else
print_error "Image processing tools not available. Logo conversion may fail."
fi
}
# Function to convert PNG to SVG
convert_png_to_svg() {
print_status "Converting PNG logo to SVG..."
local source_logo="assets/moreminimorelogo.png"
local target_svg="assets/logo.svg"
if [ ! -f "$source_logo" ]; then
print_error "Source logo not found: $source_logo"
return 1
fi
# Backup original SVG if it exists
if [ -f "$target_svg" ]; then
cp "$target_svg" "$target_svg.backup"
fi
# Create a simple SVG wrapper for the PNG
# This maintains compatibility while using the PNG as the source
cat > "$target_svg" << EOF
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 128 128" width="128" height="128">
<image href="data:image/png;base64,$(base64 -i "$source_logo" -o - | tr -d '\n')" width="128" height="128"/>
</svg>
EOF
print_success "Created SVG logo from PNG"
}
# Function to generate multi-size PNGs for Electron icons
generate_electron_icons() {
print_status "Generating Electron icons..."
local source_logo="assets/moreminimorelogo.png"
local icon_dir="assets/icon"
if [ ! -f "$source_logo" ]; then
print_error "Source logo not found: $source_logo"
return 1
fi
# Create icon directory if it doesn't exist
mkdir -p "$icon_dir"
# Backup existing icons
if [ -f "$icon_dir/logo.png" ]; then
cp "$icon_dir/logo.png" "$icon_dir/logo.png.backup"
fi
if [ -f "$icon_dir/logo.ico" ]; then
cp "$icon_dir/logo.ico" "$icon_dir/logo.ico.backup"
fi
if [ -f "$icon_dir/logo.icns" ]; then
cp "$icon_dir/logo.icns" "$icon_dir/logo.icns.backup"
fi
# Copy the main logo for general use
cp "$source_logo" "$icon_dir/logo.png"
# Generate different sizes for various purposes
local sizes=(16 32 48 64 128 256 512 1024)
for size in "${sizes[@]}"; do
if command -v convert &> /dev/null; then
convert "$source_logo" -resize "${size}x${size}" "$icon_dir/logo_${size}x${size}.png"
else
print_warning "ImageMagick not available, copying original for size ${size}"
cp "$source_logo" "$icon_dir/logo_${size}x${size}.png"
fi
done
# Create ICO file (Windows) - use the largest available size
if command -v convert &> /dev/null; then
convert "$icon_dir/logo_16x16.png" "$icon_dir/logo_32x32.png" "$icon_dir/logo_48x48.png" "$icon_dir/logo_256x256.png" "$icon_dir/logo.ico"
else
print_warning "Cannot create ICO file without ImageMagick"
fi
# Create ICNS file (macOS) - this is more complex, so we'll use a simple approach
if command -v iconutil &> /dev/null && [[ "$OSTYPE" == "darwin"* ]]; then
# Create iconset directory
local iconset="$icon_dir/logo.iconset"
mkdir -p "$iconset"
# Copy required sizes for macOS
cp "$icon_dir/logo_16x16.png" "$iconset/icon_16x16.png"
cp "$icon_dir/logo_32x32.png" "$iconset/icon_16x16@2x.png"
cp "$icon_dir/logo_32x32.png" "$iconset/icon_32x32.png"
cp "$icon_dir/logo_64x64.png" "$iconset/icon_32x32@2x.png"
cp "$icon_dir/logo_128x128.png" "$iconset/icon_128x128.png"
cp "$icon_dir/logo_256x256.png" "$iconset/icon_128x128@2x.png"
cp "$icon_dir/logo_256x256.png" "$iconset/icon_256x256.png"
cp "$icon_dir/logo_512x512.png" "$iconset/icon_256x256@2x.png"
cp "$icon_dir/logo_512x512.png" "$iconset/icon_512x512.png"
cp "$icon_dir/logo_1024x1024.png" "$iconset/icon_512x512@2x.png"
# Convert to ICNS
iconutil -c icns "$iconset" -o "$icon_dir/logo.icns"
# Clean up iconset
rm -rf "$iconset"
else
print_warning "Cannot create ICNS file without iconutil (macOS) or ImageMagick"
fi
print_success "Generated Electron icons"
}
# Function to create optimized logo for TitleBar
create_titlebar_logo() {
print_status "Creating optimized TitleBar logo..."
local source_logo="assets/moreminimorelogo.png"
local target_logo="assets/logo.png"
if [ ! -f "$source_logo" ]; then
print_error "Source logo not found: $source_logo"
return 1
fi
# Backup original if it exists
if [ -f "$target_logo" ]; then
cp "$target_logo" "$target_logo.backup"
fi
# Create a 24x24 version optimized for TitleBar
if command -v convert &> /dev/null; then
convert "$source_logo" -resize "24x24" "$target_logo"
else
# If ImageMagick is not available, just copy the original
cp "$source_logo" "$target_logo"
print_warning "ImageMagick not available, using original logo size"
fi
print_success "Created TitleBar logo"
}
# Function to update test fixtures
update_test_fixtures() {
print_status "Updating test fixtures..."
local source_logo="assets/moreminimorelogo.png"
local test_fixture="e2e-tests/fixtures/images/logo.png"
if [ -f "$source_logo" ]; then
# Create test fixtures directory if it doesn't exist
mkdir -p "$(dirname "$test_fixture")"
# Backup original test fixture
if [ -f "$test_fixture" ]; then
cp "$test_fixture" "$test_fixture.backup"
fi
# Copy the new logo to test fixtures
cp "$source_logo" "$test_fixture"
print_success "Updated test fixtures"
else
print_warning "Source logo not found, skipping test fixture update"
fi
}
# Function to update all logos
update_logos() {
print_status "Updating MoreMinimore logos..."
# Check if source logo exists
if [ ! -f "assets/moreminimorelogo.png" ]; then
print_error "Source logo not found: assets/moreminimorelogo.png"
print_error "Please ensure your MoreMinimore logo is available at assets/moreminimorelogo.png"
return 1
fi
# Check for image processing tools
check_image_tools
# Update all logo files
convert_png_to_svg
generate_electron_icons
create_titlebar_logo
update_test_fixtures
print_success "All logos updated to MoreMinimore branding"
}
# Function to install dependencies
install_dependencies() {
print_status "Installing dependencies..."
if command -v npm &> /dev/null; then
npm install
print_success "Dependencies installed with npm"
elif command -v yarn &> /dev/null; then
yarn install
print_success "Dependencies installed with yarn"
elif command -v pnpm &> /dev/null; then
pnpm install
print_success "Dependencies installed with pnpm"
else
print_warning "No package manager found. Please run npm install, yarn install, or pnpm install manually"
fi
}
# Function to test compilation
test_compilation() {
print_status "Testing compilation..."
if command -v npm &> /dev/null; then
if npm run ts 2>/dev/null; then
print_success "TypeScript compilation successful"
else
print_warning "TypeScript compilation failed. Check the errors above."
fi
fi
}
# Main execution
main() {
print_status "Starting debranding process..."
apply_custom_features
remove_dyad_apis
remove_dyad_engine
remove_pro_features
update_branding
convert_smart_context
update_ui_text
update_forge_config
update_component_names
fix_capitalization_consistency
update_github_references
remove_made_with_dyad_component
update_provider_settings_branding
update_urls
update_branding_text
update_ai_providers
update_backend_model_client
update_provider_settings_ui
remove_youtube_section
fix_chat_input
update_app_metadata
cleanup_imports
update_logos
install_dependencies
test_compilation
print_success "🎉 MoreMinimore update and debranding completed!"
echo ""
echo "Summary of changes:"
echo "✅ Applied custom remove-limit feature"
echo "✅ Removed Dyad API dependencies"
echo "✅ Removed Dyad Engine dependencies"
echo "✅ Removed pro features and Pro button"
echo "✅ Updated branding to MoreMinimore"
echo "✅ Converted smart context to standard feature"
echo "✅ Updated UI text"
echo "✅ Updated forge configuration for Mission Control"
echo "✅ Updated component names from Dyad to MoreMinimore"
echo "✅ Fixed capitalization consistency"
echo "✅ Updated GitHub repository references"
echo "✅ Removed made-with-dyad component from generated code"
echo "✅ Simplified AI provider settings"
echo "✅ Updated URLs and external links"
echo "✅ Updated branding text throughout app"
echo "✅ Updated AI provider settings"
echo "✅ Added Moreminimore as cloud provider"
echo "✅ Updated backend model client for Moreminimore"
echo "✅ Updated provider settings UI for Moreminimore"
echo "✅ Removed YouTube video section"
echo "✅ Fixed ChatInput.tsx references"
echo "✅ Updated app metadata and title bar"
echo "✅ Cleaned up unused imports"
echo "✅ Updated all logos to MoreMinimore branding"
echo "✅ Generated Electron icons (ICO, ICNS, multi-size PNGs)"
echo "✅ Installed dependencies"
echo ""
echo "Key features liberated:"
echo "🔓 Smart Context now available to all users"
echo "🔓 Annotator tool now available to all users"
echo "🔓 Removed Pro upgrade buttons and restrictions"
echo "🔓 Mission Control now displays correct app name"
echo "🔓 AI provider settings simplified for better UX"
echo "🔓 All Dyad branding removed from generated code"
echo ""
echo "Backup created at: $BACKUP_DIR"
echo ""
echo "Next steps:"
echo "1. Review the changes with 'git diff'"
echo "2. Test the application with 'npm start'"
echo "3. Check Mission Control displays 'MoreMinimore' correctly"
echo "4. Verify AI provider settings are simplified"
echo "5. Commit the changes if everything works correctly"
echo ""
print_warning "Please test the application thoroughly before committing changes."
}
# Run main function
main "$@"