system-prompts-and-models-o.../dealix/auto_client_acquisition/launch_ops/go_no_go.py
Dealix Builder 84f1ad9620 feat(launch+revenue): Private Beta Launch Ops + Revenue Launch — 14 modules + 29 endpoints + 56 tests + scripts/landing/docs
Launch Ops (5 modules) — برج إطلاق الـ Private Beta
- private_beta: 499 SAR × 7-day offer + safety notes + 6-question Arabic FAQ
- demo_flow: 12-minute minute-by-minute Arabic demo + 5 discovery Qs + 6 objection responses + close script
- outreach_messages: 4 segments × 5 prospects = 20 + per-segment Arabic messages + 3-step follow-ups + 6 reply handlers
- go_no_go: 10-gate readiness + 3 critical gates (no_secrets/live_sends_disabled/staging_health) + verdict + next-actions
- launch_scorecard: 11 event types + daily/weekly aggregation + targets (20 outreach/5 replies/3 demos/1 pilot daily)

Revenue Launch (7 modules) — تحويل Dealix إلى دخل
- offer_builder: 4 offers (Private Beta, 499 Pilot, Growth OS Pilot 1.5-3K, Free Case Study) + segment-aware recommend
- pipeline_tracker: 8-stage deterministic pipeline + add/update/summarize + revenue tracking + win rate
- outreach_sequence: re-export single source of truth from launch_ops with revenue-tier wrappers
- demo_closer: re-export from launch_ops
- pilot_delivery: 12-field intake form + 5-phase 24h delivery plan + per-service templates (First 10 / List Intel / Free Diagnostic)
- proof_pack_template: 5-line Arabic client summary + ROI estimate (pipeline_x + closed_won_x) + next-step recommendation (upsell/iterate/extend)
- payment_manual_flow: Moyasar invoice step-by-step (halalas-correct) + Arabic payment-link message + confirmation checklist; NEVER charges via API

Service Tower extensions (2 modules)
- contract_templates: re-export targeting_os contracts + new SLA outline (legal_review_required, PDPL-aware)
- vertical_service_map: 6 verticals (B2B SaaS / agencies / training-consulting / real estate / healthcare-local / retail-ecommerce) with primary+supporting services + buyer roles + common pains + winning offer

