@julioventura/opensquad 0.1.17

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.
Files changed (247) hide show
  1. package/README.md +433 -0
  2. package/_opensquad/config/playwright.config.json +11 -0
  3. package/_opensquad/core/architect.agent.yaml +112 -0
  4. package/_opensquad/core/best-practices/_catalog.yaml +126 -0
  5. package/_opensquad/core/best-practices/blog-post.md +132 -0
  6. package/_opensquad/core/best-practices/blog-seo.md +127 -0
  7. package/_opensquad/core/best-practices/brand-resolution-checklist.md +172 -0
  8. package/_opensquad/core/best-practices/copywriting.md +441 -0
  9. package/_opensquad/core/best-practices/data-analysis.md +401 -0
  10. package/_opensquad/core/best-practices/email-newsletter.md +118 -0
  11. package/_opensquad/core/best-practices/email-sales.md +110 -0
  12. package/_opensquad/core/best-practices/image-design.md +348 -0
  13. package/_opensquad/core/best-practices/instagram-feed.md +235 -0
  14. package/_opensquad/core/best-practices/instagram-reels.md +112 -0
  15. package/_opensquad/core/best-practices/instagram-stories.md +107 -0
  16. package/_opensquad/core/best-practices/linkedin-article.md +116 -0
  17. package/_opensquad/core/best-practices/linkedin-post.md +121 -0
  18. package/_opensquad/core/best-practices/researching.md +349 -0
  19. package/_opensquad/core/best-practices/review.md +269 -0
  20. package/_opensquad/core/best-practices/run-recovery.md +61 -0
  21. package/_opensquad/core/best-practices/social-networks-publishing.md +327 -0
  22. package/_opensquad/core/best-practices/squad-creation-checklist.md +32 -0
  23. package/_opensquad/core/best-practices/strategist.md +344 -0
  24. package/_opensquad/core/best-practices/technical-writing.md +365 -0
  25. package/_opensquad/core/best-practices/twitter-post.md +105 -0
  26. package/_opensquad/core/best-practices/twitter-thread.md +122 -0
  27. package/_opensquad/core/best-practices/whatsapp-broadcast.md +107 -0
  28. package/_opensquad/core/best-practices/youtube-script.md +122 -0
  29. package/_opensquad/core/best-practices/youtube-shorts.md +112 -0
  30. package/_opensquad/core/defaults/youtube-video-assembly.json +84 -0
  31. package/_opensquad/core/prompts/build.prompt.md +613 -0
  32. package/_opensquad/core/prompts/design.prompt.md +606 -0
  33. package/_opensquad/core/prompts/discovery.prompt.md +377 -0
  34. package/_opensquad/core/prompts/sherlock-instagram.md +123 -0
  35. package/_opensquad/core/prompts/sherlock-linkedin.md +73 -0
  36. package/_opensquad/core/prompts/sherlock-shared.md +684 -0
  37. package/_opensquad/core/prompts/sherlock-twitter.md +78 -0
  38. package/_opensquad/core/prompts/sherlock-youtube.md +85 -0
  39. package/_opensquad/core/runner.pipeline.md +743 -0
  40. package/_opensquad/core/skills.engine.md +384 -0
  41. package/bin/opensquad.js +108 -0
  42. package/dashboard/index.html +15 -0
  43. package/dashboard/package-lock.json +1964 -0
  44. package/dashboard/package.json +28 -0
  45. package/dashboard/public/assets/avatars/Female1_1wave.png +0 -0
  46. package/dashboard/public/assets/avatars/Female1_2wave.png +0 -0
  47. package/dashboard/public/assets/avatars/Female1_blink.png +0 -0
  48. package/dashboard/public/assets/avatars/Female1_talk.png +0 -0
  49. package/dashboard/public/assets/avatars/Female2_1wave.png +0 -0
  50. package/dashboard/public/assets/avatars/Female2_2wave.png +0 -0
  51. package/dashboard/public/assets/avatars/Female2_blink.png +0 -0
  52. package/dashboard/public/assets/avatars/Female2_talk.png +0 -0
  53. package/dashboard/public/assets/avatars/Female3_blink.png +0 -0
  54. package/dashboard/public/assets/avatars/Female3_talk.png +0 -0
  55. package/dashboard/public/assets/avatars/Female3_wave.png +0 -0
  56. package/dashboard/public/assets/avatars/Female4_blink.png +0 -0
  57. package/dashboard/public/assets/avatars/Female4_talk.png +0 -0
  58. package/dashboard/public/assets/avatars/Female4_wave.png +0 -0
  59. package/dashboard/public/assets/avatars/Female5_blink.png +0 -0
  60. package/dashboard/public/assets/avatars/Female5_talk.png +0 -0
  61. package/dashboard/public/assets/avatars/Female5_wave.png +0 -0
  62. package/dashboard/public/assets/avatars/Female6_blink.png +0 -0
  63. package/dashboard/public/assets/avatars/Female6_talk.png +0 -0
  64. package/dashboard/public/assets/avatars/Female6_wave.png +0 -0
  65. package/dashboard/public/assets/avatars/Male1_1wave.png +0 -0
  66. package/dashboard/public/assets/avatars/Male1_2wave.png +0 -0
  67. package/dashboard/public/assets/avatars/Male1_blink.png +0 -0
  68. package/dashboard/public/assets/avatars/Male1_talk.png +0 -0
  69. package/dashboard/public/assets/avatars/Male2_1wave.png +0 -0
  70. package/dashboard/public/assets/avatars/Male2_2wave.png +0 -0
  71. package/dashboard/public/assets/avatars/Male2_blink.png +0 -0
  72. package/dashboard/public/assets/avatars/Male2_talk.png +0 -0
  73. package/dashboard/public/assets/avatars/Male3_blink.png +0 -0
  74. package/dashboard/public/assets/avatars/Male3_talk.png +0 -0
  75. package/dashboard/public/assets/avatars/Male3_wave.png +0 -0
  76. package/dashboard/public/assets/avatars/Male4_blink.png +0 -0
  77. package/dashboard/public/assets/avatars/Male4_talk.png +0 -0
  78. package/dashboard/public/assets/avatars/Male4_wave.png +0 -0
  79. package/dashboard/public/assets/desks/desktop_set_black_down.png +0 -0
  80. package/dashboard/public/assets/desks/desktop_set_black_down_coding-1.png +0 -0
  81. package/dashboard/public/assets/desks/desktop_set_black_down_coding.png +0 -0
  82. package/dashboard/public/assets/desks/desktop_set_black_up.png +0 -0
  83. package/dashboard/public/assets/desks/desktop_set_white_down.png +0 -0
  84. package/dashboard/public/assets/desks/desktop_set_white_down_coding-1.png +0 -0
  85. package/dashboard/public/assets/desks/desktop_set_white_down_coding.png +0 -0
  86. package/dashboard/public/assets/desks/desktop_set_white_up.png +0 -0
  87. package/dashboard/public/assets/furniture/armchair_tan.png +0 -0
  88. package/dashboard/public/assets/furniture/armchair_tan_down.png +0 -0
  89. package/dashboard/public/assets/furniture/backpack_blue.png +0 -0
  90. package/dashboard/public/assets/furniture/backpack_red.png +0 -0
  91. package/dashboard/public/assets/furniture/blinds.png +0 -0
  92. package/dashboard/public/assets/furniture/blinds_large_closed_white.png +0 -0
  93. package/dashboard/public/assets/furniture/bookshelf.png +0 -0
  94. package/dashboard/public/assets/furniture/bookshelf_purple_tall.png +0 -0
  95. package/dashboard/public/assets/furniture/bulletin_board.png +0 -0
  96. package/dashboard/public/assets/furniture/clock.png +0 -0
  97. package/dashboard/public/assets/furniture/coffee_mug.png +0 -0
  98. package/dashboard/public/assets/furniture/coffee_mug_blue.png +0 -0
  99. package/dashboard/public/assets/furniture/coffee_table.png +0 -0
  100. package/dashboard/public/assets/furniture/coffeepot_right.png +0 -0
  101. package/dashboard/public/assets/furniture/coffeetable_black_horizontal.png +0 -0
  102. package/dashboard/public/assets/furniture/couch.png +0 -0
  103. package/dashboard/public/assets/furniture/couch_tan_down.png +0 -0
  104. package/dashboard/public/assets/furniture/cushion_blue.png +0 -0
  105. package/dashboard/public/assets/furniture/cushion_tan.png +0 -0
  106. package/dashboard/public/assets/furniture/desk_wood.png +0 -0
  107. package/dashboard/public/assets/furniture/fancy_rug.png +0 -0
  108. package/dashboard/public/assets/furniture/fancy_rug_wide.png +0 -0
  109. package/dashboard/public/assets/furniture/flowers1.png +0 -0
  110. package/dashboard/public/assets/furniture/flowers2.png +0 -0
  111. package/dashboard/public/assets/furniture/lamp_tan.png +0 -0
  112. package/dashboard/public/assets/furniture/lantern.png +0 -0
  113. package/dashboard/public/assets/furniture/monstera.png +0 -0
  114. package/dashboard/public/assets/furniture/monstera_small.png +0 -0
  115. package/dashboard/public/assets/furniture/picture_frame.png +0 -0
  116. package/dashboard/public/assets/furniture/plant1.png +0 -0
  117. package/dashboard/public/assets/furniture/plant2.png +0 -0
  118. package/dashboard/public/assets/furniture/plant3.png +0 -0
  119. package/dashboard/public/assets/furniture/plant_poof.png +0 -0
  120. package/dashboard/public/assets/furniture/plant_spindly.png +0 -0
  121. package/dashboard/public/assets/furniture/poster_blue.png +0 -0
  122. package/dashboard/public/assets/furniture/rug.png +0 -0
  123. package/dashboard/public/assets/furniture/succulent_blue.png +0 -0
  124. package/dashboard/public/assets/furniture/succulent_green.png +0 -0
  125. package/dashboard/public/assets/furniture/treasurechest_closed_gold.png +0 -0
  126. package/dashboard/public/assets/furniture/water_cooler_better.png +0 -0
  127. package/dashboard/public/assets/furniture/whiteboard.png +0 -0
  128. package/dashboard/public/assets/furniture/whiteboard_stand_graph.png +0 -0
  129. package/dashboard/public/assets/furniture/window_blinds_open.png +0 -0
  130. package/dashboard/src/App.tsx +46 -0
  131. package/dashboard/src/components/RunDashboardButton.tsx +92 -0
  132. package/dashboard/src/components/SquadCard.tsx +49 -0
  133. package/dashboard/src/components/SquadSelector.tsx +67 -0
  134. package/dashboard/src/components/StatusBadge.tsx +32 -0
  135. package/dashboard/src/components/StatusBar.tsx +116 -0
  136. package/dashboard/src/hooks/useSquadSocket.ts +135 -0
  137. package/dashboard/src/lib/formatTime.ts +16 -0
  138. package/dashboard/src/lib/normalizeState.ts +25 -0
  139. package/dashboard/src/main.tsx +10 -0
  140. package/dashboard/src/office/AgentSprite.ts +241 -0
  141. package/dashboard/src/office/OfficeScene.ts +153 -0
  142. package/dashboard/src/office/PhaserGame.tsx +80 -0
  143. package/dashboard/src/office/RoomBuilder.ts +190 -0
  144. package/dashboard/src/office/assetKeys.ts +150 -0
  145. package/dashboard/src/office/palette.ts +32 -0
  146. package/dashboard/src/plugin/squadWatcher.ts +397 -0
  147. package/dashboard/src/store/useSquadStore.ts +56 -0
  148. package/dashboard/src/styles/globals.css +36 -0
  149. package/dashboard/src/types/state.ts +63 -0
  150. package/dashboard/src/vite-env.d.ts +1 -0
  151. package/dashboard/tsconfig.json +24 -0
  152. package/dashboard/vite.config.ts +13 -0
  153. package/package.json +59 -0
  154. package/public/sfx/slide-transition-sfx.mp3 +0 -0
  155. package/skills/README.md +84 -0
  156. package/skills/apify/SKILL.md +55 -0
  157. package/skills/blotato/SKILL.md +63 -0
  158. package/skills/canva/SKILL.md +60 -0
  159. package/skills/higgsfield/SKILL.md +147 -0
  160. package/skills/image-ai-generator/SKILL.md +124 -0
  161. package/skills/image-ai-generator/scripts/generate.py +175 -0
  162. package/skills/image-creator/SKILL.md +166 -0
  163. package/skills/image-creator/editorial-slide-template.js +645 -0
  164. package/skills/image-fetcher/SKILL.md +91 -0
  165. package/skills/imgbb-uploader/SKILL.md +73 -0
  166. package/skills/imgbb-uploader/scripts/upload.js +125 -0
  167. package/skills/instagram-publisher/README.md +36 -0
  168. package/skills/instagram-publisher/SKILL.md +231 -0
  169. package/skills/instagram-publisher/scripts/publish-playwright.js +418 -0
  170. package/skills/instagram-publisher/scripts/publish.js +521 -0
  171. package/skills/opensquad-agent-creator/SKILL.md +192 -0
  172. package/skills/opensquad-skill-creator/SKILL.md +420 -0
  173. package/skills/opensquad-skill-creator/agents/analyzer.md +274 -0
  174. package/skills/opensquad-skill-creator/agents/comparator.md +202 -0
  175. package/skills/opensquad-skill-creator/agents/grader.md +223 -0
  176. package/skills/opensquad-skill-creator/assets/eval_review.html +146 -0
  177. package/skills/opensquad-skill-creator/eval-viewer/generate_review.py +471 -0
  178. package/skills/opensquad-skill-creator/eval-viewer/viewer.html +1325 -0
  179. package/skills/opensquad-skill-creator/references/schemas.md +430 -0
  180. package/skills/opensquad-skill-creator/references/skill-format.md +235 -0
  181. package/skills/opensquad-skill-creator/scripts/__init__.py +0 -0
  182. package/skills/opensquad-skill-creator/scripts/aggregate_benchmark.py +401 -0
  183. package/skills/opensquad-skill-creator/scripts/quick_validate.py +103 -0
  184. package/skills/opensquad-skill-creator/scripts/run_eval.py +310 -0
  185. package/skills/opensquad-skill-creator/scripts/utils.py +47 -0
  186. package/skills/pdf-extractor/SKILL.md +57 -0
  187. package/skills/pdf-extractor/scripts/extract.py +82 -0
  188. package/skills/resend/SKILL.md +80 -0
  189. package/skills/run-dashboard/README.md +93 -0
  190. package/skills/run-dashboard/SKILL.md +173 -0
  191. package/skills/run-dashboard/scripts/finalize-state.js +273 -0
  192. package/skills/run-dashboard/scripts/generate.js +1296 -0
  193. package/skills/run-dashboard/scripts/serve.js +135 -0
  194. package/skills/run-dashboard/templates/run-dashboard-simple.template.html +191 -0
  195. package/skills/run-dashboard/templates/run-dashboard.template.html +1164 -0
  196. package/skills/smtp-sender/SKILL.md +88 -0
  197. package/skills/smtp-sender/scripts/send.js +478 -0
  198. package/skills/template-designer/SKILL.md +201 -0
  199. package/skills/template-designer/base-templates/model-a.html +27 -0
  200. package/skills/template-designer/base-templates/model-b.html +31 -0
  201. package/skills/template-designer/base-templates/model-c.html +42 -0
  202. package/skills/youtube-publisher/SKILL.md +232 -0
  203. package/skills/youtube-publisher/scripts/publish.js +2078 -0
  204. package/src/agents-cli.js +158 -0
  205. package/src/agents.js +134 -0
  206. package/src/i18n.js +48 -0
  207. package/src/init.js +442 -0
  208. package/src/locales/en.json +79 -0
  209. package/src/locales/es.json +78 -0
  210. package/src/locales/pt-BR.json +78 -0
  211. package/src/logger.js +38 -0
  212. package/src/prompt.js +46 -0
  213. package/src/readme/README.md +146 -0
  214. package/src/runs.js +318 -0
  215. package/src/skills-cli.js +157 -0
  216. package/src/skills.js +146 -0
  217. package/src/supabase-cli.js +584 -0
  218. package/src/update.js +169 -0
  219. package/templates/_opensquad/.opensquad-version +1 -0
  220. package/templates/_opensquad/_investigations/.gitkeep +0 -0
  221. package/templates/ide-templates/antigravity/.agent/rules/opensquad.md +68 -0
  222. package/templates/ide-templates/antigravity/.agent/workflows/opensquad.md +102 -0
  223. package/templates/ide-templates/claude-code/.claude/skills/opensquad/SKILL.md +182 -0
  224. package/templates/ide-templates/claude-code/.mcp.json +8 -0
  225. package/templates/ide-templates/claude-code/CLAUDE.md +57 -0
  226. package/templates/ide-templates/codex/.agents/skills/opensquad/SKILL.md +6 -0
  227. package/templates/ide-templates/codex/AGENTS.md +120 -0
  228. package/templates/ide-templates/cursor/.cursor/commands/opensquad.md +9 -0
  229. package/templates/ide-templates/cursor/.cursor/mcp.json +8 -0
  230. package/templates/ide-templates/cursor/.cursor/rules/opensquad.mdc +62 -0
  231. package/templates/ide-templates/cursor/.cursorignore +3 -0
  232. package/templates/ide-templates/gemini-cli/.gemini/settings.json +8 -0
  233. package/templates/ide-templates/gemini-cli/.gemini/skills/opensquad/SKILL.md +186 -0
  234. package/templates/ide-templates/gemini-cli/GEMINI.md +57 -0
  235. package/templates/ide-templates/opencode/.opencode/commands/opensquad.md +9 -0
  236. package/templates/ide-templates/opencode/AGENTS.md +120 -0
  237. package/templates/ide-templates/qwen-code/.qwen/settings.json +8 -0
  238. package/templates/ide-templates/qwen-code/.qwen/skills/opensquad/SKILL.md +182 -0
  239. package/templates/ide-templates/qwen-code/QWEN.md +57 -0
  240. package/templates/ide-templates/trae/.trae/mcp.json +8 -0
  241. package/templates/ide-templates/trae/.trae/rules/opensquad.md +64 -0
  242. package/templates/ide-templates/vscode-copilot/.github/copilot-instructions.md +59 -0
  243. package/templates/ide-templates/vscode-copilot/.github/prompts/opensquad.prompt.md +209 -0
  244. package/templates/ide-templates/vscode-copilot/.vscode/mcp.json +8 -0
  245. package/templates/ide-templates/vscode-copilot/.vscode/settings.json +3 -0
  246. package/templates/package.json +8 -0
  247. package/templates/squads/.gitkeep +0 -0
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Image Generator — Opensquad Skill
4
+ Generates images via Openrouter API using AI image models.
5
+
6
+ Usage:
7
+ # Single image
8
+ python3 generate.py --prompt "description" --output "path/to/image.jpg" --mode test
9
+
10
+ # Single image with reference (logo/mascot)
11
+ python3 generate.py --prompt "description" --output "path/to/image.jpg" --reference "path/to/logo.jpg" --mode production
12
+
13
+ # Batch (JSON file with list of {prompt, output} objects)
14
+ python3 generate.py --batch "path/to/batch.json" --mode production
15
+ """
16
+
17
+ import argparse
18
+ import base64
19
+ import json
20
+ import os
21
+ import sys
22
+ import time
23
+ import urllib.request
24
+ import urllib.error
25
+
26
+ # Model configuration per mode
27
+ MODELS = {
28
+ "test": "sourceful/riverflow-v2-fast",
29
+ "production": "google/gemini-3.1-flash-image-preview",
30
+ }
31
+
32
+ API_URL = "https://openrouter.ai/api/v1/chat/completions"
33
+
34
+
35
+ def load_api_key():
36
+ """Load OPENROUTER_API_KEY from environment."""
37
+ key = os.environ.get("OPENROUTER_API_KEY")
38
+ if not key:
39
+ # Try loading from .env in project root
40
+ env_candidates = [
41
+ os.path.join(os.getcwd(), ".env"),
42
+ os.path.join(os.path.dirname(__file__), "..", "..", "..", ".env"),
43
+ ]
44
+ for env_path in env_candidates:
45
+ env_path = os.path.abspath(env_path)
46
+ if os.path.exists(env_path):
47
+ with open(env_path, "r") as f:
48
+ for line in f:
49
+ line = line.strip()
50
+ if line.startswith("OPENROUTER_API_KEY=") and not line.startswith("#"):
51
+ key = line.split("=", 1)[1].strip().strip('"').strip("'")
52
+ break
53
+ if key:
54
+ break
55
+ if not key:
56
+ print("ERROR: OPENROUTER_API_KEY not found in environment or .env file", file=sys.stderr)
57
+ sys.exit(1)
58
+ return key
59
+
60
+
61
+ def generate_image(prompt, output_path, mode, api_key, reference_image=None):
62
+ """Generate a single image and save to output_path."""
63
+ model = MODELS.get(mode, MODELS["test"])
64
+
65
+ os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True)
66
+
67
+ if reference_image and os.path.exists(reference_image):
68
+ # Multimodal: send reference image + text prompt
69
+ ext = os.path.splitext(reference_image)[1].lower()
70
+ mime_map = {".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".png": "image/png", ".webp": "image/webp", ".gif": "image/gif"}
71
+ mime = mime_map.get(ext, "image/jpeg")
72
+ with open(reference_image, "rb") as img_f:
73
+ img_b64 = base64.b64encode(img_f.read()).decode("utf-8")
74
+ content = [
75
+ {"type": "image_url", "image_url": {"url": f"data:{mime};base64,{img_b64}"}},
76
+ {"type": "text", "text": f"Generate an image using the logo/mascot shown in the reference image above. {prompt}. Only output the image, no text."}
77
+ ]
78
+ else:
79
+ content = f"Generate an image: {prompt}. Only output the image, no text."
80
+
81
+ payload = json.dumps({
82
+ "model": model,
83
+ "messages": [{
84
+ "role": "user",
85
+ "content": content
86
+ }]
87
+ }).encode("utf-8")
88
+
89
+ req = urllib.request.Request(
90
+ API_URL,
91
+ data=payload,
92
+ headers={
93
+ "Authorization": f"Bearer {api_key}",
94
+ "Content-Type": "application/json",
95
+ },
96
+ )
97
+
98
+ try:
99
+ with urllib.request.urlopen(req, timeout=120) as resp:
100
+ data = json.loads(resp.read().decode("utf-8"))
101
+ except urllib.error.HTTPError as e:
102
+ error_body = e.read().decode("utf-8", errors="replace")
103
+ print(f" API error [{e.code}]: {error_body[:200]}", file=sys.stderr)
104
+ return False
105
+ except Exception as e:
106
+ print(f" Request error: {e}", file=sys.stderr)
107
+ return False
108
+
109
+ images = data.get("choices", [{}])[0].get("message", {}).get("images", [])
110
+ if not images:
111
+ # Some models return image in content as base64
112
+ content_resp = data.get("choices", [{}])[0].get("message", {}).get("content", "")
113
+ if content_resp and isinstance(content_resp, str) and content_resp.startswith("data:image"):
114
+ img_data = content_resp.split(",", 1)[1] if "," in content_resp else content_resp
115
+ else:
116
+ print(f" No image returned by model {model}", file=sys.stderr)
117
+ return False
118
+ else:
119
+ img_data = images[0].get("image_url", {}).get("url", "")
120
+ if img_data.startswith("data:"):
121
+ img_data = img_data.split(",", 1)[1]
122
+
123
+ with open(output_path, "wb") as f:
124
+ f.write(base64.b64decode(img_data))
125
+
126
+ size_kb = os.path.getsize(output_path) / 1024
127
+ print(f" OK: {output_path} ({size_kb:.0f} KB)")
128
+ return True
129
+
130
+
131
+ def main():
132
+ parser = argparse.ArgumentParser(description="Generate images via Openrouter API")
133
+ parser.add_argument("--prompt", help="Text prompt for single image generation")
134
+ parser.add_argument("--output", help="Output file path for single image")
135
+ parser.add_argument("--batch", help="Path to JSON batch file")
136
+ parser.add_argument("--mode", choices=["test", "production"], default="test",
137
+ help="Generation mode: test (cheap) or production (high-quality)")
138
+ parser.add_argument("--reference", help="Path to reference image to include in the prompt")
139
+ args = parser.parse_args()
140
+
141
+ if not args.prompt and not args.batch:
142
+ parser.error("Either --prompt or --batch is required")
143
+
144
+ api_key = load_api_key()
145
+ model = MODELS[args.mode]
146
+ print(f"Image Generator — Mode: {args.mode} | Model: {model}")
147
+
148
+ if args.batch:
149
+ # Batch mode
150
+ with open(args.batch, "r") as f:
151
+ items = json.load(f)
152
+ print(f"Generating {len(items)} images...\n")
153
+ success = 0
154
+ for i, item in enumerate(items, 1):
155
+ prompt = item["prompt"]
156
+ output = item["output"]
157
+ ref = item.get("reference")
158
+ print(f"[{i}/{len(items)}] {os.path.basename(output)}...")
159
+ if generate_image(prompt, output, args.mode, api_key, reference_image=ref):
160
+ success += 1
161
+ if i < len(items):
162
+ time.sleep(1) # Rate limiting
163
+ print(f"\nDone: {success}/{len(items)} images generated.")
164
+ sys.exit(0 if success == len(items) else 1)
165
+ else:
166
+ # Single mode
167
+ if not args.output:
168
+ parser.error("--output is required for single image generation")
169
+ print(f"Generating: {os.path.basename(args.output)}...")
170
+ ok = generate_image(args.prompt, args.output, args.mode, api_key, reference_image=args.reference)
171
+ sys.exit(0 if ok else 1)
172
+
173
+
174
+ if __name__ == "__main__":
175
+ main()
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: image-creator
3
+ description: >
4
+ Renders HTML/CSS into production-ready images via Playwright.
5
+ Accepts complete HTML content, opens it in a headless browser at
6
+ the specified viewport, and captures a pixel-perfect screenshot.
7
+ Generic engine -- any visual format is defined by the HTML template.
8
+ description_pt-BR: >
9
+ Renderiza HTML/CSS em imagens prontas para produção via Playwright.
10
+ Aceita conteúdo HTML completo, abre em um navegador headless na
11
+ viewport especificada e captura uma screenshot pixel-perfect.
12
+ Motor genérico -- qualquer formato visual é definido pelo template HTML.
13
+ description_es: >
14
+ Renderiza HTML/CSS en imágenes listas para producción vía Playwright.
15
+ Acepta contenido HTML completo, lo abre en un navegador headless en
16
+ el viewport especificado y captura una screenshot pixel-perfect.
17
+ Motor genérico -- cualquier formato visual se define por el template HTML.
18
+ type: mcp
19
+ version: "1.0.0"
20
+ mcp:
21
+ server_name: playwright
22
+ categories: [design, automation, images]
23
+ ---
24
+
25
+ # Image Creator
26
+
27
+ ## When to use
28
+
29
+ Use the Visual Renderer when you need to generate production-ready images from HTML/CSS. This skill uses Playwright to render complete, self-contained HTML files in a headless browser and capture pixel-perfect screenshots. It is the primary engine for creating social media graphics, carousel slides, infographics, and any other visual content defined by HTML templates.
30
+
31
+ ## Instructions
32
+
33
+ ### Core Workflow
34
+
35
+ 1. **Generate HTML** -- Write a complete, self-contained HTML file with inline CSS. The HTML IS the design -- all styling, layout, fonts, colors, and content must be embedded.
36
+
37
+ 2. **Save HTML** -- Write the HTML file to the squad's output folder (e.g., `output/slides/slide-01.html`)
38
+
39
+ 3. **Start HTTP server** -- Before rendering, start a local HTTP server in the squad's output folder:
40
+ ```bash
41
+ python -m http.server 8765 --directory "OUTPUT_DIR" &
42
+ for i in $(seq 1 30); do curl -s http://localhost:8765 > /dev/null 2>&1 && break || sleep 0.1; done
43
+ ```
44
+ Replace OUTPUT_DIR with the actual absolute path to the output folder (quote paths that contain spaces).
45
+
46
+ 4. **Render** -- Use Playwright to:
47
+ - `browser_navigate` to `http://localhost:8765/slide-01.html` (filename only, not full path)
48
+ - `browser_resize` to target viewport dimensions
49
+ - `browser_take_screenshot` to save as JPG or PNG
50
+
51
+ 5. **Verify** -- Read the screenshot to confirm quality. Re-render if needed.
52
+
53
+ Before accepting the render, explicitly check that hero title, subtitle, and CTA text are fully visible inside the canvas. If any line clips, collides, or sits too close to the edge, edit the HTML first: shorten the copy or reduce the affected font size in small steps while staying above the platform minimums below. Never accept a cropped title/subtitle as a valid render.
54
+
55
+ For slide-based news squads that use the standardized opening/closing layout, prefer the shared helper in `skills/image-creator/editorial-slide-template.js` so title fitting, margin protection, and the editorial frame stay consistent across runs.
56
+ When `_build/discovery.yaml` provides `company.communication_channels`, preserve those entries in the run artifacts and downstream descriptions/footers. The default closing slide should stay visually clean and point to the description/footer for brand links; only render visible channel cards on the closing slide when the user or the squad instructions explicitly ask for that override.
57
+ The shared closing slide must stay self-contained. Never depend on remote QR generators or any other network-fetched asset to render the final JPG/PNG. If the main source needs emphasis on-canvas, use a local text/card treatment and keep the full links in `content-package.md`, YouTube descriptions, and newsletter/footer outputs.
58
+ Keep the exported slide artwork static. If a YouTube slideshow needs a temporal progress indicator, that overlay belongs to the shared video publisher, not to the rendered JPG/PNG slide files.
59
+ If the batch uses visible slide pagination, verify that the numbering reflects the full slide set rather than only the editorial middle subset.
60
+
61
+ 6. **Stop server** -- After all slides are rendered, stop the HTTP server:
62
+ ```bash
63
+ pkill -f "http.server 8765" 2>/dev/null || true
64
+ ```
65
+
66
+ ### Viewport Presets (width x height)
67
+
68
+ Use these standard dimensions:
69
+ - Instagram Post: 1080 x 1080
70
+ - Instagram Carousel: 1080 x 1440
71
+ - Instagram Story/Reel: 1080 x 1920
72
+ - Facebook Post: 1200 x 630
73
+ - Twitter/X Post: 1200 x 675
74
+ - LinkedIn Post: 1200 x 627
75
+ - YouTube Thumbnail: 1280 x 720
76
+ - Custom: as specified by the squad
77
+
78
+ ### HTML Template Guidelines
79
+
80
+ The HTML you generate MUST:
81
+ - Be self-contained (inline CSS, no external dependencies)
82
+ - Use web-safe fonts OR Google Fonts via `@import`
83
+ - Embed images as absolute paths or base64 data URIs
84
+ - Set exact body dimensions matching the viewport
85
+ - Use `margin: 0; padding: 0; overflow: hidden` on body
86
+ - Account for device pixel ratio if high-res needed
87
+
88
+ Example minimal structure:
89
+ ```html
90
+ <!DOCTYPE html>
91
+ <html>
92
+ <head>
93
+ <meta charset="UTF-8">
94
+ <style>
95
+ * { margin: 0; padding: 0; box-sizing: border-box; }
96
+ body { width: 1080px; height: 1440px; overflow: hidden; }
97
+ /* ... your design ... */
98
+ </style>
99
+ </head>
100
+ <body>
101
+ <!-- Your content -->
102
+ </body>
103
+ </html>
104
+ ```
105
+
106
+ ### Batch Rendering (Carousels/Multi-slide)
107
+
108
+ For multi-image outputs like carousels:
109
+ 1. Generate one HTML file per slide
110
+ 2. Start the HTTP server **once** before the batch (step 3 of Core Workflow)
111
+ 3. Render each slide sequentially (step 4 repeated per slide)
112
+ 4. Stop the HTTP server **once** after all slides are done (step 6 of Core Workflow)
113
+ 5. Name output files with zero-padded numbers: `slide-01.jpg` / `slide-01.png`, `slide-02.jpg` / `slide-02.png`, etc., matching the format chosen for that batch
114
+ 6. Keep all slides at the same viewport dimensions
115
+
116
+ ### Best Practices
117
+
118
+ - Always verify the first rendered image before batch rendering
119
+ - For multi-line hero blocks, treat text fit as a preflight gate: if title/subtitle overflow, fix the HTML before rendering the remaining slides
120
+ - Use CSS Grid/Flexbox for layout -- most reliable across renderers
121
+ - Avoid animations/transitions (static screenshot only)
122
+ - For rounded corners on images, use CSS `border-radius` + `overflow`
123
+ - For emoji rendering, rely on system fonts (Windows: Segoe UI Emoji)
124
+ - Test text overflow -- ensure no content is clipped unexpectedly
125
+ - Keep HTML files alongside output JPG/PNG files for easy re-rendering
126
+ - Default to JPG for social/email batches unless the squad step explicitly asks for PNG; both JPG and PNG are accepted by the shared Opensquad publish flow
127
+ - When a standardized opening slide uses a project name as the hero, fit it before rendering so the title preserves left and right padding; do not accept a title touching the frame edge
128
+
129
+ ### Typography & Readability Rules
130
+
131
+ Text must be legible in the target platform's smallest viewing context (mobile feed for social platforms). Text inside linked or embedded image files (JPG, JPEG, base64 assets) is decorative and exempt. All HTML text nodes and inline SVG text are subject to these rules.
132
+
133
+ These are HARD minimums -- never go below them for readable text.
134
+
135
+ #### Minimum Font Sizes by Platform
136
+
137
+ | Text Role | Instagram Post/Carousel | Instagram Story/Reel | LinkedIn/Facebook | YouTube Thumb |
138
+ |------------------|------------------------|----------------------|-------------------|---------------|
139
+ | Hero / Display | 58px | 56px | 40px | 60px |
140
+ | Heading | 43px | 42px | 32px | 36px |
141
+ | Body / Bullets | 34px | 32px | 24px | 36px |
142
+ | Caption / Footer | 24px | 20px | 20px | 32px |
143
+
144
+ **Universal rule**: No text element meant to be read may use a font size smaller than 20px, on any platform.
145
+
146
+ #### Font Weight
147
+
148
+ - Body text and above: use font-weight 500+ (medium/semibold/bold)
149
+ - Caption text: font-weight 500+ strongly recommended; 400 only with explicit high-contrast background (4.5:1 ratio minimum)
150
+ - Avoid thin/light weights (100-300) for any readable text
151
+
152
+ #### Verification Checklist
153
+
154
+ Before calling `browser_take_screenshot`, scan your HTML and confirm:
155
+ - All text elements use explicit px sizes (not em/rem that could resolve smaller)
156
+ - No heading is below the Heading minimum for the target platform
157
+ - No body/bullet text is below the Body minimum
158
+ - No footer or metadata text is below the Caption minimum
159
+ - No readable text uses font-weight below 500 (caption at 400 only with 4.5:1 contrast background)
160
+
161
+ ## Available operations
162
+
163
+ - **Render HTML to JPG/PNG** -- Convert self-contained HTML/CSS into a pixel-perfect screenshot
164
+ - **Batch Render** -- Render multiple slides/pages sequentially for carousels and multi-image content
165
+ - **Viewport Resize** -- Set precise viewport dimensions for any target platform
166
+ - **Quality Verification** -- Visually inspect rendered output and re-render if needed