feat: 경제 타로 전용 카드 10장(불장·존버·분할매수·익절·손절·관망·물타기·배당·적금·텅장) — 경제 주제는 이 카드에서 오늘 날씨에 맞는 3장을 고르고 리딩을 돈 이야기로
No files matched your search
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"about": "경제(주식·재테크) 타로 전용 카드. topics.json 에서 deck 이 money 인 대주제는 날씨각 각 대신 이 카드에서 오늘 날씨(when)에 맞는 3장을 고른다. 그림은 src/assets/gak-card/<code>.webp (npm run gen-image -- gak-card <code>).",
|
||||
"cards": [
|
||||
{ "code": "money_bull", "name": "불장각", "icon": "sun", "description": "맑고 따뜻해 마음이 들뜨는 날, 덩달아 사고 싶어지는 정도", "when": "하루 종일 맑고 낮이 따뜻한 날(낮 최고 20도 안팎 이상)", "scene": "the rabbit and bear cheering on top of a big glossy RED upward arrow shaped like a hill, bright sunny sky, a few gold coins bouncing around" },
|
||||
{ "code": "money_hold", "name": "존버각", "icon": "umbrella", "description": "흐리거나 비 오는 날, 팔지 않고 버티기 좋은 정도", "when": "흐리거나 비 소식이 있는 날", "scene": "the bear sitting firmly on a small pile of gold coins holding an umbrella in gentle rain, calm and determined, the rabbit hugging the bear's arm" },
|
||||
{ "code": "money_split", "name": "분할매수각", "icon": "sun_cloud", "description": "아침저녁과 낮 기온 차가 큰 날, 한 번에 말고 나눠 사기 좋은 정도", "when": "아침·저녁과 낮의 기온 차가 큰 날(7도 이상)", "scene": "the rabbit carefully dropping one gold coin at a time into three small glass jars lined up in a row, morning light on one side and noon light on the other" },
|
||||
{ "code": "money_takeprofit", "name": "익절각", "icon": "gold", "description": "맑은 낮, 오른 만큼 챙겨 두기 좋은 정도", "when": "낮이 맑은 날(가장 따뜻한 시간대)", "scene": "the rabbit picking shiny golden coin-fruits from a small tree at bright noon and handing them to the bear who holds a basket" },
|
||||
{ "code": "money_stoploss", "name": "손절각", "icon": "coldwind", "description": "기온이 뚝 떨어지거나 바람이 찬 날, 미련을 끊기 좋은 정도", "when": "어제보다 기온이 크게 떨어지거나 바람이 차가운 날", "scene": "the bear calmly snipping the string of a drooping balloon with small scissors while the rabbit waves goodbye, cool wind with a few falling leaves" },
|
||||
{ "code": "money_watch", "name": "관망각", "icon": "jipkok", "description": "나가기 싫은 날, 사고팔기보다 지켜보기 좋은 정도", "when": "춥거나 흐려서 집에 있고 싶은 날", "scene": "the rabbit and bear wrapped in a blanket on a sofa, looking out the window through a toy binocular at rolling hills shaped like a gentle zigzag line" },
|
||||
{ "code": "money_avgdown", "name": "물타기각", "icon": "rain", "description": "비 오는 날, 평단 낮추기를 신중히 따져 볼 정도", "when": "비가 오는 날", "scene": "the bear carefully watering a small potted plant whose leaves are gold coins with a little watering can while light rain falls outside, the rabbit holding a tiny umbrella over the pot" },
|
||||
{ "code": "money_dividend", "name": "배당각", "icon": "sunset", "description": "해가 일찍 지는 가을·겨울 저녁, 따박따박 쌓이는 돈이 반가운 정도", "when": "가을·겨울의 맑은 저녁(해 질 녘)", "scene": "at sunset the rabbit and bear holding a basket under a tree that gently drops gold coins like acorns, warm orange sky" },
|
||||
{ "code": "money_savings", "name": "적금각", "icon": "bronze", "description": "쌀쌀하고 맑은 아침, 꾸준히 넣기 좋은 정도", "when": "아침이 쌀쌀하고(체감 10도 안팎 이하) 맑은 날", "scene": "in a crisp clear morning the rabbit wearing a small scarf dropping a plain gold coin (no symbols or marks) into a cute pastel piggy bank while the bear watches with a mug" },
|
||||
{ "code": "money_broke", "name": "텅장각", "icon": "delivery", "description": "비나 추위에 배달이 몰리는 날, 지출을 조심할 정도", "when": "비가 오거나 아주 추워 배달 주문이 몰리는 날", "scene": "the bear sitting among a stack of delivery food boxes holding an empty open wallet upside down, the rabbit peeking in surprised" }
|
||||
]
|
||||
}
|
||||
@@ -21,7 +21,8 @@ const spec = JSON.parse(readFileSync(promptFile, 'utf8'))
|
||||
// 각 카드는 그림 목록을 따로 적지 않고 서비스의 각 목록에서 만든다
|
||||
if (spec.deck === 'gak') {
|
||||
const defs = JSON.parse(readFileSync(resolve('../backend/seed/index_definition.json'), 'utf8'))
|
||||
spec.items = defs.map((g) => ({ id: g.code, motif: spec.scene.replaceAll('{name}', g.name).replaceAll('{meaning}', g.description), name: g.name, meaning: g.description }))
|
||||
const money = JSON.parse(readFileSync(resolve('money-deck.json'), 'utf8')).cards
|
||||
spec.items = [...defs, ...money].map((g) => ({ id: g.code, motif: (g.scene ?? spec.scene).replaceAll('{name}', g.name).replaceAll('{meaning}', g.description), name: g.name, meaning: g.description }))
|
||||
}
|
||||
const outDir = resolve(`src/assets/${kind}`)
|
||||
mkdirSync(outDir, { recursive: true })
|
||||
|
||||
@@ -20,6 +20,10 @@ const questionOf = (topic) => {
|
||||
}
|
||||
// 날씨 타로 카드 = 날씨각 각 카드 (서비스와 같은 각 목록)
|
||||
const DECK = JSON.parse(readFileSync(resolve(import.meta.dirname, '../../backend/seed/index_definition.json'), 'utf8')).map((g) => ({ id: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
// 경제 전용 카드: topics.json 에서 deck 이 money 인 대주제는 이 카드에서만 고른다
|
||||
const MONEY_DECK = JSON.parse(readFileSync(resolve(import.meta.dirname, '../money-deck.json'), 'utf8')).cards.map((g) => ({ id: g.code, name: g.name, icon: g.icon, meaning: g.description, when: g.when }))
|
||||
const ALL_CARDS = [...DECK, ...MONEY_DECK]
|
||||
const deckOf = (topic) => (categoryOf(topic ?? '')?.deck === 'money' ? MONEY_DECK : DECK)
|
||||
// 최근에 쓴 각은 빼서 매일 같은 카드가 나오지 않게 한다 (card.mjs 가 기획할 때마다 적는다)
|
||||
const HISTORY_FILE = resolve(import.meta.dirname, '../out/tarot-history.json')
|
||||
const HISTORY_DAYS = 7
|
||||
@@ -43,7 +47,7 @@ const RULES = [
|
||||
'카드에 들어가야 하니 칸마다 지금 문구와 비슷한 길이(최대 1.3배)로 쓴다(날씨 타로 리딩은 아래 길이 규칙을 따른다). 줄바꿈은 " ⏎ "로 표시하고, 개수를 지금 문구와 맞춘다.',
|
||||
'강조할 말은 *별표*로 감싼다. 지금 문구에 별표가 있으면 같은 자리에 둔다.',
|
||||
`아이콘 칸(i1·i2·i3)은 다음 중 하나의 파일 이름만 쓴다: ${ICONS.join(', ')}`,
|
||||
'쓰지 않는 것: 투자 권유(종목, 매수·매도, 수익·손실 단정), 건강·의료 단정, 사고·재난·정치, 특정 집단 비하, 욕설.',
|
||||
'쓰지 않는 것: 투자 권유(종목 추천, 수익·손실 단정), 건강·의료 단정, 사고·재난·정치, 특정 집단 비하, 욕설.',
|
||||
'"재미로"라는 말이 지금 문구에 있으면 남긴다.',
|
||||
'주제가 있으면 제목·카드 이름·문장을 모두 그 주제의 말로 바꾼다. 오늘 날씨 사실은 주제에 빗대는 근거로만 쓴다.',
|
||||
'날씨각의 각 요약 문장("오전 10시 14°, 바람 조금")을 그대로 옮기지 않는다. 날씨 사실은 쉬운 말로 다시 쓴다.',
|
||||
@@ -69,15 +73,18 @@ const TAROT_TONE = [
|
||||
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 시간·날씨·행동 한 줄 22자 이내("저녁 8시, 17도로 걷기 딱 좋아요").',
|
||||
]
|
||||
|
||||
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다) */
|
||||
function availableDeck(fixed = {}) {
|
||||
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다). 경제 카드는 10장뿐이라 날씨로만 고른다 */
|
||||
function availableDeck(fixed = {}, topic = '') {
|
||||
const deck = deckOf(topic)
|
||||
if (deck === MONEY_DECK) return deck
|
||||
const recent = new Set(recentCodes())
|
||||
const keep = new Set(fixed.cards ?? [])
|
||||
return DECK.filter((c) => !recent.has(c.id) || keep.has(c.id))
|
||||
return deck.filter((c) => !recent.has(c.id) || keep.has(c.id))
|
||||
}
|
||||
|
||||
function tarotSection(topic, fixed = {}) {
|
||||
const deck = availableDeck(fixed)
|
||||
const deck = availableDeck(fixed, topic)
|
||||
if (deck === MONEY_DECK) return moneySection(topic)
|
||||
const excluded = DECK.filter((c) => !deck.includes(c)).map((c) => c.name)
|
||||
return [
|
||||
'',
|
||||
@@ -91,6 +98,19 @@ function tarotSection(topic, fixed = {}) {
|
||||
]
|
||||
}
|
||||
|
||||
function moneySection(topic) {
|
||||
return [
|
||||
'',
|
||||
'## 경제 카드 (이 목록에서만 고른다. card1·card2·card3에 서로 다른 code)',
|
||||
`표지 질문(question)은 이것을 쓴다(피드백이 바꾸라고 하면 바꾼다): ${questionOf(topic)}`,
|
||||
'각 카드의 "어울리는 날씨"가 오늘 날씨 데이터와 맞는 카드만 고른다. 맞는 카드가 많으면 더 잘 맞는 것, 아침·낮·저녁으로 이어지는 것을 고른다. 날씨와 안 맞는 카드는 고르지 않는다.',
|
||||
'리딩은 카드 이름(불장·존버·분할매수·익절·손절·관망·물타기·배당·적금·텅장)의 뜻을 주식·돈 관리 이야기로 직접 풀고, 오늘 날씨를 그 근거로 든다. 산책·꽃구경 같은 날씨 활동 이야기로 새지 않는다. 종목 추천·수익 단정은 하지 않는다.',
|
||||
...TAROT_TONE,
|
||||
'',
|
||||
...MONEY_DECK.map((c) => `- ${c.id}: ${c.name} — ${c.meaning} / 어울리는 날씨: ${c.when}`),
|
||||
]
|
||||
}
|
||||
|
||||
function buildPrompt(ctx, { topic, feedback, fixed = {} }) {
|
||||
// 줄바꿈은 ⏎ 로 보여 주고 받을 때 되돌린다 (JSON 안의 \\n 을 글자로 따라 쓰는 일을 막는다)
|
||||
const fields = ctx.fields.map((f) => `- ${f.key} (${f.label}): ${String(ctx.current[f.key] ?? '').replaceAll('\n', ' ⏎ ')}`).join('\n')
|
||||
@@ -116,16 +136,16 @@ function buildPrompt(ctx, { topic, feedback, fixed = {} }) {
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
function schema(ctx, fixed = {}) {
|
||||
function schema(ctx, fixed = {}, topic = '') {
|
||||
const properties = { topic: { type: 'string' } }
|
||||
for (const f of ctx.fields) if (!(isTarot(ctx) && DECK_KEY.test(f.key))) properties[f.key] = { type: 'string' }
|
||||
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: availableDeck(fixed).map((c) => c.id) }
|
||||
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: availableDeck(fixed, topic).map((c) => c.id) }
|
||||
return { type: 'object', properties, required: Object.keys(properties), additionalProperties: false }
|
||||
}
|
||||
|
||||
/** @returns {Promise<{ topic: string, copy: Record<string, string> }>} */
|
||||
export function runPlan(ctx, { topic = '', feedback = '', fixed = {} } = {}) {
|
||||
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx, fixed)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
|
||||
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx, fixed, topic)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
|
||||
return new Promise((done, fail) => {
|
||||
execFile('claude', args, { cwd: tmpdir(), timeout: 180_000, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
|
||||
if (err) return fail(new Error(`Claude CLI 실행 실패: ${err.message}. 터미널에서 claude 로그인 상태를 확인하세요.`))
|
||||
@@ -142,7 +162,7 @@ export function runPlan(ctx, { topic = '', feedback = '', fixed = {} } = {}) {
|
||||
if (fixed.question) result.question = fixed.question
|
||||
fixed.cards?.forEach((code, i) => (result[`card${i + 1}`] = code))
|
||||
;['card1', 'card2', 'card3'].forEach((k, i) => {
|
||||
const card = DECK.find((c) => c.id === result[k])
|
||||
const card = ALL_CARDS.find((c) => c.id === result[k])
|
||||
if (card) Object.assign(result, { [`c${i + 1}`]: card.id, [`n${i + 1}`]: card.name, [`i${i + 1}`]: card.icon })
|
||||
})
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 219 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 239 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 203 KiB |
@@ -1,8 +1,9 @@
|
||||
import defs from '../../../backend/seed/index_definition.json'
|
||||
import money from '../../money-deck.json'
|
||||
|
||||
/** 날씨 타로 카드 덱 = 날씨각 각 카드 (서비스와 같은 목록) */
|
||||
/** 날씨 타로 카드 덱 = 날씨각 각 카드 (서비스와 같은 목록) + 경제 전용 카드(money-deck.json) */
|
||||
export type GakCard = { code: string; name: string; icon: string; meaning: string }
|
||||
export const GAK_DECK: GakCard[] = defs.map((g) => ({ code: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
export const GAK_DECK: GakCard[] = [...defs, ...money.cards].map((g) => ({ code: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
export const gakByCode = (code?: string) => GAK_DECK.find((g) => g.code === code)
|
||||
|
||||
// 각 카드 앞면 그림 (Codex, npm run gen-image -- gak-card <code>). 없으면 각 아이콘
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"id": "money",
|
||||
"name": "경제",
|
||||
"skin": "coin",
|
||||
"deck": "money",
|
||||
"subtopics": [
|
||||
"주식",
|
||||
"재테크",
|
||||
|
||||