بنقرة واحدة
cf-b2b-website
Cloudflare Workers + D1 e-commerce site for Shengtuo Tractor. Deploy, DB ops, SEO, product sync.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Cloudflare Workers + D1 e-commerce site for Shengtuo Tractor. Deploy, DB ops, SEO, product sync.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Migrate Hermes Agent to a new server while keeping both instances running in parallel. Covers backup, SSH troubleshooting, skill/memory sync, and GitHub remote setup.
Backup, restore, and migrate Hermes Agent data across machines. Covers the local backup scripts, cron scheduling, retention policies, git remote management, shallow-clone migration, and cross-machine parallel deployment.
Modify PDF appearance without changing content/structure: change font colors, remove highlights, adjust styling. Preserves all text, layout, fonts, and embedded resources.
Deploy and manage Cloudflare Workers with D1, R2, KV, and Workers KV store
Install and select animated petdex mascots for Hermes.
Parallel 3-agent cleanup of recent code changes.
| name | cf-b2b-website |
| description | Cloudflare Workers + D1 e-commerce site for Shengtuo Tractor. Deploy, DB ops, SEO, product sync. |
| triggers | ["cf-b2b-website","shengtuo tractor website","wrangler deploy","D1 database","sitemap.xml"] |
| Item | Value |
|---|---|
| Worker | cf-b2b-website |
| D1 DB | b2b_database (remote) |
| KV | b2b_kv (contact form) |
| Deploy token | cfut_ZENfTsTx1akFdl... |
| URL | https://cf-b2b-website.sdtractor.workers.dev |
| Src | /home/ubuntu/cf_b2b/ |
cd /home/ubuntu/cf_b2b && CLOUDFLARE_API_TOKEN="cfut_..." npx wrangler deploy
npx wrangler deploy --force
⚠️ Pitfall:
wrangler deploycan exit 0 with NO visible output even on syntax errors. Always check output containsUploadedandDeployedlines. If output is empty, check for JS syntax errors (e.g., duplicateconstdeclarations) before retrying.
npx wrangler d1 execute b2b_database --file=/tmp/sql.sql --remote
⚠️ Pitfall: D1 does NOT support
BEGIN;...COMMIT;in file mode. Execute statements individually — eachUPDATE/SETon its own line. No transactions.
npx wrangler d1 execute b2b_database --command="SELECT id, name FROM products LIMIT 5;" --remote
Site is Error 1016 (partially down) but browser still loads content — product images remain valid at shengtuo-tractor.com/uploadfile/ URLs.
[...document.querySelectorAll('ul.products_list li')].map(li => {
const a = li.querySelector('a[href$=".html"]');
const img = li.querySelector('img');
return a ? { name: a.title, href: a.href, img: img ? img.src : null } : null;
}).filter(Boolean)
Extract ST\d+[A-Z]* pattern from name to map site products → DB products by ID.
UPDATE products SET image_url = 'https://www.shengtuo-tractor.com/uploadfile/FILE.jpg' WHERE id = N;
-- One statement per line, no BEGIN/COMMIT
⚠️ NEVER use
sedon.jsfiles — corrupts template literal backtick nesting (\`` → raw ````). ⚠️ NEVER useecho heredocto write.jsfiles — same backtick corruption risk.
Always use patch() or write_file() only.
Common error this causes: inline <script> tags inside template literals get mangled, producing "has already been declared" or "unexpected token" build errors.
Organized in src/pages/layout.js:
createLayout uses isHome = (title === 'Home') to set special SEO title. When passing site_name (e.g. 'China Shengtuo Farm Tractor Manufacturer') instead of 'Home', pageTitlePrefix won't trigger and canonical breaks.
Always do this for homepage:
const homeTitle = 'China Shengtuo Farm Tractor Manufacturer | 25HP-260HP Agricultural Tractors & Farm Equipment';
const html = createLayout('Home', content, scripts, desc, false);
const finalHtml = html.replace('<title>Shengtuo Tractor</title>', `<title>${homeTitle}</title>`);
return new Response(finalHtml, { ... });
const isHome = title === 'Home';
const canonicalPath = isHome ? '/' : '/' + title.toLowerCase().replace(/\s+/g,'-').replace(/[^a-z0-9-/]/g,'');
Both generated by src/pages/sitemap.js:
/sitemap.xml — 42 product URLs + 4 static pages/robots.txt — allows all except /api/ and /admin/Products should show Tractors first, then Equipment. Both of these need the same SQL ORDER BY CASE pattern:
src/pages/products.js — server-rendered pagesrc/api/handlers/products.js — API endpointSQL pattern:
ORDER BY CASE WHEN category = 'SHENGTUO TRACTOR' THEN 1
WHEN category = 'SHENGTUO FARM EQUIPMENT' THEN 2
ELSE 3 END, name
⚠️ Pitfall: Even if products.js is fixed, if the API returns wrong order, pages that rely on API data will show wrong order. Fix BOTH files.
Build from DB fields dynamically:
const hp = product.hp_range || '';
const spec = product.key_spec || '';
metaKeywords = `${product.name}, Shengtuo ${category}, farm equipment, ${hp} tractor, agricultural machinery China, ${spec}`;
router.js).js files