최초 커밋 — 기존 코드 전체 + 문서 체계 신설

git 저장소가 없어 히스토리·협업 기반이 아예 없던 상태를 연다.
함께 문서를 재편했다. 그동안 문서가 있어도 "이 제품이 뭘 푸는가"와
"어떻게 도는가"를 담은 문서가 없어서, 목표 문장이 backend/frontend
README 두 곳에 복붙돼 있었다 — 상위 문서가 없어 아래로 샌 것이다.

신설
  README.md               레포 진입점 + 문서 지도 + 문서 규칙 4가지
  AGENTS.md               에이전트·신규 합류자용 함정 목록과 규약
                          (CLAUDE.md 는 여기로 걸린 심볼릭 링크)
  docs/PRODUCT.md         제품 정의 — 문제·사용자·원칙·**non-goals**·성공 기준
  docs/ARCHITECTURE.md    payload 경계·발행 파이프라인·서빙 결정·앱 분리 설계

이동
  backend/docs/DECISIONS.md → docs/DECISIONS.md
    백엔드만의 결정이 아니다. 게다가 코드 주석 ~25곳이 이미
    `docs/DECISIONS.md` 로 적고 있어 레포 루트 기준으로는 그게 맞다.

갱신
  docs/DEPLOY.md          서빙 결정 반영 — nginx 정적 서빙이 지금 경로(3절),
                          Azure 는 나중에 켤 때(4절)로 분리
  docs/ARCHITECTURE.md    사이트 = 한 장(2026-08-31) 구조 반영
  docs/COLLECTION_SEO_AEO_FLOW.md
                          robots.txt·sitemap.xml 은 오리진 루트에만 굽는다는 점 명시
  frontend/site/scripts/prerender.ts
                          헤더 주석의 렌더 보고서 경로가 실제(422줄)와 달라 수정

.gitignore
  ★ CLAUDE.md 를 더 이상 무시하지 않는다. 에이전트 지침은 팀과 모든
    에이전트가 공유하는 규약이라 커밋해야 한다 — 무시하면 클론한 사람이
    "배포 후 republish_all.py 필수" 같은 함정을 전달받지 못한다.
    개인용 오버라이드는 ~/.claude/CLAUDE.md 에 둔다.
