feat: 그날 코디는 포스트 하나에 스타일 하나 — --style 로 스타일 태그(꾸안꾸·오피스룩…) 붙은 스냅만 고르고 제목 통일

This commit is contained in:
minaChoi committed 2026-10-26 11:09:04 +09:00
1 parent 814e64931d
commit a6251db762
6 files changed
+45 -21

No files matched your search

+14 -7
View File
@@ -52,12 +52,15 @@ function buildPrompt(persona, outfit, weather) {
.replace('{layering}', weather.layering)
}
/** @returns {Promise<{ weather: object, outfits: { persona: string, label: string, style: string, labels: string[], image: string, source: string, items: object[] }[] }>} */
export async function runDailyOotd({ outDir, log = console.log }) {
/** 포스트 하나는 스타일 하나(기본 꾸안꾸). 네 사람 모두 그 스타일 스냅에서 고르고 제목도 같은 스타일로 간다.
* @returns {Promise<{ weather: object, outfits: { persona: string, label: string, style: string, labels: string[], image: string, source: string, items: object[] }[] }>} */
export async function runDailyOotd({ outDir, style = 'minimal', log = console.log }) {
if (!spec.styles[style]) throw new Error(`스타일은 ${Object.keys(spec.styles).join(', ')} 중 하나예요: ${style}`)
const styleLabel = spec.styles[style].label
const weather = await weatherToday()
log(`오늘 ${weather.day}: 아침 ${weather.morningC}° · 낮 ${weather.maxC}° → 구간 ${weather.band}`)
log(`오늘 ${weather.day}: 아침 ${weather.morningC}° · 낮 ${weather.maxC}° → 구간 ${weather.band} · 스타일 ${styleLabel}`)
mkdirSync(outDir, { recursive: true })
const picks = await pickSnaps({ band: weather.band, outDir: join(outDir, 'snaps'), log })
const picks = await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
const dailyDir = resolve('public/daily')
mkdirSync(dailyDir, { recursive: true })
const outfits = []
@@ -65,6 +68,8 @@ export async function runDailyOotd({ outDir, log = console.log }) {
const pick = picks[persona]
log(`${persona}: Claude가 옷 목록을 뽑는 중… (${pick.url})`)
const outfit = await extractOutfit(pick, persona, weather)
// 제목은 Claude 가 본 분위기가 아니라 포스트 스타일로 통일한다
outfit.style = styleLabel
const by = Object.fromEntries(outfit.items.map((it) => [it.slot, it]))
const labels = LABEL_ORDER.filter((s) => by[s]).map((s) => by[s].label)
log(` ${outfit.style}: ${labels.join(' · ')}`)
@@ -86,9 +91,11 @@ export const toCardOutfits = (outfits) => outfits.map(({ persona, label, style,
if (process.argv[1]?.endsWith('daily-ootd.mjs')) {
const args = process.argv.slice(2)
const outArg = args.includes('--out') ? args[args.indexOf('--out') + 1] : null
const flag = (n) => (args.includes(n) ? args[args.indexOf(n) + 1] : null)
const outArg = flag('--out')
const style = flag('--style') ?? 'minimal'
const day = new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
const { outfits } = await runDailyOotd({ outDir: resolve(outArg ?? `out/${day}`) })
const copy = Buffer.from(JSON.stringify({ outfits: JSON.stringify(toCardOutfits(outfits)), theme: 'sky' })).toString('base64url')
const { outfits } = await runDailyOotd({ outDir: resolve(outArg ?? `out/${day}`), style })
const copy = Buffer.from(JSON.stringify({ outfits: JSON.stringify(toCardOutfits(outfits)), style, theme: 'sky' })).toString('base64url')
console.log(`카드 그리기: npm run card -- ootd --no-images --copy ${copy}`)
}