feat: Emergent automation pipeline for website generation#1
Open
alokit-bot wants to merge 17 commits into
Open
feat: Emergent automation pipeline for website generation#1alokit-bot wants to merge 17 commits into
alokit-bot wants to merge 17 commits into
Conversation
…eploy-gh-pages, pipeline) - emergent-client.mjs: Full API client with auth, token refresh, all endpoints - emergent-build.mjs: Build orchestrator with HITL detection and auto-response - deploy-gh-pages.sh: Clone → build → fix → deploy to GitHub Pages - pipeline.mjs: End-to-end orchestrator - prompt-template.md: Parameterized template for any business type Key fixes: - HITL response requires matching client_ref_id + id to original job - BrowserRouter needs basename for gh-pages sub-paths - Remove emergent-main.js from build (causes blank page without backend) - Add 'do not ask questions' instruction to prompt template Tested E2E with Envoq Salon - Jayanagar: - Emergent build: https://beauty-jaya-salon.preview.emergentagent.com/ - GitHub repo: https://github.com/alokit-bot/envoq-salon-website - GitHub Pages: https://alokit-bot.github.io/envoq-salon-website/
- getCreditsBalance() and getCreditsSummary() in emergent-client.mjs - emergent-build.mjs now reports starting/ending balance and credits used - Balance info saved in build-log.json under 'credits' field
- deploy-gh-pages.sh: GH_PAT now required from env/.env (no hardcoded default) - emergent-client.mjs: email, password, supabase key from env/.env via dotenv - .gitignore: added .env, .env.*, .emergent-token-cache.json - Installed dotenv dependency
- Deploy script now accepts optional details.json path (3rd arg) - Auto-extracts business name from built HTML if no details.json - Adds og:title, og:description, og:url, og:type tags - Adds twitter:card meta tags - Strips emergent-main.js, emergent-badge, and Emergent meta description - Fixes CRACO/Node 22 build (auto-installs ajv@8) - Pipeline passes details.json to deploy script automatically
Searches DuckDuckGo for business name + location, scores results against aggregator domains, and flags potential existing websites. Non-blocking — prints warning and continues. Tested: catches anandabhavan.com (score 7), no false positives on Style n Arts or Envoq Salon.
- extract-branding.mjs: 2-phase script
Phase 1: finds photos in asset dir, outputs vision prompt
Phase 2: takes vision model response, generates branding.json with:
- Logo description (text, font, colors, layout, icons)
- Brand color palette (hex codes)
- Brand vibe
- Ready-to-use promptSnippet for Emergent
- prompt-template.md: updated to inject BRANDING_SNIPPET when available,
falls back to manual COLOR_PALETTE/FONT_STYLE fields
Pipeline flow:
1. Agent captures storefront/entrance photos from Google Maps
2. extract-branding.mjs Phase 1 outputs vision request
3. Agent runs vision model on photos
4. extract-branding.mjs Phase 2 generates branding.json
5. Pipeline injects branding.promptSnippet into Emergent prompt
6. Emergent agent builds website matching real business branding
- PLAYBOOK.md: positioning, customer segments, 4 message variants (A-D), experiment design, follow-up cadence, qualifying questions, handoff rules - tracker.json: outreach tracking schema with conversion funnel - segment-rules.json: auto-segmentation rules + round-robin variant assignment Designed for A/B testing opening messages across 6 customer segments: restaurant-popular, restaurant-premium, salon-boutique, fitness-gym, healthcare, bar-lounge. Each segment has a default variant order. Statistical approach: min 5 per variant/segment, favor winner at 10+, lock at 20+.
…hics Replaced rigid 6-segment model (restaurant-popular, salon-boutique, etc.) with psychographic signal-based approach per Guillebeau's 'New Demographies'. Signals observed per business: digital_awareness, brand_pride, review_responsive, growth_phase, name_language, review_themes, etc. Key change: segments EMERGE from data after 20+ sends, not defined upfront. First 20 sends are pure exploration. Analysis looks for signal clusters that correlate with reply rates.
SOMRAS (Variant B) → 919663846153 Envoq Salon (Variant A) → 919955885574 Style n Arts (Variant D) → 917760711425 All sent 2026-04-05 14:30 UTC via WhatsApp business account
Indian Biere House (Variant B) → 919036125832 Live Fitness HSR (Variant C) → 919066172892 Coal Spark skipped — has existing website (smart.coalspark.com) Total: 5 businesses reached
Introduces Avi's IIT Kanpur / ex-Microsoft credentials as trust signal. 4 variants for A/B testing. Framed as vision, not flex. Sent from Alokit's number — Avi is positioned as founder behind initiative.
- enrich-business.sh: scrapes Zomato/JustDial + merges with details.json - enrich-from-gmaps.mjs: DDG-based enrichment (reviews, menu, pricing) - generate-rich-prompt.mjs: combines all data sources into rich Emergent prompt - scrape-gmaps.mjs: browser-based GMaps scraping (for agent use) Cron updated: Step 3 (Enrich) now mandatory before building. Timeout increased to 2h to allow for quality enrichment + builds.
Single command: node scripts/pipeline.mjs --name X --area Y --slug Z --phone P Steps: 1. ENRICH: web presence check → Zomato/JustDial scrape → merge details.json → generate rich prompt 2. BUILD: submit enriched prompt to Emergent → poll → get preview URL 3. DEPLOY: outputs exact commands for GitHub save + gh-pages deploy 4. OUTREACH: outputs WhatsApp message with variant selection Batch mode: --batch --count N reads lead_shortlist.md, skips already-contacted
- scrape-gmaps-cli.sh: uses openclaw browser CLI to extract real address, phone, hours, category, highlights from Google Maps - Pipeline step 1a.0: seeds details.json with known args (rating, reviews) - Pipeline step 1a.5: runs Google Maps scrape before Zomato enrichment - Result: prompts now have real addresses + real hours from Maps, plus ratings/reviews from our CSV, merged into one details.json Data flow: args (rating/reviews) → seed details.json → GMaps scrape (address/hours/phone) → enrich-business.sh (Zomato reviews) → merge → generate-rich-prompt.mjs → Emergent build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the full Emergent.sh automation pipeline for the Nextahalli website-building workflow.
What is this?
Given a business from our leads list, this automation:
Files Added
scripts/emergent-client.mjsscripts/emergent-build.mjsscripts/deploy-gh-pages.shscripts/pipeline.mjsscripts/prompt-template.mdscripts/respond-to-agent.mjsTested E2E
Envoq Salon - Jayanagar (lead #9, 4.9★, 1200 reviews)
Style n Arts - HSR Layout (lead #4, 4.9★, 1700 reviews) — in progress
Key Bugs Fixed
client_ref_id+idmust match original job (not a new UUID)emergent-main.jswhich breaks the frontend without a backend — stripped during deployBrowserRouterneedsbasenamefor gh-pages sub-pathsajv@8needed for newer Node versionsCredit Reporting
Every build now reports:
@avikalpg — ready for your review!