jekyll-theme-zer0 0.7.2 → 0.8.1

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -0
  3. data/README.md +33 -4
  4. data/_plugins/preview_image_generator.rb +258 -0
  5. data/_plugins/theme_version.rb +88 -0
  6. data/assets/images/previews/git-workflow-best-practices-for-modern-teams.png +0 -0
  7. data/scripts/README.md +443 -0
  8. data/scripts/analyze-commits.sh +313 -0
  9. data/scripts/build +115 -0
  10. data/scripts/build.sh +33 -0
  11. data/scripts/build.sh.legacy +174 -0
  12. data/scripts/example-usage.sh +102 -0
  13. data/scripts/fix-markdown-format.sh +265 -0
  14. data/scripts/gem-publish.sh +42 -0
  15. data/scripts/gem-publish.sh.legacy +700 -0
  16. data/scripts/generate-preview-images.sh +846 -0
  17. data/scripts/install-preview-generator.sh +531 -0
  18. data/scripts/lib/README.md +263 -0
  19. data/scripts/lib/changelog.sh +313 -0
  20. data/scripts/lib/common.sh +154 -0
  21. data/scripts/lib/gem.sh +226 -0
  22. data/scripts/lib/git.sh +205 -0
  23. data/scripts/lib/preview_generator.py +646 -0
  24. data/scripts/lib/test/run_tests.sh +140 -0
  25. data/scripts/lib/test/test_changelog.sh +87 -0
  26. data/scripts/lib/test/test_gem.sh +68 -0
  27. data/scripts/lib/test/test_git.sh +82 -0
  28. data/scripts/lib/test/test_validation.sh +72 -0
  29. data/scripts/lib/test/test_version.sh +96 -0
  30. data/scripts/lib/validation.sh +139 -0
  31. data/scripts/lib/version.sh +178 -0
  32. data/scripts/release +240 -0
  33. data/scripts/release.sh +33 -0
  34. data/scripts/release.sh.legacy +342 -0
  35. data/scripts/setup.sh +155 -0
  36. data/scripts/test-auto-version.sh +260 -0
  37. data/scripts/test-mermaid.sh +251 -0
  38. data/scripts/test.sh +156 -0
  39. data/scripts/version.sh +152 -0
  40. metadata +37 -1