This commit is contained in:
minaChoi committed 2026-08-31 13:57:59 +09:00
commit 6784e59ca5
713 files changed
+68390

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
{
"name": "@o2o/shared",
"private": true,
"version": "0.0.0",
"type": "module",
"exports": {
".": "./src/index.ts",
"./types": "./src/types/index.ts",
"./styles/tokens.css": "./src/styles/tokens.css",
"./styles/base.css": "./src/styles/base.css"
},
"dependencies": {
"clsx": "^2.1.1",
"tailwind-merge": "^3.6.0"
}
}
+4
View File
@@ -0,0 +1,4 @@
export * from './types';
export * from './lib/cn';
export * from './lib/slug';
export * from './lib/facts';
+6
View File
@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+106
View File
@@ -0,0 +1,106 @@
import {
isPublishableFact,
type FactEntry,
type FaqEntry,
type SitePayload,
type UnitInfo,
} from '../types';
/**
* ★ 절대규칙 1 의 실행부.
*
* 발행 게이트는 백엔드에 있지만, 렌더러도 같은 필터를 한 번 더 건다.
* 이유: 게이트를 통과한 payload 라도 캐시된 옛 버전이거나 손으로 만든 fixture 일 수 있다.
* 미검증 값이 화면 아무 데도, JSON-LD 에도 안 나가는 것이 이 함수 하나에 걸려 있다.
*/
export function selectPublishable(facts: FactEntry[]): FactEntry[] {
return facts.filter((f) => isPublishableFact(f.status) && f.value != null && f.value !== '');
}
/** key → fact 로 조회. 노출 가능한 것만 담긴다. */
export function factMap(facts: FactEntry[]): Map<string, FactEntry> {
const map = new Map<string, FactEntry>();
for (const fact of selectPublishable(facts)) map.set(fact.key, fact);
return map;
}
/** 값 문자열. 노출 불가면 undefined — 호출부가 "빈 값"과 "가려진 값"을 구분하지 않아도 되게 한다. */
export function factValue(facts: FactEntry[], key: string): string | undefined {
const fact = factMap(facts).get(key);
return fact?.value ?? undefined;
}
/**
* 값 + 단위("4대", "76㎡", "280,000원").
*
* number 타입은 천 단위 구분을 넣는다 — "280000원"은 사람이 자릿수를 세야 하고,
* LLM 이 인용할 때도 그대로 읽혀서 답변 품질이 떨어진다.
*/
export function factText(facts: FactEntry[], key: string): string | undefined {
const fact = factMap(facts).get(key);
if (!fact?.value) return undefined;
const value = fact.type === 'number' ? formatNumeric(fact.value) : fact.value;
return fact.unit ? `${value}${fact.unit}` : value;
}
function formatNumeric(raw: string): string {
const num = Number(raw.replace(/,/g, ''));
return Number.isFinite(num) ? num.toLocaleString('ko-KR') : raw;
}
/** bool 타입 fact. 미검증이면 undefined — false 로 떨어뜨리지 않는다(가려진 것과 "아니오"는 다르다). */
export function factBool(facts: FactEntry[], key: string): boolean | undefined {
const value = factValue(facts, key);
if (value == null) return undefined;
return value === 'true' || value === '1' || value === 'Y';
}
/** 발행을 막아야 하는 항목 — critical 인데 노출 불가 상태인 fact. */
export function blockingFacts(facts: FactEntry[]): FactEntry[] {
return facts.filter((f) => f.critical && !isPublishableFact(f.status));
}
/** 업종 스키마의 required 인데 값이 없는 fact. */
export function missingRequiredFacts(facts: FactEntry[]): FactEntry[] {
return facts.filter(
(f) => f.required && (!isPublishableFact(f.status) || f.value == null || f.value === ''),
);
}
/** 노출 가능한 FAQ 만. FAQPage JSON-LD 의 입력이기도 하다. */
export function selectPublishableFaqs(faqs: FaqEntry[]): FaqEntry[] {
return faqs
.filter((f) => isPublishableFact(f.status) && f.question && f.answer)
.sort((a, b) => a.sortOrder - b.sortOrder);
}
/** 단위(객실·메뉴) 안의 fact 도 같은 규칙으로 거른 사본을 준다. */
export function sanitizeUnits(units: UnitInfo[]): UnitInfo[] {
return units
.map((unit) => ({ ...unit, facts: selectPublishable(unit.facts) }))
.sort((a, b) => a.sortOrder - b.sortOrder);
}
/**
* 발행 산출물에 실을 수 있는 형태로 payload 를 깎는다.
*
* ★ 왜 필요한가 — 정적 HTML 은 하이드레이션을 위해 payload 를 통째로 심는다.
* 화면과 JSON-LD 를 아무리 잘 걸러도, 그 블롭에 미검증 fact 가 남아 있으면
* 원본 HTML 을 읽는 AI 크롤러는 그걸 그대로 읽는다. 실제로 한 번 그렇게 새어서
* 이 함수가 생겼다 — 필터를 화면에만 걸면 반쪽이다.
*
* 프리렌더는 이 결과를 서버 렌더와 임베드 **양쪽에** 쓴다.
* 같은 객체를 쓰므로 하이드레이션 불일치도 생기지 않는다.
*/
export function sanitizePayloadForPublish(payload: SitePayload): SitePayload {
return {
...payload,
facts: selectPublishable(payload.facts),
units: sanitizeUnits(payload.units),
faqs: selectPublishableFaqs(payload.faqs),
// 확정 전 채널 URL 은 동명 업소일 수 있다. 발행물에 남기지 않는다.
links: payload.links.filter((link) => link.confirmed),
// 대체 텍스트 없는 이미지는 어차피 렌더하지 않는다 — 목록에서도 뺀다.
media: payload.media.filter((item) => item.alt?.trim()),
};
}
+52
View File
@@ -0,0 +1,52 @@
/**
* 한글 상호를 URL 슬러그로 옮긴다.
*
* 한글을 로마자로 음차하지 않는다 — "달빛"을 "dalbit"으로 바꾸면 검색어와 안 맞고,
* 음차 규칙이 사람마다 달라 같은 가게가 두 주소를 갖게 된다. 한글을 그대로 두고
* 퍼센트 인코딩에 맡긴다(브라우저·검색엔진 모두 IRI 를 처리한다).
*/
export function toSlug(input: string): string {
return input
.trim()
.toLowerCase()
.replace(/[\s_]+/g, '-')
.replace(/[^\p{L}\p{N}-]/gu, '')
.replace(/-{2,}/g, '-')
.replace(/^-|-$/g, '');
}
/** origin + basePath + path 를 슬래시 중복 없이 잇는다. */
export function joinUrl(origin: string, ...parts: string[]): string {
const base = origin.replace(/\/+$/, '');
const tail = parts
.filter((p) => p !== '' && p !== '/')
.map((p) => p.replace(/^\/+|\/+$/g, ''))
.filter(Boolean)
.join('/');
return tail ? `${base}/${tail}` : base;
}
/**
* 발행 주소를 만든다. **언제나 경로형**(`https://<host>/s/<slug>`)이다.
*
* ★ 왜 서브도메인(`<slug>.<host>`)을 쓰지 않는가 — 운영이 불가능해서다.
* 사이트가 하나 늘 때마다 DNS 레코드를 새로 파고 TLS 인증서를 새로 받아야 한다.
* 사장님이 주소를 고르는 순간(발행 전) 그 둘을 우리가 대신 만들어 줄 방법이 없으므로,
* 서브도메인으로 낸 주소는 화면에만 있고 실제로는 열리지 않는다.
* 경로형은 와일드카드도 발급도 필요 없다 — 호스트 하나에 인증서 하나로 전부 서비스된다.
* (덤으로 슬러그가 ASCII 든 아니든 규칙이 하나다. 서브도메인은 한글이면 퓨니코드로
* 변환해야 하고 그 변환을 DNS·인증서·크롤러가 제각각 다뤘다 — 그 분기도 같이 사라졌다.)
*
* 커스텀 도메인이 붙으면 이 함수를 안 쓴다 — 그때는 사장님 도메인이 origin 이다.
*/
export function publishUrl(slug: string, host: string): {origin: string; basePath: string} {
// ★ 로컬 호스트만 http 다. https 로 고정하면 개발 중 [사이트 열기] 가 열리지 않는 주소로 간다.
const scheme = /^(localhost|127\.0\.0\.1)(:\d+)?$/.test(host) ? 'http' : 'https';
return {origin: `${scheme}://${host}`, basePath: `/s/${slug}`};
}
/** 사람에게 보여줄 한 줄 주소. */
export function publishUrlString(slug: string, host: string): string {
const {origin, basePath} = publishUrl(slug, host);
return `${origin}${basePath}`;
}
+75
View File
@@ -0,0 +1,75 @@
/*
* 두 앱(admin / site)이 공유하는 최소 기본 스타일.
* 폰트 로딩 · 스크롤바 · 접근성 유틸만 둔다. 색은 각 앱의 토큰이 정한다.
*/
/* Pretendard 가변폰트 self-host (public/fonts). 한국어 본문 기본 서체.
파일이 없으면 @font-face 가 조용히 실패하고 다음 폴백으로 넘어간다 — 빌드는 깨지지 않는다. */
@font-face {
font-family: 'Pretendard Variable';
font-weight: 45 920;
font-style: normal;
font-display: swap;
src: url('/fonts/PretendardVariable.woff2') format('woff2');
}
html {
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* 한글은 단어 중간에서 끊기면 읽기 나빠진다. 어절 단위로 줄바꿈. */
word-break: keep-all;
overflow-wrap: break-word;
}
/* 가로 스냅 슬라이더용 — 스크롤바를 숨긴다. */
.no-scrollbar::-webkit-scrollbar {
display: none;
}
.no-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: color-mix(in srgb, currentColor 18%, transparent);
border-radius: 9999px;
}
/* 스크린리더 전용 — 화면에서 감추되 접근성 트리에는 남긴다.
AI 크롤러도 이 텍스트를 읽는다(display:none 이면 안 읽는다). */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
/* 모션 민감 사용자 — 장식 애니메이션을 끈다. */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
+172
View File
@@ -0,0 +1,172 @@
/*
* Design Tokens (Tailwind v4) — o2o-web4ai 관리자(빌더).
*
* negodata 보일러플레이트의 토큰을 그대로 이식했다.
* 디자인 방향: "인디고 콘솔"(Linear 문법) — 조용한 무채 크롬 + 인디고(#5E6AD2) 액센트 한 곳.
*
* ★ 여기 색은 *관리자 화면*의 색이다. 발행되는 소상공인 사이트의 색이 아니다.
* 발행 사이트는 사장님이 고른 템플릿(SiteTheme.colors)이 CSS 변수로 주입된다 —
* `site/src/seo/head.ts` 의 themeStyle() 참고. 두 색 체계를 섞지 않는다.
*
* 다른 Tailwind v4 프로젝트에서 재사용하려면:
* 1) 이 파일을 복사하고
* 2) 엔트리 CSS에서 `@import "tailwindcss";` 다음에 `@import "./tokens.css";`
*
* 폰트: --font-sans 는 'Pretendard Variable'(self-host)를 참조한다.
* 폰트 파일이 없으면 'Noto Sans KR' → system-ui 로 폴백된다.
*/
@custom-variant dark (&:is(.dark *));
@theme {
--color-background: var(--background);
--color-background-rgb: var(--background-rgb);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-border: var(--border);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-accent: var(--accent);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-warning: var(--warning);
--color-info: var(--info);
--color-ring: var(--ring);
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
/* 모노 폰트엔 한글 글리프가 없다 — Pretendard 를 넣어야 한글이 OS 기본(Windows 굴림)으로 떨어지지 않는다 */
--font-mono: "JetBrains Mono", Consolas, "Segoe UI Mono", ui-monospace, SFMono-Regular, "Menlo", "Pretendard Variable", "Noto Sans KR", monospace;
}
:root {
/* 뉴트럴은 인디고로 아주 살짝 기운 회색 계열. 캔버스는 거의 백색, 층은 헤어라인 보더로 만든다 */
--background: #fcfcfd;
--background-rgb: 252, 252, 253;
--foreground: #202433;
--card: #ffffff;
--card-foreground: #202433;
--border: #e9e9ef;
--muted: #f1f1f5;
--muted-foreground: #6c7086;
--primary: #18181b; /* 원본 프로토타입의 슬레이트 블랙. 흰 글자 대비 16:1 (AAA) */
--primary-foreground: #ffffff;
--secondary: #f1f1f5;
--secondary-foreground: #33384d;
--accent: #f4f4f5; /* 메뉴 hover·선택 표면 */
--destructive: #d92d20;
--destructive-foreground: #fafafa;
--success: #17b26a;
--warning: #f79009;
--info: #6172f3;
--ring: #18181b;
--popover: #ffffff;
--popover-foreground: #202433;
--accent-foreground: #18181b;
--input: #e4e4ec;
/* 차트 카테고리 팔레트 — 고정 순서(식별용), CVD·대비 검증 통과. features 차트와 같은 계열 */
--chart-1: #3b82f6;
--chart-2: #10b981;
--chart-3: #f59e0b;
--chart-4: #a855f7;
--chart-5: #f43f5e;
--radius: 0.5rem;
/* 사이드바 = 캔버스보다 반 단계 어두운 조용한 회색 면. 액센트는 활성 아이콘에만 */
--sidebar: #f7f7f9;
--sidebar-foreground: #5f6377;
--sidebar-primary: #18181b;
--sidebar-primary-foreground: #ffffff;
--sidebar-accent: #f4f4f5;
--sidebar-accent-foreground: #18181b;
--sidebar-border: #e9e9ef;
--sidebar-ring: #5e6ad2;
}
.dark {
--background: #141419;
--background-rgb: 20, 20, 25;
--foreground: #e6e6ee;
--card: #1b1b22;
--card-foreground: #e6e6ee;
--border: #ffffff14;
--muted: #24242d;
--muted-foreground: #9a9dae;
--primary: #fafafa; /* 다크는 반전 — 밝은 표면에 진한 글자. 원본과 같은 무채색 축 */
--primary-foreground: #16161d;
--secondary: #24242d;
--secondary-foreground: #e6e6ee;
--accent: #26262f;
--destructive: #f97066;
--destructive-foreground: #fafafa;
--success: #17b26a;
--warning: #f79009;
--info: #8b93e8;
--ring: #a1a1aa;
--popover: #1b1b22;
--popover-foreground: #e6e6ee;
--accent-foreground: #ffffff;
--input: #ffffff26;
/* 라이트와 같은 순서, 다크 표면 밝기 밴드에 맞춰 emerald·amber 만 한 단계 진하게 */
--chart-1: #3b82f6;
--chart-2: #059669;
--chart-3: #d97706;
--chart-4: #a855f7;
--chart-5: #f43f5e;
--sidebar: #18181f;
--sidebar-foreground: #9a9dae;
--sidebar-primary: #fafafa;
--sidebar-primary-foreground: #16161d;
--sidebar-accent: #26262f;
--sidebar-accent-foreground: #ffffff;
--sidebar-border: #ffffff12;
--sidebar-ring: #8b93e8;
}
@theme inline {
--font-heading: var(--font-sans);
--font-sans: 'Pretendard Variable', 'Noto Sans KR', system-ui, sans-serif;
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--color-foreground: var(--foreground);
--color-background: var(--background);
--radius-sm: calc(var(--radius) * 0.6);
--radius-md: calc(var(--radius) * 0.8);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) * 1.4);
--radius-2xl: calc(var(--radius) * 1.8);
--radius-3xl: calc(var(--radius) * 2.2);
--radius-4xl: calc(var(--radius) * 2.6);
}
+160
View File
@@ -0,0 +1,160 @@
/**
* 관리자 빌더(위저드 + 에디터)가 쓰는 화면 타입.
*
* SitePayload 와 다른 층이다 — 이쪽은 "사장님이 편집 중인 상태",
* SitePayload 는 "발행 잡이 구운 결과". 편집 상태는 저장 전까지 서버에 없다.
*/
export type IndustryType = 'stay' | 'cafe' | 'restaurant' | 'tour';
export type TemplateTone = 'photo' | 'info' | 'book';
export type ViewportMode = 'pc' | 'tablet' | 'mobile';
export interface InfoField {
id: string;
label: string;
value: string;
/** 수집됐지만 사장님 확인이 필요한 값(백엔드 FactStatus.UNVERIFIED / PENDING_OWNER 대응). */
requiresVerification: boolean;
/** [맞아요] 또는 수정 승인을 거쳤는가(VERIFIED / CORRECTED 대응). */
isVerified: boolean;
/** 어디서 수집됐는지 — 사장님이 판단할 근거. 출처 없는 값은 보여주지 않는다. */
source?: string;
placeholder?: string;
category?: string;
/** ★ 틀리면 예약 클레임이 나는 항목. 미검증이면 캔버스에서도 가린다. */
critical?: boolean;
}
export interface SectionItem {
id: string;
type: string;
name: string;
/** SEO·필수 마크업 때문에 끌 수 없는 섹션(히어로 / 기본 정보 / 오시는 길). */
isLocked: boolean;
isEnabled: boolean;
description?: string;
/** 사장님이 직접 편집하는 섹션 본문. 수집된 값과 분리해 자동 수집이 덮어쓰지 않는다. */
body?: string;
/**
* 이 섹션을 어떤 레이아웃으로 그릴지 — 사장님이 [디자인] 탭에서 고른 값.
* 비어 있으면 렌더러가 해당 타입의 기본 배리에이션으로 떨어진다(빈 화면을 만들지 않는다).
* 담기는 값은 배리에이션 레지스트리의 id (예: 'hero.editorial', 'faq.two-column').
*/
variantId?: string;
}
export interface TemplateItem {
id: string;
industryId: IndustryType;
name: string;
tone: TemplateTone;
toneLabel: string;
description: string;
colors: {
primary: string;
secondary: string;
bg: string;
card: string;
text: string;
accent: string;
};
fontStyle: string;
}
export interface PhotoItem {
id: string;
url: string;
title: string;
category: string;
isPrimary?: boolean;
/** 사진 갤러리에 노출할지. undefined는 기존 데이터 호환을 위해 노출로 본다. */
isVisible?: boolean;
}
export interface FaqItem {
question: string;
answer: string;
}
/**
* Slate 문서 노드.
*
* 업종 시드의 `editor_script`(예약 문의 대화 예시)가 이 모양이다.
* 렌더러(SlateScriptRenderer)와 데이터가 같은 타입을 봐야
* "children 에 뭐가 들어올지 모르는" 상태가 안 생긴다.
*/
export interface SlateTextNode {
text: string;
bold?: boolean;
italic?: boolean;
underline?: boolean;
code?: boolean;
}
export interface SlateElementNode {
type?: string;
speaker?: string;
role?: 'buyer' | 'seller' | 'host' | 'guest' | 'ai' | 'customer';
time?: string;
children: SlateNode[];
}
export type SlateNode = SlateElementNode | SlateTextNode;
/**
* 업종 고유 목록의 한 줄(객실 · 메뉴 · 코스 · 프로그램).
*
* 업종마다 채우는 칸이 달라 전부 선택값이다 — 없는 칸은 화면에서 그냥 빠진다.
* (숙박은 size/spec, 카페는 tag, 관광체험은 duration/target 을 쓴다.)
*/
export interface IndustryListItem {
name: string;
desc?: string;
price?: string;
tag?: string;
size?: string;
spec?: string;
duration?: string;
target?: string;
}
/**
* 업종별 부가 데이터.
*
* `Record<string, unknown>` 로 두면 쓰는 쪽마다 캐스팅이 필요하고,
* 캐스팅은 틀려도 컴파일이 통과한다. 실제로 들어오는 키만 적어 둔다.
*/
export interface IndustryCustomData {
/** 숙박 — 객실 목록 */
rooms?: IndustryListItem[];
/** 카페 — 메뉴 목록 */
menuList?: IndustryListItem[];
/** 음식점 — 코스 목록 */
courseList?: IndustryListItem[];
/** 관광체험 — 프로그램 목록 */
programList?: IndustryListItem[];
/** 이용 규정 문장들 */
rules?: string[];
/** 문의 대화 예시(Slate 문서) */
editor_script?: SlateNode[];
}
/**
* 업종 설정.
*
* ★ **구조만** 담는다. 상호·주소·소개문·정보표·사진·FAQ·메뉴 같은 콘텐츠 시드는 전부 지웠다.
* 그 값들이 있던 시절에는 아직 아무 가게도 고르지 않은 화면이 가공의 업소로 가득 찼고
* ('달빛스테이 제주', '포레스트 힐 로스터스'), 사장님은 그걸 자기 가게 내용으로 읽고
* 그대로 발행했다. 콘텐츠의 출처는 서버(fact · unit · faq · media) 하나뿐이다.
*/
export interface IndustryData {
id: IndustryType;
name: string;
subName: string;
description: string;
channels: { id: string; name: string; checked: boolean }[];
sections: SectionItem[];
templates: TemplateItem[];
}
+141
View File
@@ -0,0 +1,141 @@
/**
* 백엔드 `common/enums.py` 의 코드값 미러.
*
* ★ 값은 백엔드가 유일한 소스다. 여기 숫자를 바꾸면 DB 와 어긋난다.
* 백엔드 enum 이 바뀌면 이 파일도 같이 고친다(orval 이 생성하는 model 은
* OpenAPI 스키마를 따라가지만, 아래 상수 집합 — PUBLISHABLE_FACT_STATUSES 등 —
* 은 스키마에 안 나오므로 손으로 맞춘다).
*/
/** places.category — 업종. `common/category_schema/resources/*.json` 과 1:1. */
export const PlaceCategory = {
LODGING: 1,
CAFE: 2,
RESTAURANT: 3,
TOUR_ACTIVITY: 4,
} as const;
export type PlaceCategory = (typeof PlaceCategory)[keyof typeof PlaceCategory];
/** places.status — 사업장 생애주기. 해지는 삭제가 아니라 SUSPENDED 전이다. */
export const PlaceStatus = {
DRAFT: 1,
COLLECTING: 2,
REVIEW: 3,
PUBLISHED: 4,
SUSPENDED: 5,
} as const;
export type PlaceStatus = (typeof PlaceStatus)[keyof typeof PlaceStatus];
/** facts/media/place_aliases 공용 — 값이 어디서 왔는가. 모든 사실은 출처를 갖는다. */
export const SourceType = {
OWNER: 1,
API: 2,
CRAWL: 3,
LLM: 4,
} as const;
export type SourceType = (typeof SourceType)[keyof typeof SourceType];
/** facts.status — 검증 상태. */
export const FactStatus = {
UNVERIFIED: 1,
PENDING_OWNER: 2,
VERIFIED: 3,
CORRECTED: 4,
REJECTED: 5,
EXPIRED: 6,
} as const;
export type FactStatus = (typeof FactStatus)[keyof typeof FactStatus];
/**
* ★ 절대규칙 1 — 이 두 상태만 사이트에 나간다.
*
* 프론트에서도 같은 집합을 들고 있어야 하는 이유: 발행 게이트는 백엔드가 막지만,
* 관리자 캔버스는 게이트를 통과하기 *전* 상태를 그린다. 캔버스가 미검증 값을
* 그대로 보여주면 사장님이 "이미 이렇게 나가고 있다"고 오해한다.
*/
export const PUBLISHABLE_FACT_STATUSES: readonly FactStatus[] = [
FactStatus.VERIFIED,
FactStatus.CORRECTED,
];
/** ★ 절대규칙 6 — 자동 수집이 덮어쓸 수 없는 종착 상태(사장님 수정본). */
export const LOCKED_FACT_STATUSES: readonly FactStatus[] = [FactStatus.CORRECTED];
export function isPublishableFact(status: FactStatus): boolean {
return PUBLISHABLE_FACT_STATUSES.includes(status);
}
export function isLockedFact(status: FactStatus): boolean {
return LOCKED_FACT_STATUSES.includes(status);
}
/** place_links.channel — Perplexity 가 발견하는 채널 종류. */
export const LinkChannel = {
YANOLJA: 1,
GOODCHOICE: 2,
NAVER_PLACE: 3,
INSTAGRAM: 4,
OFFICIAL_SITE: 5,
BLOG: 6,
ETC: 99,
} as const;
export type LinkChannel = (typeof LinkChannel)[keyof typeof LinkChannel];
/** sites.status — ★ 해지는 물리 삭제가 아니라 상태 전이. */
export const SiteStatus = {
DRAFT: 1,
REVIEW: 2,
PUBLISHED: 3,
SUSPENDED: 4,
UNPUBLISHED: 5,
} as const;
export type SiteStatus = (typeof SiteStatus)[keyof typeof SiteStatus];
/** site_versions.build_status — 정적 빌드는 개별 재빌드 단위로 돈다. */
export const BuildStatus = {
PENDING: 1,
BUILDING: 2,
BUILT: 3,
FAILED: 4,
} as const;
export type BuildStatus = (typeof BuildStatus)[keyof typeof BuildStatus];
/** publish_logs.reject_reason — 검수 게이트가 발행을 막은 이유. */
export const PublishRejectReason = {
UNVERIFIED_FACT: 1,
NO_UNIQUE_CONTENT: 2,
JSONLD_MISMATCH: 3,
REQUIRED_FACT_MISSING: 4,
} as const;
export type PublishRejectReason =
(typeof PublishRejectReason)[keyof typeof PublishRejectReason];
/** jobs.job_type — 수집·비전·빌드는 몇 분씩 걸려 동기 요청으로 처리할 수 없다. */
export const JobType = {
COLLECT: 1,
VISION: 2,
COPY: 3,
BUILD: 4,
LOCAL_SYNC: 5,
AI_CHECK: 6,
} as const;
export type JobType = (typeof JobType)[keyof typeof JobType];
/** jobs.status — 작업 큐 상태. */
export const JobStatus = {
PENDING: 1,
RUNNING: 2,
DONE: 3,
DEAD: 4,
} as const;
export type JobStatus = (typeof JobStatus)[keyof typeof JobStatus];
/** ai_check_results.engine — AI 검색이 우리 사이트를 근거로 답하는지 측정할 대상. */
export const AiEngine = {
CHATGPT: 1,
PERPLEXITY: 2,
GEMINI: 3,
CLAUDE: 4,
ETC: 99,
} as const;
export type AiEngine = (typeof AiEngine)[keyof typeof AiEngine];
+3
View File
@@ -0,0 +1,3 @@
export * from './domain';
export * from './site-payload';
export * from './builder';
+252
View File
@@ -0,0 +1,252 @@
import type {
FactStatus,
LinkChannel,
PlaceCategory,
SiteStatus,
SourceType,
} from './domain';
/**
* SitePayload — 발행 사이트 렌더러(`site/`)의 유일한 입력.
*
* 백엔드의 BUILD 잡이 이 JSON 을 만들어 넘기고, `site/scripts/prerender.ts` 가
* 그걸로 정적 HTML 을 굽는다. 렌더러는 이 타입 밖의 것을 절대 모른다 —
* DB 도, API 도, 로그인도 모른다. 그래서 같은 payload 면 항상 같은 HTML 이 나온다.
*
* ★ 이 payload 는 "이미 게이트를 통과한 것"이 아니다. fact 마다 status 가 그대로 실려 온다.
* 노출 필터링은 렌더러가 `selectPublishable()` 로 한 번 더 한다 —
* 백엔드 게이트가 뚫려도 미검증 값이 화면·JSON-LD 로 새지 않게 하는 2중 방어다.
*/
export interface SitePayload {
/** 스키마 버전. 렌더러가 모르는 버전이면 빌드를 실패시킨다(조용히 반쪽 렌더하지 않는다). */
schemaVersion: 1;
site: SiteMeta;
place: PlaceInfo;
/** 사업장 단위 fact (scope=place). */
facts: FactEntry[];
/** 객실·메뉴·프로그램 등 하위 단위 (scope=unit). */
units: UnitInfo[];
media: MediaItem[];
faqs: FaqEntry[];
links: ChannelLink[];
/** 지역 정보 — 행정구역 코드 단위로 캐시된 것을 사업장에 얹은 결과. */
local: LocalContents;
/** 주요 거점까지의 이동 시간. */
routes: RouteEntry[];
/** LLM 이 쓴 문장(allow_llm=true 필드). 사실이 아니라 문장이라 fact 와 분리한다. */
narrative: Narrative;
/** 템플릿 — 색/서체/섹션 순서. 관리자 에디터가 정한 값이 그대로 온다. */
theme: SiteTheme;
}
export interface SiteMeta {
siteId: string;
placeId: string;
status: SiteStatus;
/** 발행 도메인. 커스텀 도메인이 없으면 `<slug>.w4ai.o2o.kr` 같은 기본 호스트. */
origin: string;
/** URL 경로 프리픽스. 루트 발행이면 '' (빈 문자열). */
basePath: string;
slug: string;
/** ISO8601. `<meta name="dateModified">` 와 JSON-LD `dateModified` 로 나간다 — AI 검색이 신선도를 본다. */
publishedAt: string;
updatedAt: string;
/** 사이트 버전. 빌드 산출물 캐시 무효화 키. */
version: number;
}
export interface PlaceInfo {
name: string;
/** 영문 표기. 없으면 생략 — 지어내지 않는다. */
englishName?: string;
category: PlaceCategory;
roadAddress?: string;
address?: string;
/** 시·도. **주소 원문의 조각 그대로** ("경기"를 "경기도"로 펴지 않는다 — JSON-LD 가 화면과 대조된다). */
addressRegion?: string;
/** 시·군·구 ("성남시 중원구", "용산구"). 위와 같은 규칙. */
addressLocality?: string;
/** 읍·면 ("애월읍"). schema.org 에는 대응 속성이 없어 title·description 에만 쓴다. */
addressSubLocality?: string;
/** ISO 3166-2:KR 코드("KR-41"). `geo.region` 메타 전용 — 화면 대조 대상이 아니다. */
addressRegionCode?: string;
postalCode?: string;
phone?: string;
email?: string;
latitude?: number;
longitude?: number;
regionCode?: string;
/** 카카오 로컬 place id — 동일 업소 검증의 근거. `sameAs` 로 내보내지 않는다(내부 키). */
kakaoPlaceId?: string;
/** 하단 법적 고지 — 사업자등록번호·대표자·신고번호 등. 없는 항목은 넣지 않는다. */
legal?: LegalInfo;
}
export interface LegalInfo {
representative?: string;
businessRegistrationNumber?: string;
mailOrderNumber?: string;
/** 업종별 인허가 번호(농어촌민박 신고번호, 영업신고번호 등). */
licenseNumber?: string;
licenseLabel?: string;
}
/**
* fact 한 건. 업종 스키마(`common/category_schema`)의 필드 정의가 label/unit/critical 을 준다.
*/
export interface FactEntry {
key: string;
label: string;
value: string | null;
unit?: string | null;
type: 'text' | 'number' | 'bool' | 'time' | 'date';
scope: 'place' | 'unit';
status: FactStatus;
sourceType: SourceType;
sourceUrl?: string | null;
/** ★ 틀리면 헛걸음·예약 클레임이 나는 항목. 미검증이면 절대 노출하지 않는다. */
critical: boolean;
required: boolean;
/** scope=unit 인 fact 가 어느 단위에 속하는지. */
unitId?: string | null;
collectedAt?: string | null;
verifiedAt?: string | null;
}
export interface UnitInfo {
unitId: string;
name: string;
slug: string;
sortOrder: number;
facts: FactEntry[];
mediaIds: string[];
}
export interface MediaItem {
mediaId: string;
url: string;
/** 비전 분석이 만든 대체 텍스트. 비어 있으면 이미지 자체를 렌더하지 않는다(빈 alt 는 SEO 감점). */
alt: string;
category?: string;
caption?: string;
width?: number;
height?: number;
isPrimary?: boolean;
/** ★ 이미지 재게시 권리(DECISIONS 1-2)가 결론 날 때까지 출처를 보존한다. */
sourceType: SourceType;
originUrl?: string | null;
unitId?: string | null;
}
export interface FaqEntry {
faqId: string;
question: string;
answer: string;
status: FactStatus;
sourceType: SourceType;
sortOrder: number;
}
export interface ChannelLink {
channel: LinkChannel;
url: string;
title?: string;
/** 확정되지 않은 링크는 사이트에 내보내지 않는다. */
confirmed: boolean;
}
export interface LocalContents {
weather?: WeatherSnapshot;
attractions: LocalPlace[];
restaurants: LocalPlace[];
festivals: FestivalEntry[];
/** 지역 정보를 마지막으로 갱신한 시각. 화면에 그대로 노출한다(오래된 정보를 숨기지 않는다). */
syncedAt?: string;
}
export interface WeatherSnapshot {
temperature: number;
condition: string;
/** 날씨에 따른 안내 문구. LLM 문장이므로 사실 주장(가격·시간)을 담지 않는다. */
note?: string;
observedAt: string;
}
export interface LocalPlace {
name: string;
category: string;
distanceText?: string;
durationText?: string;
description?: string;
/** 외부 검색으로 보내는 질의어. 우리가 지어낸 URL 을 링크하지 않는다. */
searchQuery: string;
}
export interface FestivalEntry {
name: string;
month: string;
period?: string;
location?: string;
description?: string;
officialUrl?: string;
searchQuery: string;
}
export interface RouteEntry {
destination: string;
byCar?: string;
byTransit?: string;
distanceText?: string;
note?: string;
}
export interface Narrative {
heroHeadline?: string;
heroSubline?: string;
tagline?: string;
/** 소개문 문단들. allow_llm=true 필드라 LLM 이 썼을 수 있다. */
about: string[];
/** 요약 한 문장 — meta description 과 llms.txt 의 첫 줄로 쓴다. */
summary?: string;
}
export interface SiteTheme {
templateId: string;
colors: {
primary: string;
secondary: string;
bg: string;
card: string;
text: string;
accent: string;
};
fontStyle: string;
/** 섹션 순서와 노출 여부. 관리자 에디터의 좌측 패널이 만든 결과 그대로. */
sections: SectionSetting[];
}
export interface SectionSetting {
id: string;
/** 사장님이 붙인 섹션 제목. 발행본의 소제목이 이 값을 따른다. */
name: string;
enabled: boolean;
/** SEO·필수 마크업 때문에 끌 수 없는 섹션. */
locked: boolean;
/**
* 사장님이 [디자인] 탭에서 고른 레이아웃(배리에이션 레지스트리 키, 예: 'hero.editorial').
*
* ★ 이 필드가 없던 동안, 에디터에서 고른 배리에이션은 payload 경계에서 통째로 버려졌다 —
* 40개를 고를 수 있는데 발행본은 언제나 같은 한 벌로 나갔다.
* ★ 비어 있으면 렌더러가 그 섹션의 기본 레이아웃으로 떨어진다(화면이 깨지지 않는다).
* 렌더러가 모르는 키를 만나도 마찬가지다 — 서버는 값을 해석하지 않고 그대로 싣는다.
*/
variantId?: string;
}
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}