Skip to content

Commit e10402a

Browse files
committed
chore: pre-commit
chore: pre-commit
1 parent 7f2e885 commit e10402a

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

.github/scripts/generate-icon-prompts.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ def parse_readme_frontmatter(readme_path):
7878
"""Extract YAML frontmatter from README.md"""
7979
with open(readme_path, 'r', encoding='utf-8') as f:
8080
content = f.read()
81-
81+
8282
if not content.startswith('---'):
8383
return None
84-
84+
8585
# Extract frontmatter between --- delimiters
8686
parts = content.split('---', 2)
8787
if len(parts) < 3:
8888
return None
89-
89+
9090
try:
9191
frontmatter = yaml.safe_load(parts[1])
9292
return frontmatter
@@ -105,16 +105,16 @@ def get_platform_from_frontmatter(frontmatter):
105105
def generate_icon_prompt(name, platform, description):
106106
"""Generate an AI image generation prompt for an icon"""
107107
platform_colors = PLATFORM_COLORS.get(platform)
108-
108+
109109
if not platform_colors:
110110
# Fallback to generic bright colors
111111
color_scheme = "bright, vibrant colors"
112112
else:
113113
color_scheme = platform_colors["name"]
114-
114+
115115
# Clean up description
116116
clean_description = description.strip().replace('\n', ' ')
117-
117+
118118
# Generate AI prompt
119119
ai_prompt = f"""Create a professional flat design icon for the meshcloud Building Block ecosystem.
120120
@@ -123,7 +123,6 @@ def generate_icon_prompt(name, platform, description):
123123
Visual Style:
124124
- Plain white background (#FFFFFF) for easy removal in post-processing
125125
- Background will be converted to transparent (see post-processing steps)
126-
- Use meshcloud blue (#2563eb) as primary color
127126
- Use {color_scheme} as accent colors
128127
- Maximum 2-3 colors total
129128
- Simple geometric shapes with clean lines
@@ -139,7 +138,7 @@ def generate_icon_prompt(name, platform, description):
139138
140139
Style: Enterprise professional, instantly recognizable at small sizes, similar to app icons or logos.
141140
Dimensions: 800x800 pixels"""
142-
141+
143142
# Generate post-processing instructions
144143
post_processing = """**Step 1: Remove white background with GIMP (free)**
145144
@@ -163,7 +162,7 @@ def generate_icon_prompt(name, platform, description):
163162
- This reduces file size by 60-80% while maintaining quality
164163
165164
**Target specs:** 800x800px PNG with transparent background, under 100KB"""
166-
165+
167166
return {
168167
'ai_prompt': ai_prompt,
169168
'post_processing': post_processing
@@ -172,23 +171,23 @@ def generate_icon_prompt(name, platform, description):
172171
def find_missing_logos(modules_dir):
173172
"""Find all buildingblock directories missing logo.png"""
174173
missing = []
175-
174+
176175
for root, dirs, files in os.walk(modules_dir):
177176
if 'buildingblock' in root:
178177
buildingblock_path = Path(root)
179178
readme_path = buildingblock_path / 'README.md'
180179
logo_path = buildingblock_path / 'logo.png'
181-
180+
182181
if readme_path.exists() and not logo_path.exists():
183182
frontmatter = parse_readme_frontmatter(readme_path)
184183
if frontmatter:
185184
platform = get_platform_from_frontmatter(frontmatter)
186185
name = frontmatter.get('name', 'Unknown')
187186
description = frontmatter.get('description', '')
188-
187+
189188
# Get relative path from modules directory
190189
rel_path = buildingblock_path.relative_to(modules_dir)
191-
190+
192191
missing.append({
193192
'path': str(rel_path),
194193
'name': name,
@@ -197,21 +196,21 @@ def find_missing_logos(modules_dir):
197196
'readme_path': str(readme_path),
198197
'logo_path': str(logo_path)
199198
})
200-
199+
201200
return missing
202201

203202
def main():
204203
# Get modules directory
205204
repo_root = Path(__file__).parent.parent.parent
206205
modules_dir = repo_root / 'modules'
207-
206+
208207
if not modules_dir.exists():
209208
print(f"ERROR: Modules directory not found: {modules_dir}", file=sys.stderr)
210209
sys.exit(1)
211-
210+
212211
# Find missing logos
213212
missing_logos = find_missing_logos(modules_dir)
214-
213+
215214
# Generate prompts for each missing logo
216215
results = []
217216
for item in missing_logos:
@@ -220,7 +219,7 @@ def main():
220219
item['platform'] or 'generic',
221220
item['description']
222221
)
223-
222+
224223
results.append({
225224
'name': item['name'],
226225
'platform': item['platform'],
@@ -229,7 +228,7 @@ def main():
229228
'ai_prompt': prompt_data['ai_prompt'],
230229
'post_processing': prompt_data['post_processing']
231230
})
232-
231+
233232
# Output as JSON for GitHub Action to consume
234233
print(json.dumps(results, indent=2))
235234

0 commit comments

Comments
 (0)