Routers (2 new) — 29 endpoints
- /api/v1/launch/* — 11 endpoints (private-beta/offer, demo/flow, outreach/{first-20, message, followup}, go-no-go, readiness, scorecard/{event, daily, weekly, demo})
- /api/v1/revenue-launch/* — 18 endpoints (offers + offers/recommend, outreach/{first-20, followup}, demo-flow, pipeline/{schema, summarize}, pilot-delivery/{intake-form, 24h-plan, first-10, list-intelligence, free-diagnostic}, payment/{invoice-instructions, link-message, confirmation-checklist}, proof-pack/{template, client-summary, next-step})

Tests (2 new files, 56 tests)
- test_launch_ops.py: 25 tests (Private Beta offer essentials + Arabic FAQ; demo flow 12-min structure; first-20 segments × 5; outreach Arabic + drafts only; followup steps differ; reply handlers include unsubscribe; go/no-go critical gates block; scorecard aggregation + verdict)
- test_revenue_launch.py: 31 tests (offers correct prices, no_live_charge=True; segment-aware recommends; pipeline 8 stages + add/update/summarize + win rate; outreach v2 Arabic; intake fields; 24h plan 5 phases; invoice halalas correct; payment confirmation blocks premature delivery; proof pack 5 lines + 3 next-step paths)

Scripts (1 new)
- scripts/launch_readiness_check.py: runs 10 gates locally + optional --staging-url; pretty/JSON output; critical gates determine GO/NO-GO/FIX-THEN-GO verdict

Landing pages (2 new, RTL Arabic)
- list-intelligence.html — List Intelligence service detail (499–1,500 SAR)
- growth-os.html — Growth OS Monthly subscription page (2,999 SAR/month)

Docs (1 new + 1 updated)
- REVENUE_TODAY_PLAYBOOK.md (Arabic) — 12-section playbook: offers, segments, messages, demo, pipeline, 24h delivery, Moyasar manual flow, proof pack, daily targets, go/no-go, what-not-to-do, next-step
- DEALIX_100_PERCENT_LAUNCH_PLAN.md — added §40 Launch Ops + §41 Revenue Launch + §42 Service Tower extensions + §43 Scripts

Test results
- 56/56 new tests pass
- Full suite: 824 passed, 2 skipped (missing API keys, unrelated)
- 0 existing tests broken

Safety integration
- All offers: live_send_allowed=False, no_live_charge=True, approval_required=True
- 10-gate go/no-go BLOCKS launch if no_secrets/live_sends_disabled/staging_health fail
- Moyasar: invoice/payment-link manual only; NEVER calls live charge API
- Payment confirmation checklist blocks delivery before invoice paid status
- All outreach messages: drafts only, follow-ups capped at 3, opt-out honored immediately
- 6 verticals mapped to safe service stacks; LinkedIn always Lead Forms (never scraping)

Integration with previous layers
- Launch Ops uses platform_services tool_gateway, intelligence_layer command_feed, security_curator redaction
- Revenue Launch uses targeting_os contractability + service_tower offers + intelligence_layer simulator
- Pipeline tracker integrates with action_ledger for stage transitions
- Proof Pack template references intelligence_layer proof metrics + service_excellence ROI

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 17:28:08 +03:00

131 lines
4.8 KiB
Python

"""Go/No-Go launch readiness — 10 deterministic gates."""
from __future__ import annotations
from typing import Any
# All 10 gates Dealix Launch Control Room checks before approving sale.
LAUNCH_GATES: tuple[dict[str, str], ...] = (
{"id": "tests_passed", "label_ar": "اختبارات pytest خضراء"},
{"id": "routes_check", "label_ar": "scripts/print_routes.py لا يكشف تكرار"},
{"id": "no_secrets", "label_ar": "scan الأسرار نظيف"},
{"id": "staging_health", "label_ar": "/health على staging يرجع 200"},
{"id": "supabase_staging", "label_ar": "Supabase staging مهيأ"},
{"id": "service_catalog", "label_ar": "/services/catalog يعمل ويعرض ≥4 خدمات"},
{"id": "private_beta_page", "label_ar": "landing/private-beta.html جاهزة"},
{"id": "first_20_ready", "label_ar": "أول 20 prospect معرّفون"},
{"id": "live_sends_disabled", "label_ar": "WHATSAPP/GMAIL/CALENDAR/MOYASAR live=false"},
{"id": "payment_manual_ready", "label_ar": "Moyasar invoice/payment link جاهز يدوياً"},
)
def build_launch_readiness(
*, statuses: dict[str, bool] | None = None,
) -> dict[str, Any]:
"""
Build the launch-readiness checklist with current statuses.
Pass `statuses` as a dict of gate_id → bool. Unknown gates default to False.
"""
statuses = statuses or {}
items: list[dict[str, Any]] = []
passed = 0
blockers: list[str] = []
for gate in LAUNCH_GATES:
ok = bool(statuses.get(gate["id"], False))
items.append({
**gate,
"passed": ok,
"status": "" if ok else "🔴",
})
if ok:
passed += 1
else:
blockers.append(gate["label_ar"])
total = len(LAUNCH_GATES)
pct = round(100.0 * passed / total, 1) if total else 0.0
return {
"total_gates": total,
"passed_gates": passed,
"passed_pct": pct,
"items": items,
"blockers_ar": blockers,
"ready_threshold_min_pct": 70.0,
}
def decide_go_no_go(
*, statuses: dict[str, bool] | None = None,
) -> dict[str, Any]:
"""
Decide whether Dealix can sell today.
Rules:
- All "critical" gates must pass: no_secrets, live_sends_disabled, staging_health.
- At least 7 of 10 gates must pass overall.
"""
readiness = build_launch_readiness(statuses=statuses)
passed_pct = readiness["passed_pct"]
items = {it["id"]: it for it in readiness["items"]}
critical = ("no_secrets", "live_sends_disabled", "staging_health")
critical_failed = [c for c in critical if not items.get(c, {}).get("passed")]
if critical_failed:
verdict = "no_go"
reason_ar = (
f"بوابات حرجة فشلت: {', '.join(critical_failed)}. "
"لا تبيع اليوم."
)
elif passed_pct >= 70:
verdict = "go"
reason_ar = (
f"الجاهزية {passed_pct}%. "
"ابدأ Private Beta — لا Public Launch."
)
else:
verdict = "fix_then_go"
reason_ar = (
f"الجاهزية {passed_pct}% — أقل من 70%. "
"ابدأ بإصلاح: " + ", ".join(readiness["blockers_ar"][:3])
)
return {
"verdict": verdict,
"reason_ar": reason_ar,
"readiness": readiness,
"next_actions_ar": _next_actions(readiness),
}
def _next_actions(readiness: dict[str, Any]) -> list[str]:
"""Build concrete next-actions for any failing gates."""
by_id = {it["id"]: it for it in readiness["items"]}
actions: list[str] = []
if not by_id["tests_passed"]["passed"]:
actions.append("شغّل: pytest -q")
if not by_id["routes_check"]["passed"]:
actions.append("شغّل: python scripts/print_routes.py")
if not by_id["no_secrets"]["passed"]:
actions.append("شغّل grep scan + ألغِ أي مفتاح ظهر.")
if not by_id["staging_health"]["passed"]:
actions.append("انشر على Railway: railway up + curl /health.")
if not by_id["supabase_staging"]["passed"]:
actions.append("شغّل: supabase db push --dry-run ثم db push.")
if not by_id["service_catalog"]["passed"]:
actions.append("افحص: curl /api/v1/services/catalog.")
if not by_id["private_beta_page"]["passed"]:
actions.append("افتح landing/private-beta.html وتحقق من CTA.")
if not by_id["first_20_ready"]["passed"]:
actions.append("جهز Sheet 'Dealix First 20 Pipeline' بالعمدة.")
if not by_id["live_sends_disabled"]["passed"]:
actions.append(
"تأكد: WHATSAPP_ALLOW_LIVE_SEND=false (وما يماثلها)."
)
if not by_id["payment_manual_ready"]["passed"]:
actions.append("افتح Moyasar dashboard وجهّز invoice template.")
return actions