data/scripts/README.md ADDED
@@ -0,0 +1,443 @@
1
+ # Gem Automation Scripts
2
+
3
+ This directory contains automation scripts for managing the `jekyll-theme-zer0` gem lifecycle and feature modules.
4
+
5
+ ## Scripts Overview
6
+
7
+ ### 🖼️ `generate-preview-images.sh` (Feature: ZER0-003)
8
+ AI-powered preview image generator for Jekyll posts and content.
9
+
10
+ **Usage:**
11
+ ```bash
12
+ ./scripts/generate-preview-images.sh [options]
13
+ ```
14
+
15
+ **Examples:**
16
+ ```bash
17
+ ./scripts/generate-preview-images.sh --list-missing # List files missing previews
18
+ ./scripts/generate-preview-images.sh --dry-run # Preview without changes
19
+ ./scripts/generate-preview-images.sh --collection posts # Generate for posts only
20
+ ./scripts/generate-preview-images.sh -f path/to/file.md # Process specific file
21
+ ./scripts/generate-preview-images.sh --provider openai # Use OpenAI DALL-E
22
+ ```
23
+
24
+ **Configuration:**
25
+ Settings in `_config.yml` under `preview_images` section:
26
+ ```yaml
27
+ preview_images:
28
+ enabled: true
29
+ provider: openai
30
+ model: dall-e-3
31
+ size: "1792x1024"
32
+ style: "retro pixel art, 8-bit video game aesthetic"
33
+ output_dir: assets/images/previews
34
+ ```
35
+
36
+ **See:** [Preview Image Generator Documentation](/docs/features/preview-image-generator.md)
37
+
38
+ ### 📦 `install-preview-generator.sh`
39
+ Installer for the AI Preview Image Generator feature.
40
+
41
+ **Usage:**
42
+ ```bash
43
+ # Remote installation (for other Jekyll sites)
44
+ curl -fsSL https://raw.githubusercontent.com/bamr87/zer0-mistakes/main/scripts/install-preview-generator.sh | bash
45
+
46
+ # Local installation with options
47
+ ./scripts/install-preview-generator.sh [options]
48
+ ```
49
+
50
+ **Options:**
51
+ - `-d, --dry-run` - Preview what would be installed
52
+ - `-f, --force` - Overwrite existing files
53
+ - `-p, --provider PROVIDER` - Set default AI provider
54
+ - `--no-config` - Skip _config.yml modification
55
+ - `--no-tasks` - Skip VS Code tasks installation
56
+
57
+ ### 🚀 `setup.sh`
58
+ Sets up the development environment for gem development.
59
+
60
+ **Usage:**
61
+ ```bash
62
+ ./scripts/setup.sh
63
+ ```
64
+
65
+ **What it does:**
66
+ - Checks system requirements (Ruby, Bundler, jq, Git)
67
+ - Installs dependencies
68
+ - Makes scripts executable
69
+ - Validates gemspec
70
+ - Creates CHANGELOG.md if missing
71
+ - Sets up Git hooks for validation
72
+ - Updates .gitignore for gem development
73
+
74
+ ### 📈 `version.sh`
75
+ Manages semantic versioning of the gem.
76
+
77
+ **Usage:**
78
+ ```bash
79
+ ./scripts/version.sh [patch|minor|major] [--dry-run]
80
+ ```
81
+
82
+ **Examples:**
83
+ ```bash
84
+ ./scripts/version.sh patch # 0.1.8 → 0.1.9
85
+ ./scripts/version.sh minor # 0.1.8 → 0.2.0
86
+ ./scripts/version.sh major # 0.1.8 → 1.0.0
87
+ ./scripts/version.sh patch --dry-run # Preview changes without applying
88
+ ```
89
+
90
+ **What it does:**
91
+ - Validates working directory is clean
92
+ - Updates version in `package.json`
93
+ - Updates `CHANGELOG.md` if it exists
94
+ - Creates git commit with version bump
95
+ - Creates git tag (`v{version}`)
96
+
97
+ ### 🔨 `build.sh`
98
+ Builds and optionally publishes the gem.
99
+
100
+ **Usage:**
101
+ ```bash
102
+ ./scripts/build.sh [--publish] [--dry-run]
103
+ ```
104
+
105
+ **Examples:**
106
+ ```bash
107
+ ./scripts/build.sh # Build gem only
108
+ ./scripts/build.sh --publish # Build and publish to RubyGems
109
+ ./scripts/build.sh --publish --dry-run # Preview publish process
110
+ ```
111
+
112
+ **What it does:**
113
+ - Validates dependencies and gemspec
114
+ - Builds the gem file
115
+ - Shows gem contents for verification
116
+ - Optionally publishes to RubyGems (with confirmation)
117
+
118
+ ### 🧪 `test.sh`
119
+ Runs comprehensive tests and validations.
120
+
121
+ **Usage:**
122
+ ```bash
123
+ ./scripts/test.sh [--verbose]
124
+ ```
125
+
126
+ **What it tests:**
127
+ - `package.json` syntax and version format
128
+ - Gemspec syntax and validity
129
+ - Required files existence
130
+ - YAML front matter in layouts
131
+ - Jekyll dependencies
132
+ - Version consistency
133
+ - Script permissions
134
+ - Bundle install capability
135
+
136
+ ## Development Workflow
137
+
138
+ ### Initial Setup
139
+ ```bash
140
+ # Clone the repository
141
+ git clone https://github.com/bamr87/zer0-mistakes.git
142
+ cd zer0-mistakes
143
+
144
+ # Set up development environment
145
+ ./scripts/setup.sh
146
+ ```
147
+
148
+ ### Making Changes
149
+ ```bash
150
+ # Make your changes to the theme files
151
+
152
+ # Run tests to validate changes
153
+ ./scripts/test.sh
154
+
155
+ # If tests pass, bump version
156
+ ./scripts/version.sh patch
157
+
158
+ # Build the gem
159
+ ./scripts/build.sh
160
+
161
+ # Publish to RubyGems (when ready)
162
+ ./scripts/build.sh --publish
163
+ ```
164
+
165
+ ### Automated Workflows
166
+ The project includes GitHub Actions workflows for automation:
167
+
168
+ #### CI Workflow (`.github/workflows/ci.yml`)
169
+ - Triggers on: Push to main/develop, Pull Requests
170
+ - Tests on multiple Ruby versions (2.7, 3.0, 3.1, 3.2)
171
+ - Runs linting and security scans
172
+ - Validates gem building
173
+
174
+ #### Release Workflow (`.github/workflows/gem-release.yml`)
175
+ - Triggers on: Git tags (`v*`), Manual dispatch
176
+ - Builds and tests the gem
177
+ - Publishes to RubyGems (production environment)
178
+ - Creates GitHub release with gem attached
179
+
180
+ #### Version Bump Workflow (`.github/workflows/version-bump.yml`)
181
+ - Manual trigger with version type selection
182
+ - Runs tests before bumping
183
+ - Creates version bump commit and tag
184
+ - Optionally creates PR for review
185
+
186
+ ## Requirements
187
+
188
+ ### System Dependencies
189
+ - **Ruby**: >= 2.7.0
190
+ - **Bundler**: For dependency management
191
+ - **jq**: For JSON processing
192
+ - **Git**: For version control
193
+
194
+ ### RubyGems Publishing Setup
195
+ To publish gems, you need:
196
+
197
+ 1. **RubyGems account**: Sign up at [rubygems.org](https://rubygems.org)
198
+ 2. **API key**: Get from your RubyGems account settings
199
+ 3. **GitHub secret**: Add `RUBYGEMS_API_KEY` to repository secrets
200
+
201
+ ### Local Authentication
202
+ ```bash
203
+ # Sign in to RubyGems locally
204
+ gem signin
205
+
206
+ # Verify authentication
207
+ gem whoami
208
+ ```
209
+
210
+ ## CI/CD Integration
211
+
212
+ The automation system is designed for complete CI/CD integration:
213
+
214
+ ### Local Development
215
+ 1. **Setup**: `./scripts/setup.sh`
216
+ 2. **Development**: Make changes
217
+ 3. **Testing**: `./scripts/test.sh`
218
+ 4. **Version**: `./scripts/version.sh`
219
+ 5. **Build**: `./scripts/build.sh`
220
+
221
+ ### Automated Release
222
+ 1. **Manual trigger**: Version bump workflow
223
+ 2. **Automatic testing**: CI workflow validates changes
224
+ 3. **Tag creation**: Creates version tag
225
+ 4. **Release build**: Gem release workflow triggers
226
+ 5. **Publication**: Automatic publishing to RubyGems
227
+
228
+ ## Error Handling
229
+
230
+ ### Common Issues
231
+
232
+ #### "Working directory is not clean"
233
+ ```bash
234
+ # Check status
235
+ git status
236
+
237
+ # Commit or stash changes
238
+ git add .
239
+ git commit -m "Your changes"
240
+ ```
241
+
242
+ #### "Not authenticated with RubyGems"
243
+ ```bash
244
+ # Sign in to RubyGems
245
+ gem signin
246
+
247
+ # Or set up API key
248
+ echo ":rubygems_api_key: YOUR_API_KEY" > ~/.gem/credentials
249
+ chmod 600 ~/.gem/credentials
250
+ ```
251
+
252
+ #### "jq command not found"
253
+ ```bash
254
+ # macOS
255
+ brew install jq
256
+
257
+ # Ubuntu/Debian
258
+ sudo apt-get install jq
259
+ ```
260
+
261
+ #### "Gemspec validation failed"
262
+ ```bash
263
+ # Check gemspec syntax
264
+ gem specification jekyll-theme-zer0.gemspec
265
+
266
+ # Common fixes:
267
+ # - Ensure all required files exist
268
+ # - Check Ruby version compatibility
269
+ # - Validate dependency versions
270
+ ```
271
+
272
+ ## Best Practices
273
+
274
+ ### Version Management
275
+ - **Patch**: Bug fixes, small improvements
276
+ - **Minor**: New features, backward compatible
277
+ - **Major**: Breaking changes
278
+
279
+ ### Testing
280
+ - Always run tests before version bumps
281
+ - Use `--dry-run` to preview changes
282
+ - Test builds before publishing
283
+
284
+ ### Git Workflow
285
+ - Keep working directory clean
286
+ - Use descriptive commit messages
287
+ - Tag releases consistently
288
+
289
+ ### Security
290
+ - Never commit API keys
291
+ - Use GitHub secrets for CI/CD
292
+ - Regularly update dependencies
293
+
294
+ ## Monitoring and Maintenance
295
+
296
+ ### Regular Tasks
297
+ - **Weekly**: Run `./scripts/test.sh` to catch issues early
298
+ - **Monthly**: Review and update dependencies
299
+ - **Per release**: Monitor RubyGems downloads and feedback
300
+
301
+ ### Monitoring Points
302
+ - **CI/CD status**: GitHub Actions dashboard
303
+ - **Gem stats**: RubyGems.org gem page
304
+ - **Security**: Dependabot alerts
305
+ - **Performance**: Build times and test results
306
+
307
+ ## Troubleshooting
308
+
309
+ ### Debug Mode
310
+ Most scripts support verbose output:
311
+ ```bash
312
+ ./scripts/test.sh --verbose
313
+ ./scripts/build.sh --dry-run
314
+ ```
315
+
316
+ ### Manual Recovery
317
+ If automation fails, you can manually:
318
+ ```bash
319
+ # Reset version
320
+ git checkout package.json
321
+ git reset HEAD~1
322
+
323
+ # Rebuild gem
324
+ rm -f *.gem
325
+ gem build jekyll-theme-zer0.gemspec
326
+
327
+ # Force push (use with caution)
328
+ git push --force-with-lease
329
+ ```
330
+
331
+ ## Contributing
332
+
333
+ When contributing to the automation system:
334
+
335
+ 1. **Test thoroughly**: Run all scripts with `--dry-run` first
336
+ 2. **Update documentation**: Reflect changes in this README
337
+ 3. **Follow conventions**: Match existing script patterns
338
+ 4. **Error handling**: Include proper error messages and exit codes
339
+ 5. **Backwards compatibility**: Ensure existing workflows continue working
340
+
341
+ ---
342
+
343
+ ## 🎨 `generate-preview-images.sh`
344
+
345
+ AI-powered preview image generator for Jekyll posts, articles, and quests. Automatically scans content files, detects missing preview images, and generates them using AI providers (OpenAI DALL-E, Stability AI).
346
+
347
+ ### Usage
348
+
349
+ ```bash
350
+ # List all files missing preview images
351
+ ./scripts/generate-preview-images.sh --list-missing
352
+
353
+ # Dry run to see what would be generated
354
+ ./scripts/generate-preview-images.sh --dry-run --verbose
355
+
356
+ # Generate images for posts collection
357
+ ./scripts/generate-preview-images.sh --collection posts
358
+
359
+ # Generate image for a specific file
360
+ ./scripts/generate-preview-images.sh -f pages/_posts/my-article.md
361
+
362
+ # Force regenerate all images
363
+ ./scripts/generate-preview-images.sh --force
364
+
365
+ # Use different AI provider
366
+ ./scripts/generate-preview-images.sh --provider stability
367
+ ```
368
+
369
+ ### Options
370
+
371
+ | Option | Description |
372
+ |--------|-------------|
373
+ | `-h, --help` | Show help message |
374
+ | `-d, --dry-run` | Preview without making changes |
375
+ | `-v, --verbose` | Enable verbose output |
376
+ | `-f, --file FILE` | Process a specific file only |
377
+ | `-c, --collection NAME` | Process collection (posts, quickstart, docs, all) |
378
+ | `-p, --provider PROVIDER` | AI provider: openai, stability, local |
379
+ | `--output-dir DIR` | Output directory (default: assets/images/previews) |
380
+ | `--force` | Regenerate even if preview exists |
381
+ | `--list-missing` | Only list files with missing previews |
382
+
383
+ ### Environment Variables
384
+
385
+ | Variable | Required | Description |
386
+ |----------|----------|-------------|
387
+ | `OPENAI_API_KEY` | For OpenAI | OpenAI API key for DALL-E |
388
+ | `STABILITY_API_KEY` | For Stability | Stability AI API key |
389
+ | `IMAGE_STYLE` | No | Custom style prompt |
390
+ | `IMAGE_SIZE` | No | Image dimensions (default: 1024x1024) |
391
+ | `IMAGE_MODEL` | No | OpenAI model (default: dall-e-3) |
392
+
393
+ ### AI Agent Integration
394
+
395
+ The script is designed to integrate with AI agents for automated content management:
396
+
397
+ 1. **Content Analysis**: Extracts title, description, categories, and content to generate meaningful prompts
398
+ 2. **Smart Prompts**: Creates detailed image generation prompts based on article content
399
+ 3. **Front Matter Updates**: Automatically updates the markdown file with the new preview path
400
+ 4. **Idempotent**: Won't regenerate images that already exist (unless `--force`)
401
+
402
+ ### Python Alternative
403
+
404
+ A Python version is available at `scripts/lib/preview_generator.py` with additional features:
405
+
406
+ ```bash
407
+ # Install dependencies
408
+ pip install openai pyyaml requests
409
+
410
+ # Run Python version
411
+ python3 scripts/lib/preview_generator.py --collection posts --dry-run
412
+ ```
413
+
414
+ ### Example Workflow
415
+
416
+ ```bash
417
+ # 1. Check which files need preview images
418
+ ./scripts/generate-preview-images.sh --list-missing
419
+
420
+ # 2. Preview what would be generated
421
+ export OPENAI_API_KEY="your-api-key"
422
+ ./scripts/generate-preview-images.sh --dry-run
423
+
424
+ # 3. Generate images for specific collection
425
+ ./scripts/generate-preview-images.sh --collection posts
426
+
427
+ # 4. Verify results and commit
428
+ git status
429
+ git add assets/images/previews/ pages/
430
+ git commit -m "feat: add AI-generated preview images"
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Support
436
+
437
+ For issues with the automation system:
438
+
439
+ 1. **Check logs**: Review GitHub Actions logs
440
+ 2. **Run locally**: Test scripts on your local machine
441
+ 3. **Validate environment**: Ensure all dependencies are installed
442
+ 4. **Create issue**: Report bugs with full error output and system info
443
+