Auto-sync from website-creator

This commit is contained in:
Kunthawat Greethong
2026-03-08 23:03:19 +07:00
commit 9be686f587
117 changed files with 24737 additions and 0 deletions

650
SINGLE_TESTING_GUIDE.md Normal file
View File

@@ -0,0 +1,650 @@
# 🧪 SEO Skills - Complete Testing Plan
**Purpose:** Single comprehensive testing guide for all SEO skills
**Created:** 2026-03-08
**Tester:** AI Agent (automated testing with user's .env credentials)
---
## 📋 TESTING OVERVIEW
| Phase | Features | Tests | Time | Status |
|-------|----------|-------|------|--------|
| **Phase 1:** Core Features | Content generation, Thai analysis, Context | 6 tests | 30 min | ⏳ Pending |
| **Phase 2:** Image Features | Image generation/editing | 3 tests | 20 min | ⏳ Pending |
| **Phase 3:** Umami Integration | Auto-setup, tracking | 3 tests | 20 min | ⏳ Pending |
| **Phase 4:** Analytics | Umami, GA4, GSC, DataForSEO | 4 tests | 30 min | ⏳ Pending |
| **Phase 5:** Auto-Publish | Direct write to website | 2 tests | 15 min | ⏳ Pending |
| **Phase 6:** Full Workflow | End-to-end test | 1 test | 30 min | ⏳ Pending |
**Total:** 19 tests, ~2.5 hours
---
## 🔧 PRE-TEST CHECKLIST
### **1. Verify .env File Exists**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill
ls -la .env
```
**Expected:** File exists (not .env.example)
---
### **2. Check Available Credentials**
Run this check script:
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill
python3 << 'EOF'
import os
from dotenv import load_dotenv
load_dotenv('.env')
print("\n🔑 Available Credentials:\n")
checks = {
'CHUTES_API_TOKEN': 'Image generation',
'UMAMI_URL': 'Umami Analytics',
'UMAMI_USERNAME': 'Umami username',
'UMAMI_PASSWORD': 'Umami password',
'GA4_PROPERTY_ID': 'Google Analytics',
'GSC_SITE_URL': 'Google Search Console',
'DATAFORSEO_LOGIN': 'DataForSEO',
'GIT_USERNAME': 'Git/Gitea',
'GIT_TOKEN': 'Git token'
}
available = []
missing = []
for key, desc in checks.items():
value = os.getenv(key, '')
if value and value != 'your-token-here':
available.append(f"✓ {key} ({desc})")
else:
missing.append(f"✗ {key} ({desc})")
print("AVAILABLE:")
for item in available:
print(f" {item}")
print("\nMISSING/EMPTY:")
for item in missing:
print(f" {item}")
print(f"\n📊 Summary: {len(available)} available, {len(missing)} missing")
EOF
```
**Expected Output:**
```
🔑 Available Credentials:
AVAILABLE:
✓ CHUTES_API_TOKEN (Image generation)
✓ UMAMI_URL (Umami Analytics)
✓ UMAMI_USERNAME (Umami username)
✓ UMAMI_PASSWORD (Umami password)
✓ GIT_USERNAME (Git/Gitea)
MISSING/EMPTY:
✗ GA4_PROPERTY_ID (Google Analytics)
✗ GSC_SITE_URL (Google Search Console)
✗ DATAFORSEO_LOGIN (DataForSEO)
📊 Summary: 5 available, 3 missing
```
---
### **3. Install Dependencies**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills
# Install all SEO skill dependencies
pip install pythainlp pyyaml python-dotenv pandas tqdm rich \
markdown python-frontmatter GitPython Pillow requests
# Verify installation
python3 -c "from pythainlp import word_tokenize; print('PyThaiNLP OK')"
python3 -c "import yaml; print('YAML OK')"
python3 -c "import requests; print('Requests OK')"
```
---
## 🧪 PHASE 1: Core Features (No Credentials Required)
### **Test 1.1: Facebook Content Generation**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-multi-channel/scripts
python3 generate_content.py \
--topic "บริการ podcast hosting" \
--channels facebook \
--language th
```
**Expected:**
- ✅ 5 Facebook variations generated
- ✅ Output saved to `output/บริการ-podcast-hosting/results.json`
- ✅ Thai language detected
**Verify:**
```bash
cat output/บริการ-podcast-hosting/results.json | python3 -m json.tool | head -50
```
---
### **Test 1.2: Multi-Channel Generation**
```bash
python3 generate_content.py \
--topic "บริการ podcast hosting" \
--channels facebook google_ads blog \
--language th
```
**Expected:**
- ✅ 3 channels generated
- ✅ 13 total variations (5+3+5)
- ✅ Blog has markdown with frontmatter
---
### **Test 1.3: Thai Keyword Analysis**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-analyzers/scripts
python3 thai_keyword_analyzer.py \
--text "บทความเกี่ยวกับบริการ podcast hosting ที่ดีที่สุด" \
--keyword "บริการ podcast" \
--language th
```
**Expected:**
- ✅ Thai word count accurate
- ✅ Density calculated
- ✅ Thai recommendations
---
### **Test 1.4: Thai Readability Analysis**
```bash
python3 thai_readability.py \
--text "มาเริ่ม podcast กันเลย! ไม่ต้องรอให้พร้อม 100%" \
--output text
```
**Expected:**
- ✅ Sentences counted
- ✅ Formality detected
- ✅ Grade level in Thai format
---
### **Test 1.5: Content Quality Scoring**
```bash
python3 content_quality_scorer.py \
--text "# คู่มือ Podcast\n\nบทความนี้เกี่ยวกับ..." \
--keyword "podcast" \
--output text
```
**Expected:**
- ✅ Score 0-100
- ✅ 4 category breakdowns
- ✅ Recommendations
---
### **Test 1.6: Context File Creation**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-context/scripts
python3 context_manager.py \
--create \
--project "/tmp/test-website" \
--industry "podcast"
```
**Expected:**
- ✅ 6 context files created
- ✅ Thai templates used
- ✅ Location: `/tmp/test-website/context/`
**Verify:**
```bash
ls -la /tmp/test-website/context/
```
---
## 🧪 PHASE 2: Image Features (Needs CHUTES_API_TOKEN)
### **Test 2.1: Image Generation**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-multi-channel/scripts
python3 image_integration.py \
--action generate \
--topic "test-image" \
--channel facebook \
--output-dir ./test-images
```
**Expected:**
- ✅ Image generated
- ✅ Saved to `test-images/test-image/facebook/`
---
### **Test 2.2: Find Product Images**
```bash
# Create test structure
mkdir -p /tmp/test-website/public/images/products
cp /path/to/any-image.jpg /tmp/test-website/public/images/products/test-product.jpg
python3 image_integration.py \
--action find \
--product-name "test-product" \
--website-repo "/tmp/test-website"
```
**Expected:**
- ✅ Found 1 image
- ✅ Full path returned
---
### **Test 2.3: Product Image Edit**
```bash
python3 image_integration.py \
--action edit \
--product-name "test-product" \
--website-repo "/tmp/test-website" \
--prompt "Enhance product" \
--topic "test-product" \
--channel facebook_ads
```
**Expected:**
- ✅ Image edited
- ✅ Saved to channel folder
---
## 🧪 PHASE 3: Umami Integration (Needs UMAMI_* credentials)
### **Test 3.1: Standalone Umami Website Creation**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/umami/scripts
python3 umami_client.py \
--action create-website \
--umami-url "$UMAMI_URL" \
--username "$UMAMI_USERNAME" \
--password "$UMAMI_PASSWORD" \
--website-name "Test Website" \
--website-domain "test.moreminimore.com"
```
**Expected:**
- ✅ Website created in Umami
- ✅ Website ID returned
- ✅ Tracking script generated
---
### **Test 3.2: Get Umami Tracking Code**
```bash
python3 umami_client.py \
--action get-tracking \
--umami-url "$UMAMI_URL" \
--username "$UMAMI_USERNAME" \
--password "$UMAMI_PASSWORD" \
--website-id "WEBSITE_ID_FROM_TEST_3.1"
```
**Expected:**
- ✅ Script tag returned
- ✅ Correct Umami URL
- ✅ Correct website ID
---
### **Test 3.3: Get Umami Analytics**
```bash
python3 umami_client.py \
--action get-stats \
--umami-url "$UMAMI_URL" \
--username "$UMAMI_USERNAME" \
--password "$UMAMI_PASSWORD" \
--website-id "WEBSITE_ID_FROM_TEST_3.1" \
--days 30
```
**Expected:**
- ✅ Pageviews returned
- ✅ Uniques returned
- ✅ Bounce rate calculated
---
## 🧪 PHASE 4: Analytics Integration
### **Test 4.1: Umami Connector (SEO Skills)**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-data/scripts
python3 umami_connector.py \
--umami-url "$UMAMI_URL" \
--username "$UMAMI_USERNAME" \
--password "$UMAMI_PASSWORD" \
--website-id "WEBSITE_ID" \
--days 30
```
**Expected:**
- ✅ Connection successful
- ✅ Stats returned
---
### **Test 4.2: Data Aggregator**
```bash
# Create test context
mkdir -p /tmp/test-context
cat > /tmp/test-context/data-services.json << 'EOF'
{
"umami": {
"enabled": true,
"api_url": "$UMAMI_URL",
"username": "$UMAMI_USERNAME",
"password": "$UMAMI_PASSWORD",
"website_id": "WEBSITE_ID"
}
}
EOF
python3 data_aggregator.py \
--context "/tmp/test-context" \
--action performance \
--url "https://test.com/page"
```
**Expected:**
- ✅ Umami initialized
- ✅ Data fetched
---
### **Test 4.3: GA4 Connector (If Available)**
```bash
python3 ga4_connector.py \
--property-id "$GA4_PROPERTY_ID" \
--credentials "$GA4_CREDENTIALS_PATH" \
--url "/test-page" \
--days 30
```
**Expected:** (if credentials available)
- ✅ Connected to GA4
- ✅ Stats returned
---
### **Test 4.4: GSC Connector (If Available)**
```bash
python3 gsc_connector.py \
--site-url "$GSC_SITE_URL" \
--credentials "$GSC_CREDENTIALS_PATH" \
--quick-wins
```
**Expected:** (if credentials available)
- ✅ Connected to GSC
- ✅ Quick wins returned
---
## 🧪 PHASE 5: Auto-Publish (Direct Write)
### **Test 5.1: Publish Thai Blog Post**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/seo-multi-channel/scripts
# Create test blog
cat > /tmp/test-blog-th.md << 'EOF'
---
title: "คู่มือ Podcast Hosting 2026"
description: "เปรียบเทียบบริการ podcast hosting"
keywords: ["podcast hosting", "บริการ podcast"]
slug: podcast-hosting-2026
lang: th
category: guides
created: 2026-03-08
---
# คู่มือ Podcast Hosting 2026
บทความนี้จะเปรียบเทียบ...
EOF
# Create test website
mkdir -p /tmp/my-website/src/content/blog/\(th\)
mkdir -p /tmp/my-website/public/images/blog
# Publish (direct write, no git)
python3 auto_publish.py \
--file /tmp/test-blog-th.md \
--website-repo /tmp/my-website
```
**Expected:**
- ✅ Saved to `src/content/blog/(th)/podcast-hosting-2026.md`
- ✅ Direct write (no git)
- ✅ Language detected as Thai
---
### **Test 5.2: Publish English Blog Post**
```bash
cat > /tmp/test-blog-en.md << 'EOF'
---
title: "Best Podcast Hosting 2026"
description: "Compare podcast hosting services"
slug: best-podcast-hosting-2026
lang: en
---
# Best Podcast Hosting 2026
This article compares...
EOF
python3 auto_publish.py \
--file /tmp/test-blog-en.md \
--website-repo /tmp/my-website
```
**Expected:**
- ✅ Saved to `src/content/blog/(en)/best-podcast-hosting-2026.md`
- ✅ Language detected as English
---
## 🧪 PHASE 6: Full End-to-End Workflow
### **Test 6.1: Complete Website Creation with Umami**
```bash
cd /Users/kunthawatgreethong/Gitea/opencode-skill/skills/website-creator/scripts
python3 create_astro_website.py \
--name "Test Podcast Site" \
--type "blog" \
--languages "th,en" \
--output "/tmp/test-podcast-website"
```
**Expected:**
- ✅ Website structure created
- ✅ Umami website auto-created (if credentials available)
- ✅ Tracking added to Astro layout
- ✅ Umami ID saved to website .env
- ✅ Git repo initialized
**Verify:**
```bash
# Check website structure
ls -la /tmp/test-podcast-website/
# Check Umami in layout
grep -n "script.js" /tmp/test-podcast-website/src/layouts/BaseHead.astro
# Check .env has Umami ID
grep "UMAMI_WEBSITE_ID" /tmp/test-podcast-website/.env
# Check Umami dashboard (manual)
# Login to Umami and verify website was created
```
---
## 📊 TEST RESULTS TRACKING
Create this file after testing:
```bash
cat > /Users/kunthawatgreethong/Gitea/opencode-skill/TEST_RESULTS_$(date +%Y%m%d).md << 'EOF'
# Test Results - $(date +%Y-%m-%d)
**Tester:** AI Agent
**Environment:** macOS, Python 3.x
## Phase 1: Core Features
- [ ] Test 1.1: Facebook generation
- [ ] Test 1.2: Multi-channel
- [ ] Test 1.3: Keyword analysis
- [ ] Test 1.4: Readability
- [ ] Test 1.5: Quality score
- [ ] Test 1.6: Context creation
## Phase 2: Image Features
- [ ] Test 2.1: Image generation
- [ ] Test 2.2: Find products
- [ ] Test 2.3: Image edit
## Phase 3: Umami
- [ ] Test 3.1: Create website
- [ ] Test 3.2: Get tracking
- [ ] Test 3.3: Get stats
## Phase 4: Analytics
- [ ] Test 4.1: Umami connector
- [ ] Test 4.2: Data aggregator
- [ ] Test 4.3: GA4 (if available)
- [ ] Test 4.4: GSC (if available)
## Phase 5: Auto-Publish
- [ ] Test 5.1: Thai blog
- [ ] Test 5.2: English blog
## Phase 6: Full Workflow
- [ ] Test 6.1: Complete website
## Bugs Found:
1. [Description]
2. [Description]
## Overall Status: PASS/FAIL/NEEDS_FIXES
EOF
```
---
## 🚀 AUTOMATED TESTING SCRIPT
I'll run this script to test everything automatically:
```bash
#!/bin/bash
# test_all_seo_skills.sh
set -e
echo "🧪 Starting SEO Skills Testing..."
echo "Date: $(date)"
echo ""
# Check .env
echo "📋 Step 1: Checking .env..."
if [ ! -f ".env" ]; then
echo "✗ .env not found!"
exit 1
fi
echo "✓ .env found"
# Run Phase 1 tests
echo ""
echo "📝 Phase 1: Core Features"
echo "========================"
cd seo-multi-channel/scripts
python3 generate_content.py --topic "test" --channels facebook --language th
echo "✓ Test 1.1: Facebook generation"
# Run Phase 3 tests (if Umami configured)
if [ -n "$UMAMI_URL" ] && [ -n "$UMAMI_USERNAME" ] && [ -n "$UMAMI_PASSWORD" ]; then
echo ""
echo "📈 Phase 3: Umami Integration"
echo "=============================="
cd ../../umami/scripts
python3 umami_client.py --action create-website \
--umami-url "$UMAMI_URL" \
--username "$UMAMI_USERNAME" \
--password "$UMAMI_PASSWORD" \
--website-name "Auto Test" \
--website-domain "test.moreminimore.com"
echo "✓ Test 3.1: Umami website created"
else
echo ""
echo "⏭️ Skipping Phase 3 (Umami credentials not configured)"
fi
echo ""
echo "✅ Testing Complete!"
```
---
## ✅ READY TO TEST
All tests are documented. I'll now proceed with automated testing using your .env credentials.
**Next:** I'll run the tests automatically and report results.