@justin_666/square-couplets-master-skills 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,6 +167,13 @@ doufang init --ai claude
167
167
 
168
168
  初始化後,在 Cursor / Windsurf / Antigravity 中使用 slash command:
169
169
 
170
+ **在 Cursor 中(自動註冊):**
171
+ - 執行 `doufang init --ai cursor` 後,`/doufang` 命令會自動註冊
172
+ - 輸入 `/` 會看到 `/doufang` 選項
173
+ - 選擇後輸入請求,例如:"Generate a prompt for wealth theme"
174
+ - Cursor 會自動使用 CLI 工具執行,無需手動編寫代碼
175
+
176
+ **在 Windsurf / Antigravity 中:**
170
177
  ```
171
178
  /doufang Generate a prompt for wealth theme
172
179
  /doufang Create a 2K image using Gemini 3 Pro
@@ -175,8 +182,9 @@ doufang init --ai claude
175
182
 
176
183
  ### CLI 工具命令
177
184
 
178
- 安裝後,您還可以使用 `doufang-skills` 命令:
185
+ 安裝後,您可以使用多個 CLI 命令:
179
186
 
187
+ **管理 Skills:**
180
188
  ```bash
181
189
  # 列出所有可用的 skills
182
190
  doufang-skills list
@@ -191,6 +199,25 @@ doufang-skills path generate-doufang-image
191
199
  doufang-skills help
192
200
  ```
193
201
 
202
+ **執行 Skills(Agent 可直接調用):**
203
+ ```bash
204
+ # 生成 prompt
205
+ doufang-prompt "財富"
206
+ doufang-prompt "健康" images/reference.png
207
+
208
+ # 生成圖片
209
+ doufang-image "A diamond-shaped Doufang..." gemini-3-pro-image-preview 2K
210
+ doufang-image "..." gemini-2.5-flash-image 1K images/ref.png output/my-doufang.png
211
+
212
+ # 優化 prompt
213
+ doufang-optimize "A diamond-shaped Doufang with wide white margins..."
214
+ ```
215
+
216
+ **Agent 使用方式:**
217
+ Agent 可以直接執行這些 CLI 命令來生成圖片,無需手動編寫代碼。例如:
218
+ - Agent 執行:`doufang-prompt "財富"` → 獲得 prompt
219
+ - Agent 執行:`doufang-image "<prompt>" gemini-3-pro-image-preview 2K` → 生成圖片
220
+
194
221
  ### 本地安裝
195
222
 
196
223
  ```bash
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI command for generate-doufang-image skill
5
+ * Usage: doufang-image <prompt> [model] [size] [reference-image] [output-path]
6
+ */
7
+
8
+ import { fileURLToPath } from 'url';
9
+ import { dirname, join, resolve } from 'path';
10
+ import { readFileSync } from 'fs';
11
+ import { spawn } from 'child_process';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ const packageRoot = resolve(__dirname, '..');
16
+
17
+ /**
18
+ * Get package version
19
+ */
20
+ function getVersion() {
21
+ try {
22
+ const packageJsonPath = join(packageRoot, 'package.json');
23
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
24
+ return packageJson.version || 'unknown';
25
+ } catch (e) {
26
+ return 'unknown';
27
+ }
28
+ }
29
+
30
+ // Path to the skill script
31
+ const skillScript = join(packageRoot, 'skills', 'generate-doufang-image', 'index.js');
32
+
33
+ // Forward all arguments to the skill script
34
+ const args = process.argv.slice(2);
35
+
36
+ // Handle version flag
37
+ if (args[0] === '--version' || args[0] === '-v' || args[0] === 'version') {
38
+ console.log(getVersion());
39
+ process.exit(0);
40
+ }
41
+
42
+ const child = spawn('node', [skillScript, ...args], {
43
+ stdio: 'inherit',
44
+ cwd: process.cwd()
45
+ });
46
+
47
+ child.on('error', (error) => {
48
+ console.error('Error:', error.message);
49
+ process.exit(1);
50
+ });
51
+
52
+ child.on('exit', (code) => {
53
+ process.exit(code || 0);
54
+ });
@@ -15,6 +15,19 @@ const __dirname = dirname(__filename);
15
15
  // Get package root directory
16
16
  const packageRoot = resolve(__dirname, '..');
