mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 13:54:01 +00:00
- Add README.md as living documentation - Add tfcode.json schema and config template - Add FORK_MANAGEMENT.md with mirror-based fork strategy - Add scripts/rebrand.sh for reapplying branding after upstream merges - Add packages/tf-sync Python module using official ToothFairyAI SDK - Add packages/tf-mcp-bridge TypeScript module (stub) - Multi-region support (AU, EU, US) - Tool sync: MCP servers, Agent Skills, Database Scripts, API Functions
196 lines
5.2 KiB
Bash
Executable File
196 lines
5.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# tfcode Rebrand Script
|
|
# Reapplies all branding changes after upstream merge
|
|
# Run this after merging from opencode mirror
|
|
|
|
set -e
|
|
|
|
echo "🔧 Applying tfcode branding..."
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Track changes
|
|
CHANGES=0
|
|
|
|
# Function to count changes
|
|
count_changes() {
|
|
CHANGES=$((CHANGES + 1))
|
|
}
|
|
|
|
# Function to sed with both extensions (GNU and BSD)
|
|
safe_sed() {
|
|
local pattern="$1"
|
|
local file="$2"
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# macOS BSD sed
|
|
sed -i '' "$pattern" "$file" 2>/dev/null || true
|
|
else
|
|
# GNU sed
|
|
sed -i "$pattern" "$file" 2>/dev/null || true
|
|
fi
|
|
count_changes
|
|
}
|
|
|
|
echo ""
|
|
echo "📁 Processing TypeScript/JavaScript files..."
|
|
|
|
# TypeScript and JavaScript files
|
|
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.mjs" -o -name "*.cjs" \) \
|
|
-not -path "*/node_modules/*" \
|
|
-not -path "*/.git/*" \
|
|
-not -path "*/dist/*" \
|
|
-not -path "*/build/*" | while read file; do
|
|
|
|
# Command name: opencode -> tfcode
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
|
|
# Package name: opencode-ai -> tfcode
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
|
|
# Env vars: OPENCODE_ -> TFCODE_
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
|
|
# URLs: opencode.ai -> toothfairyai.com
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
|
|
# Config directory: .opencode -> .tfcode
|
|
safe_sed 's/\.opencode/.tfcode/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing JSON files..."
|
|
|
|
# JSON files
|
|
find . -type f -name "*.json" \
|
|
-not -path "*/node_modules/*" \
|
|
-not -path "*/.git/*" \
|
|
-not -path "*/dist/*" \
|
|
-not -path "*/build/*" \
|
|
-not -name "package-lock.json" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
safe_sed 's/\.opencode/.tfcode/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing Markdown files..."
|
|
|
|
# Markdown files
|
|
find . -type f -name "*.md" \
|
|
-not -path "*/node_modules/*" \
|
|
-not -path "*/.git/*" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
safe_sed 's/\.opencode/.tfcode/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing Shell scripts..."
|
|
|
|
# Shell scripts
|
|
find . -type f \( -name "*.sh" -o -name "*.bash" \) \
|
|
-not -path "*/.git/*" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing Python files..."
|
|
|
|
# Python files
|
|
find . -type f -name "*.py" \
|
|
-not -path "*/.git/*" \
|
|
-not -path "*/__pycache__/*" \
|
|
-not -path "*/.venv/*" \
|
|
-not -path "*/venv/*" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing YAML files..."
|
|
|
|
# YAML files
|
|
find . -type f \( -name "*.yml" -o -name "*.yaml" \) \
|
|
-not -path "*/node_modules/*" \
|
|
-not -path "*/.git/*" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "📁 Processing config files..."
|
|
|
|
# Config files (no extension or specific names)
|
|
find . -type f \( \
|
|
-name "Makefile" -o \
|
|
-name "Dockerfile*" -o \
|
|
-name ".env*" -o \
|
|
-name "LICENSE" -o \
|
|
-name "AUTHORS" -o \
|
|
-name "CONTRIBUTORS" \
|
|
\) -not -path "*/.git/*" | while read file; do
|
|
|
|
safe_sed 's/opencode/tfcode/g' "$file"
|
|
safe_sed 's/opencode-ai/tfcode/g' "$file"
|
|
safe_sed 's/OPENCODE_/TFCODE_/g' "$file"
|
|
safe_sed 's/opencode\.ai/toothfairyai.com/g' "$file"
|
|
done
|
|
|
|
echo ""
|
|
echo "🔄 Renaming config files..."
|
|
|
|
# Rename opencode.json to tfcode.json if it exists
|
|
if [ -f "opencode.json" ]; then
|
|
if [ ! -f "tfcode.json" ]; then
|
|
mv opencode.json tfcode.json
|
|
echo " ✓ Renamed opencode.json -> tfcode.json"
|
|
else
|
|
echo " ⚠ tfcode.json already exists, keeping both files"
|
|
fi
|
|
fi
|
|
|
|
# Rename .opencode directory to .tfcode if it exists
|
|
if [ -d ".opencode" ]; then
|
|
if [ ! -d ".tfcode" ]; then
|
|
mv .opencode .tfcode
|
|
echo " ✓ Renamed .opencode/ -> .tfcode/"
|
|
else
|
|
echo " ⚠ .tfcode/ already exists, merging directories"
|
|
cp -r .opencode/* .tfcode/ 2>/dev/null || true
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo "${GREEN}✅ Rebranding complete!${NC}"
|
|
echo ""
|
|
echo "Summary:"
|
|
echo " - Processed files and applied branding changes"
|
|
echo " - Renamed config files where applicable"
|
|
echo ""
|
|
echo "${YELLOW}Next steps:${NC}"
|
|
echo " 1. Review changes: git diff"
|
|
echo " 2. Run tests: npm test (or equivalent)"
|
|
echo " 3. Commit changes: git add . && git commit -m 'chore: reapply tfcode branding'"
|
|
echo "" |