#!/usr/bin/env python3 """Vibe coding step: take the gumson-converted HTML (static) and add behaviour. - plan selector with live price (first-month 30% coupon), delivery days, bean choice - subscription form (validation, localStorage persistence, success state) - FAQ answers (converted page had empty answer panels) usage: vibe.py result-104.html out/app/index.html""" import re, sys src, dst = sys.argv[1], sys.argv[2] h = open(src, encoding='utf-8').read() # 1) plan cards: data attributes + real buttons plans = [('light', '라이트', 3, 19900), ('standard', '스탠다드', 5, 29900), ('family', '패밀리', 10, 49900)] for key, name, qty, price in plans: pat = r'(
라이트
', '라이트
') h = h.replace('패밀리
', '패밀리
') btns = re.findall(r'선택하기', h) assert len(btns) == 3, btns for key, name, qty, price in plans: h = h.replace('선택하기', '' % (key, name, qty, price), 1) # 2) hero / nav CTA h = h.replace('첫 달 30% 할인 받기', '첫 달 30% 할인 받기') # 3) FAQ answers faq = { 'faq-p1': '주문 다음 날 새벽 로스팅·당일 추출 후 발송해 주문일 기준 1~2일 안에 문 앞으로 갑니다. 구독은 선택한 배송 요일 새벽에 정기 배송됩니다.
', 'faq-p2': '약정이 없습니다. 마이페이지 → 구독 관리에서 언제든 즉시 해지할 수 있고, 다음 배송 예정일 전날 정오까지 해지하면 그 회차부터 배송·결제가 멈춥니다.
', 'faq-p3': '네. 다크 · 미디엄 · 디카페인 3종 중 회차마다 바꿀 수 있습니다. 아래 구독 신청에서 기본 원두를 고르고, 이후에는 배송 전날까지 마이페이지에서 변경하세요.
', } for pid, ans in faq.items(): h = h.replace('' % (pid, pid.replace('p', 'q')), '