17
17
 
18
+ /**
19
+ * Get package version
20
+ */
21
+ function getVersion() {
22
+ try {
23
+ const packageJsonPath = join(packageRoot, 'package.json');
24
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
25
+ return packageJson.version || 'unknown';
26
+ } catch (e) {
27
+ return 'unknown';
28
+ }
29
+ }
30
+
18
31
  /**
19
32
  * Get the path to skills directory
20
33
  */
@@ -106,10 +119,89 @@ Skills are located in the \`skills/\` directory.
106
119
  writeFileSync(cursorRulesPath, cursorRules);
107
120
  console.log(` ✅ Created ${cursorRulesPath}`);
108
121
 
122
+ // Create .cursor/rules directory for slash command
123
+ const cursorRulesDir = join(projectPath, '.cursor', 'rules');
124
+ if (!existsSync(cursorRulesDir)) {
125
+ mkdirSync(cursorRulesDir, { recursive: true });
126
+ }
127
+
128
+ // Create doufang.mdc rule file for slash command
129
+ const doufangRulePath = join(cursorRulesDir, 'doufang.mdc');
130
+ const doufangRule = `---
131
+ description: Generate Chinese New Year Doufang artwork using Doufang Skills. Use /doufang command to generate prompts, images, or optimize prompts.
132
+ globs:
133
+ ---
134
+
135
+ # Doufang Skills - Slash Command Handler
136
+
137
+ You are a Doufang assistant. When the user uses the \`/doufang\` command or asks about Doufang functionality, follow these guidelines:
138
+
139
+ ## Available CLI Commands
140
+
141
+ 1. **Generate Prompt**: \`doufang-prompt <keyword> [reference-image]\`
142
+ - Generates a professional Doufang artwork prompt based on a keyword
143
+ - Example: \`doufang-prompt "財富"\`
144
+ - Example with reference: \`doufang-prompt "健康" images/reference.png\`
145
+
146
+ 2. **Generate Image**: \`doufang-image <prompt> [model] [size] [reference-image] [output-path]\`
147
+ - Generates actual Doufang artwork images using Gemini API
148
+ - Models: \`gemini-2.5-flash-image\` (fast, 1K only) or \`gemini-3-pro-image-preview\` (high quality, 1K/2K/4K)
149
+ - Sizes: \`1K\` (default), \`2K\`, \`4K\` (Pro model only)
150
+ - Example: \`doufang-image "A diamond-shaped Doufang..." gemini-3-pro-image-preview 2K\`
151
+
152
+ 3. **Optimize Prompt**: \`doufang-optimize <prompt>\`
153
+ - Optimizes prompts to reduce white margins and improve composition
154
+ - Example: \`doufang-optimize "A prompt with wide margins..."\`
155
+
156
+ ## Execution Guidelines
157
+
158
+ - **Direct CLI Execution**: When user requests Doufang functionality, directly execute the appropriate CLI command using terminal, do NOT create .js files
159
+ - **Read API Key**: Automatically read GEMINI_API_KEY from .env or .env.local file
160
+ - **Ask for Details**: If user doesn't provide required parameters (like keyword or prompt), ask for clarification
161
+ - **Error Handling**: If API key is missing, guide user to set GEMINI_API_KEY in .env file
162
+ - **Output Format**: For prompt generation, output JSON format. For image generation, save to output/ directory and provide file path
163
+
164
+ ## Common Workflows
165
+
166
+ ### Generate Image from Keyword
167
+ 1. Generate prompt: \`doufang-prompt "財富"\`
168
+ 2. Extract imagePrompt from JSON output
169
+ 3. Generate image: \`doufang-image "<imagePrompt>" gemini-3-pro-image-preview 2K\`
170
+
171
+ ### Generate Image with Reference
172
+ 1. Generate prompt with reference: \`doufang-prompt "健康" images/reference.png\`
173
+ 2. Extract imagePrompt from JSON output
174
+ 3. Generate image: \`doufang-image "<imagePrompt>" gemini-3-pro-image-preview 2K images/reference.png\`
175
+
176
+ ### Optimize and Generate
177
+ 1. Generate prompt: \`doufang-prompt "財富"\`
178
+ 2. Optimize prompt: \`doufang-optimize "<imagePrompt>"\`
179
+ 3. Generate image with optimized prompt: \`doufang-image "<optimizedPrompt>" gemini-3-pro-image-preview 2K\`
180
+
181
+ ## Skills Location
182
+
183
+ Skills are located in the \`skills/\` directory. Each skill has a \`SKILL.md\` file with detailed instructions.
184
+
185
+ ## API Key Setup
186
+
187
+ The \`generate-doufang-image\` command requires GEMINI_API_KEY. Check for it in:
188
+ - .env.local (priority)
189
+ - .env
190
+ - Environment variable GEMINI_API_KEY
191
+
192
+ Get API key from: https://aistudio.google.com/
193
+ `;
194
+
195
+ writeFileSync(doufangRulePath, doufangRule);
196
+ console.log(` ✅ Created ${doufangRulePath}`);
197
+ console.log(` ✅ Slash command /doufang registered in Cursor`);
198
+
109
199
  console.log('\n✨ Cursor setup complete!');
110
200
  console.log('\n📝 Usage:');
111
- console.log(' Type "/doufang" in Cursor chat followed by your request');
112
- console.log(' Example: /doufang Generate a prompt for wealth theme');
201
+ console.log(' 1. Type "/" in Cursor chat to see available commands');
202
+ console.log(' 2. Select "/doufang" from the dropdown');
203
+ console.log(' 3. Enter your request, e.g.: "Generate a prompt for wealth theme"');
204
+ console.log(' 4. Or directly type: /doufang Generate a prompt for wealth theme');
113
205
 
114
206
  return true;
115
207
  }
@@ -229,6 +321,12 @@ function main() {
229
321
  const args = process.argv.slice(2);
230
322
  const command = args[0];
231
323
 
324
+ // Handle version flag (check before parsing other options)
325
+ if (command === '--version' || command === '-v' || command === 'version') {
326
+ console.log(getVersion());
327
+ process.exit(0);
328
+ }
329
+
232
330
  // Parse --ai option
233
331
  let aiOption = null;
234
332
  for (let i = 0; i < args.length; i++) {
@@ -238,6 +336,9 @@ function main() {
238
336
  } else if (args[i]?.startsWith('--ai=')) {
239
337
  aiOption = args[i].replace('--ai=', '');
240
338
  break;
339
+ } else if (args[i] === '--version' || args[i] === '-v' || args[i] === 'version') {
340
+ console.log(getVersion());
341
+ process.exit(0);
241
342
  }
242
343
  }
243
344
 
@@ -250,6 +351,7 @@ Usage:
250
351
 
251
352
  Options:
252
353
  --ai <assistant> AI assistant to configure (cursor, windsurf, antigravity, or claude)
354
+ --version, -v Show version number
253
355
 
254
356
  Examples:
255
357
  doufang init --ai cursor
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI command for optimize-doufang-prompt skill
5
+ * Usage: doufang-optimize <prompt>
6
+ */
7
+
8
+ import { fileURLToPath } from 'url';
9
+ import { dirname, join, resolve } from 'path';
10
+ import { readFileSync } from 'fs';
11
+ import { spawn } from 'child_process';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ const packageRoot = resolve(__dirname, '..');
16
+
17
+ /**
18
+ * Get package version
19
+ */
20
+ function getVersion() {
21
+ try {
22
+ const packageJsonPath = join(packageRoot, 'package.json');
23
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
24
+ return packageJson.version || 'unknown';
25
+ } catch (e) {
26
+ return 'unknown';
27
+ }
28
+ }
29
+
30
+ // Path to the skill script
31
+ const skillScript = join(packageRoot, 'skills', 'optimize-doufang-prompt', 'index.js');
32
+
33
+ // Forward all arguments to the skill script
34
+ const args = process.argv.slice(2);
35
+
36
+ // Handle version flag
37
+ if (args[0] === '--version' || args[0] === '-v' || args[0] === 'version') {
38
+ console.log(getVersion());
39
+ process.exit(0);
40
+ }
41
+
42
+ const child = spawn('node', [skillScript, ...args], {
43
+ stdio: 'inherit',
44
+ cwd: process.cwd()
45
+ });
46
+
47
+ child.on('error', (error) => {
48
+ console.error('Error:', error.message);
49
+ process.exit(1);
50
+ });
51
+
52
+ child.on('exit', (code) => {
53
+ process.exit(code || 0);
54
+ });
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI command for generate-doufang-prompt skill
5
+ * Usage: doufang-prompt <keyword> [reference-image]
6
+ */
7
+
8
+ import { fileURLToPath } from 'url';
9
+ import { dirname, join, resolve } from 'path';
10
+ import { readFileSync } from 'fs';
11
+ import { spawn } from 'child_process';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ const packageRoot = resolve(__dirname, '..');
16
+
17
+ /**
18
+ * Get package version
19
+ */
20
+ function getVersion() {
21
+ try {
22
+ const packageJsonPath = join(packageRoot, 'package.json');
23
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
24
+ return packageJson.version || 'unknown';
25
+ } catch (e) {
26
+ return 'unknown';
27
+ }
28
+ }
29
+
30
+ // Path to the skill script
31
+ const skillScript = join(packageRoot, 'skills', 'generate-doufang-prompt', 'index.js');
32
+
33
+ // Forward all arguments to the skill script
34
+ const args = process.argv.slice(2);
35
+
36
+ // Handle version flag
37
+ if (args[0] === '--version' || args[0] === '-v' || args[0] === 'version') {
38
+ console.log(getVersion());
39
+ process.exit(0);
40
+ }
41
+
42
+ const child = spawn('node', [skillScript, ...args], {
43
+ stdio: 'inherit',
44
+ cwd: process.cwd()
45
+ });
46
+
47
+ child.on('error', (error) => {
48
+ console.error('Error:', error.message);
49
+ process.exit(1);
50
+ });
51
+
52
+ child.on('exit', (code) => {
53
+ process.exit(code || 0);
54
+ });
@@ -15,6 +15,19 @@ const __dirname = dirname(__filename);
15
15
  // Get package root directory (parent of bin/)
16
16
  const packageRoot = resolve(__dirname, '..');
17
17
 
18
+ /**
19
+ * Get package version
20
+ */
21
+ function getVersion() {
22
+ try {
23
+ const packageJsonPath = join(packageRoot, 'package.json');
24
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
25
+ return packageJson.version || 'unknown';
26
+ } catch (e) {
27
+ return 'unknown';
28
+ }
29
+ }
30
+
18
31
  /**
19
32
  * Get the path to skills directory
20
33
  */
@@ -120,6 +133,12 @@ function main() {
120
133
  const args = process.argv.slice(2);
121
134
  const command = args[0];
122
135
 
136
+ // Handle version flag
137
+ if (command === '--version' || command === '-v' || command === 'version') {
138
+ console.log(getVersion());
139
+ process.exit(0);
140
+ }
141
+
123
142
  if (!command || command === 'list' || command === 'ls') {
124
143
  listSkills();
125
144
  } else if (command === 'show' || command === 'view') {
@@ -150,6 +169,7 @@ Commands:
150
169
  list, ls List all available skills
151
170
  show <skill-name> Show a specific skill's content
152
171
  path <skill-name> Get the file path to a skill
172
+ version, --version Show version number
153
173
  help Show this help message
154
174
 
155
175
  Examples:
package/constants.ts ADDED
@@ -0,0 +1,240 @@
1
+ // Image Processing Constants
2
+ export const IMAGE_CONSTANTS = {
3
+ MAX_SIZE_KB: 500,
4
+ MAX_DIMENSION: 1920,
5
+ MAX_FILE_SIZE_MB: 10,
6
+ COMPRESSION_QUALITY: 0.85,
7
+ MIN_COMPRESSION_QUALITY: 0.1
8
+ } as const;
9
+
10
+ // Base system prompt for generating Doufang prompts
11
+ export const DOUFANG_SYSTEM_PROMPT = `
12
+ You are a professional Chinese New Year couplet and calligraphy art designer.
13
+
14
+ Your task is to generate a high-end, printable Chinese New Year "Doufang" (diamond-shaped) couplet artwork prompt based on ONE keyword provided by the user.
15
+
16
+ Step 1: Understand the meaning and blessing intention of the keyword.
17
+ - If the keyword is about wealth -> design a wealth-themed couplet.
18
+ - If about health -> design a health & longevity themed couplet.
19
+ - If about career -> design a success & promotion themed couplet.
20
+ - If about peace -> design a safety & harmony themed couplet.
21
+ - If about love -> design a relationship & harmony themed couplet.
22
+ - If about study -> design wisdom & academic success themed couplet.
23
+ - If about general luck -> design auspicious & good fortune themed couplet.
24
+
25
+ Step 2: Decide the final 4-character Chinese blessing phrase automatically.
26
+ - The phrase must be elegant, common in Chinese New Year usage, and culturally appropriate.
27
+ - If the user input itself is suitable (e.g. "馬上發財", "平安喜樂"), you may use it directly.
28
+ - Otherwise, transform or upgrade it into a proper 4-character blessing phrase.
29
+
30
+ Step 3: Generate the artwork prompt with the following visual style:
31
+
32
+ Artwork description:
33
+ A diamond-shaped Chinese New Year "Doufang" couplet on antique gold-flecked red Xuan paper.
34
+
35
+ Central theme: bold, powerful, energetic traditional Chinese ink wash calligraphy of the final 4-character blessing phrase: [INSERT PHRASE HERE].
36
+
37
+ Around the calligraphy: symbolic elements that visually represent the user's keyword, painted in traditional Chinese ink painting style (for example: horse, dragon, pine tree, crane, gold ingots, clouds, mountains, sun, plum blossoms, etc).
38
+
39
+ Style: traditional Chinese ink painting mixed with realistic illustration, elegant, prestigious, festive but high-class, not cartoon.
40
+
41
+ Material & texture: real Xuan paper texture, gold flecks, red rice paper, visible paper fibers, natural ink diffusion, subtle embossed gold foil details.
42
+
43
+ Color theme: deep Chinese red, gold, black ink, warm highlights.
44
+
45
+ Lighting: soft studio lighting, gentle glow on gold details, museum-quality artwork.
46
+
47
+ Composition:
48
+ The diamond-shaped Doufang fills the majority of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping).
49
+ The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off.
50
+ The Doufang should occupy 85-95% of the image area, maximizing visual impact.
51
+ Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall.
52
+
53
+ Quality: ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio.
54
+
55
+ Framing requirements:
56
+ - The entire diamond-shaped Doufang must be fully visible inside the image.
57
+ - No part of the artwork is cut off, cropped, out of frame, or touching the image borders.
58
+ - Minimal margins - the Doufang should fill most of the frame (85-95% of image area).
59
+
60
+ Text requirements:
61
+ - The Chinese characters must be clear, correct, readable.
62
+ - No typo, no deformed text.
63
+ - No modern elements, no western style, no watermark.
64
+
65
+ OUTPUT FORMAT:
66
+ Return a JSON object with the following structure:
67
+ {
68
+ "blessingPhrase": "The 4 character phrase you chose",
69
+ "imagePrompt": "The full detailed English image generation prompt based on the instructions above."
70
+ }
71
+ `;
72
+
73
+ export const getDoufangSystemPromptWithReference = (): string => {
74
+ return `You are a professional Chinese New Year Doufang (diamond-shaped couplet) designer and calligrapher.
75
+
76
+ ### CORE MISSION:
77
+ Your task is to analyze a REFERENCE IMAGE and a KEYWORD to create a unique, high-end Chinese New Year Doufang. The reference image is your PRIMARY visual guide for style, subject category, and material language — but it must NEVER be copied.
78
+
79
+ ---
80
+
81
+ ### STEP 1: KEYWORD & BLESSING LOGIC
82
+ Transform the user's keyword into a 4-character Chinese blessing phrase:
83
+ - Wealth -> e.g., 招財進寶, 富貴吉祥
84
+ - Health -> e.g., 龍馬精神, 延年益壽
85
+ - Career/Success -> e.g., 大展宏圖, 步步高升
86
+ - Peace/Harmony -> e.g., 平安喜樂, 歲歲平安
87
+ - Love -> e.g., 永結同心, 花好月圓
88
+ - Custom -> If the user provides a 4-character phrase, use it directly.
89
+
90
+ ---
91
+
92
+ ### STEP 2: REFERENCE IMAGE DNA EXTRACTION (CRITICAL)
93
+ Analyze the reference image and extract the following "Visual DNA":
94
+ 1. **Primary Subject Category**: Identify the type of subject (e.g., cat, dragon, robot, girl), not the exact instance.
95
+ 2. **Artistic Style**: Is it 3D render, minimalist, oil painting, ink painting, cyberpunk, paper-cut, etc.
96
+ 3. **Material & Texture Language**: e.g., glossy plastic, brushed metal, rough impasto, rice paper fibers, silk, ceramic.
97
+ 4. **Color Language**: Identify the dominant colors beyond standard red/gold.
98
+ 5. **Shape Language & Design Grammar**: e.g., rounded cute proportions, sharp mechanical shapes, flowing ink strokes, geometric blocks.
99
+
100
+ ---
101
+
102
+ ### STEP 2.5: REFERENCE TRANSFORMATION RULE (EXTREMELY IMPORTANT)
103
+ The reference image is **NOT** to be copied, replicated, traced, or minimally modified.
104
+
105
+ - You MUST:
106
+ - Keep the same **artistic style, subject category, and material feeling**
107
+ - But **redesign the pose, composition, structure, and details**
108
+ - You MUST:
109
+ - Change at least **3 major visual aspects** (for example: pose, camera angle, composition, costume/ornamentation, structure, surface details, silhouette, or proportion)
110
+ - The final artwork must:
111
+ - Be **clearly inspired by** the reference image
112
+ - But **obviously a new original creation**, not a variant, not a replica
113
+ - Think of it as:
114
+ > "Same species, same art director, but a completely new photoshoot."
115
+
116
+ - You MUST absolutely avoid:
117
+ - Same pose
118
+ - Same composition
119
+ - Same framing
120
+ - Same silhouette
121
+ - Any form of visual overlay similarity
122
+
123
+ - The generated image must not be visually alignable or overlayable with the reference image.
124
+
125
+ ---
126
+
127
+ ### STEP 3: ARTWORK SPECIFICATIONS (DOUFANG FORMAT)
128
+ - **Shape**: A perfect diamond-shaped (rotated square) "Doufang".
129
+ - **Background**: Traditional deep vermilion or "Wanshou" red Xuan paper, but infused with textures or visual language from the reference image.
130
+ - **Calligraphy Layout**: The 4-character blessing MUST be arranged in a **balanced 2x2 square grid** at the center.
131
+ - **Integration**: The subject inspired by the reference image should interact with the calligraphy (e.g., surrounding it, weaving through strokes, carved as relief, or forming a majestic backdrop).
132
+
133
+ ---
134
+
135
+ ### STEP 4: PROMPT CONSTRUCTION GUIDELINES
136
+ Your generated "imagePrompt" must follow this logic:
137
+ - **Style Fusion**: Do NOT just say "ink painting." Instead, say "Traditional Doufang reimagined in [Style from Reference Image]."
138
+ - **Subject Redesign**: Describe the subject as "a reimagined, redesigned, and re-composed version inspired by the reference, not a copy".
139
+ - **Subject Adaptation**: Always adapt the subject into an auspicious Chinese New Year version.
140
+ - **Materiality**: Combine "red gold-flecked Xuan paper" with the material language from the reference (e.g., ceramic, metal, plastic, silk, oil paint).
141
+ - **Lighting**: Use high-end studio lighting or museum-grade lighting to emphasize the diamond shape, material depth, and calligraphy relief.
142
+
143
+ ---
144
+
145
+ ### FINAL OUTPUT CONSTRAINTS:
146
+ 1. **Framing**:
147
+ - The entire diamond Doufang must be fully contained within the 1:1 frame.
148
+ - Minimal, elegant margins - just enough to prevent edge cropping (approximately 2-5% of frame width).
149
+ - The Doufang should fill most of the frame (85-95% of the image area).
150
+ - No cropping, no touching edges, no cut-off.
151
+ 2. **Text Quality**:
152
+ - Calligraphy must be clear, professional, and correctly written.
153
+ - No distorted strokes, no typos.
154
+ 3. **No Modern Junk**:
155
+ - No UI elements, no watermarks, no photography credits, no signatures.
156
+
157
+ ---
158
+
159
+ Composition:
160
+ The diamond-shaped Doufang fills the majority of the 1:1 frame, centered with minimal elegant margins (just enough to prevent edge cropping, approximately 2-5% of frame width).
161
+ The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off.
162
+ The Doufang should occupy 85-95% of the image area, maximizing visual impact.
163
+ Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall.
164
+
165
+ Quality: ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio.
166
+
167
+ Framing requirements:
168
+ - The entire diamond-shaped Doufang must be fully visible inside the image.
169
+ - No part of the artwork is cut off, cropped, out of frame, or touching the image borders.
170
+ - Minimal margins - the Doufang should fill most of the frame (85-95% of image area).
171
+
172
+ Text requirements:
173
+ - The Chinese characters must be clear, correct, readable.
174
+ - No typo, no deformed text.
175
+ - No modern elements, no western style, no watermark.
176
+
177
+ ---
178
+
179
+ ### OUTPUT FORMAT (JSON ONLY):
180
+ Return only a JSON object:
181
+ {
182
+ "blessingPhrase": "The chosen 4-character phrase",
183
+ "analysis": "Briefly describe what you extracted from the reference image and how you transformed it",
184
+ "imagePrompt": "A highly detailed, around 200-word English prompt that blends the reference image DNA with the Doufang requirements. Focus on textures, lighting, redesigned subject, 2x2 text layout, and centering."
185
+ }
186
+ `;
187
+ };
188
+
189
+
190
+ // User input prompt template for reference image analysis
191
+ export const getReferenceImageAnalysisPrompt = (userKeyword: string): string => {
192
+ return `User input keyword: 「${userKeyword}」
193
+
194
+ CRITICAL INSTRUCTION: A reference image has been provided above. You MUST analyze this reference image in detail and generate a prompt that DIRECTLY USES the reference image's visual content, patterns, and style.
195
+
196
+ STEP-BY-STEP ANALYSIS REQUIRED:
197
+ 1. FIRST, describe what you see in the reference image:
198
+ - What is the main subject or central figure? (e.g., samurai, warrior, character, object, etc.)
199
+ - What specific visual patterns, motifs, or decorative elements are present?
200
+ - What is the composition structure? How are elements arranged?
201
+ - What are the distinctive visual characteristics? (shapes, forms, graphic elements)
202
+ - What background elements or environmental details are visible?
203
+
204
+ 2. THEN, identify the artistic style:
205
+ - What is the artistic technique? (ink wash, brush painting, illustration style, etc.)
206
+ - What is the color palette? (specific colors, tones, contrast levels)
207
+ - What is the brushwork quality? (bold strokes, fine lines, texture, etc.)
208
+ - What is the visual mood? (dramatic, serene, energetic, etc.)
209
+ - What material/texture characteristics are visible?
210
+
211
+ 3. FINALLY, generate a prompt that:
212
+ - DIRECTLY incorporates the main subject or key visual elements from the reference image
213
+ - PRESERVES the exact visual patterns, motifs, and decorative elements visible in the reference
214
+ - MAINTAINS the same artistic style, brushwork, and technique
215
+ - USES the same color palette and visual mood
216
+ - ADAPTS these elements to the diamond-shaped Doufang format while keeping the reference image's visual identity
217
+ - BLENDS the user's keyword (${userKeyword}) with the reference image's visual content
218
+
219
+ The generated prompt MUST explicitly describe:
220
+ - The specific visual elements from the reference image to be included
221
+ - How to recreate the reference image's patterns and motifs in the Doufang
222
+ - The exact artistic style and technique to match the reference
223
+ - The color palette and visual characteristics to preserve
224
+
225
+ DO NOT create generic descriptions. Be SPECIFIC about what you see in the reference image and how to recreate it.`;
226
+ };
227
+
228
+ // Simple user input prompt without reference image
229
+ export const getSimpleUserInputPrompt = (userKeyword: string): string => {
230
+ return `User input keyword: 「${userKeyword}」`;
231
+ };
232
+
233
+ // Image generation prompt enhancement when reference image is provided
234
+ export const getImageGenerationPromptWithReference = (basePrompt: string): string => {
235
+ return `${basePrompt}
236
+
237
+ IMPORTANT COMPOSITION NOTE: The diamond-shaped Doufang should fill 85-95% of the frame with minimal margins (2-5% of frame width). Avoid excessive white space or wide margins. Maximize the visual impact by making the Doufang artwork occupy most of the image area.
238
+
239
+ Note: The reference image provided above should be used as a visual style guide. Follow the style, color palette, and artistic approach described in the prompt, which was generated based on analysis of this reference image.`;
240
+ };