@ngockhoale/ukit 1.6.8 → 2.0.2

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 (64) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/manifests/platform.full.yaml +47 -0
  3. package/package.json +2 -1
  4. package/scripts/skill/audit-skill.mjs +39 -0
  5. package/src/cli/commands/doctor.js +22 -2
  6. package/src/cli/commands/memory.js +76 -1
  7. package/src/core/memory/store.js +125 -1
  8. package/src/core/skillProfile.js +45 -0
  9. package/src/skill/auditSkill.js +99 -0
  10. package/templates/.claude/agents/code-reviewer.md +51 -7
  11. package/templates/.claude/agents/handoff-planner.md +18 -2
  12. package/templates/.claude/hooks/context-hardcap-gate.sh +102 -0
  13. package/templates/.claude/hooks/reset-compact-pressure.sh +25 -0
  14. package/templates/.claude/settings.json +15 -0
  15. package/templates/.claude/skills/canvas-design/SKILL.md +2 -20
  16. package/templates/.claude/skills/canvas-design/philosophy-examples.md +23 -0
  17. package/templates/.claude/skills/debugging-toolkit/SKILL.md +2 -30
  18. package/templates/.claude/skills/debugging-toolkit/reference-tables.md +33 -0
  19. package/templates/.claude/skills/docs-manager/SKILL.md +7 -249
  20. package/templates/.claude/skills/docs-manager/conventions-and-examples.md +221 -0
  21. package/templates/.claude/skills/docx/SKILL.md +3 -34
  22. package/templates/.claude/skills/docx/redlining-reference.md +34 -0
  23. package/templates/.claude/skills/duraone/SKILL.md +12 -16
  24. package/templates/.claude/skills/executing-plans/SKILL.md +31 -19
  25. package/templates/.claude/skills/file-organizer/SKILL.md +2 -170
  26. package/templates/.claude/skills/file-organizer/examples-and-practices.md +173 -0
  27. package/templates/.claude/skills/pdf/SKILL.md +1 -62
  28. package/templates/.claude/skills/pdf/reference.md +65 -0
  29. package/templates/.claude/skills/pdf-processing-pro/SKILL.md +2 -73
  30. package/templates/.claude/skills/pdf-processing-pro/workflows-and-troubleshooting.md +80 -0
  31. package/templates/.claude/skills/pptx/SKILL.md +14 -286
  32. package/templates/.claude/skills/pptx/design-references.md +81 -0
  33. package/templates/.claude/skills/pptx/template-replacement-reference.md +150 -0
  34. package/templates/.claude/skills/pptx/utilities.md +62 -0
  35. package/templates/.claude/skills/project-learning/SKILL.md +32 -0
  36. package/templates/.claude/skills/root-cause-tracing/SKILL.md +2 -35
  37. package/templates/.claude/skills/root-cause-tracing/diagrams.md +44 -0
  38. package/templates/.claude/skills/sharing-skills/SKILL.md +1 -41
  39. package/templates/.claude/skills/sharing-skills/complete-example.md +41 -0
  40. package/templates/.claude/skills/skill-quality/SKILL.md +37 -0
  41. package/templates/.claude/skills/skill-quality/pressure-scenario-template.md +20 -0
  42. package/templates/.claude/skills/skill-quality/rationalization-table-template.md +15 -0
  43. package/templates/.claude/skills/skill-quality/trigger-accuracy-template.md +32 -0
  44. package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +13 -440
  45. package/templates/.claude/skills/sql-optimization-patterns/references/advanced-techniques.md +128 -0
  46. package/templates/.claude/skills/sql-optimization-patterns/references/core-concepts.md +112 -0
  47. package/templates/.claude/skills/sql-optimization-patterns/references/query-patterns.md +204 -0
  48. package/templates/.claude/skills/subagent-driven-development/SKILL.md +4 -51
  49. package/templates/.claude/skills/subagent-driven-development/example-workflow.md +40 -0
  50. package/templates/.claude/skills/systematic-debugging/SKILL.md +2 -28
  51. package/templates/.claude/skills/systematic-debugging/reference-tables.md +33 -0
  52. package/templates/.claude/skills/test-driven-development/SKILL.md +2 -51
  53. package/templates/.claude/skills/test-driven-development/reference-tables.md +56 -0
  54. package/templates/.claude/skills/testing-anti-patterns/SKILL.md +1 -10
  55. package/templates/.claude/skills/testing-anti-patterns/reference-tables.md +14 -0
  56. package/templates/.claude/skills/verification-before-completion/SKILL.md +1 -31
  57. package/templates/.claude/skills/verification-before-completion/key-patterns.md +33 -0
  58. package/templates/.claude/ukit/runtime/compact-threshold.mjs +28 -0
  59. package/templates/.claude/ukit/runtime/reinject-context.mjs +14 -1
  60. package/templates/CLAUDE.md +4 -0
  61. package/templates/ukit/storage/config.json +4 -0
  62. package/src/core/memory/index.js +0 -2
  63. package/src/core/router/index.js +0 -2
  64. package/src/core/validation/index.js +0 -2
@@ -0,0 +1,80 @@
1
+ # PDF Processing Pro — Common Workflows and Troubleshooting
2
+
3
+ ## Common workflows
4
+
5
+ ### Workflow 1: Process form submissions
6
+
7
+ ```bash
8
+ # 1. Analyze form structure
9
+ python scripts/analyze_form.py template.pdf --output schema.json
10
+
11
+ # 2. Validate submission data
12
+ python scripts/validate_form.py submission.json schema.json
13
+
14
+ # 3. Fill form
15
+ python scripts/fill_form.py template.pdf submission.json completed.pdf
16
+
17
+ # 4. Validate output
18
+ python scripts/validate_pdf.py completed.pdf
19
+ ```
20
+
21
+ ### Workflow 2: Extract data from reports
22
+
23
+ ```bash
24
+ # 1. Extract tables
25
+ python scripts/extract_tables.py monthly_report.pdf --output data.csv
26
+
27
+ # 2. Extract text for analysis
28
+ python scripts/extract_text.py monthly_report.pdf --output report.txt
29
+ ```
30
+
31
+ ### Workflow 3: Batch processing
32
+
33
+ ```python
34
+ import glob
35
+ from pathlib import Path
36
+ import subprocess
37
+
38
+ # Process all PDFs in directory
39
+ for pdf_file in glob.glob("invoices/*.pdf"):
40
+ output_file = Path("processed") / Path(pdf_file).name
41
+
42
+ result = subprocess.run([
43
+ "python", "scripts/extract_text.py",
44
+ pdf_file,
45
+ "--output", str(output_file)
46
+ ], capture_output=True)
47
+
48
+ if result.returncode == 0:
49
+ print(f"✓ Processed: {pdf_file}")
50
+ else:
51
+ print(f"✗ Failed: {pdf_file} - {result.stderr}")
52
+ ```
53
+
54
+ ## Troubleshooting
55
+
56
+ ### Common issues
57
+
58
+ **"Module not found" errors**:
59
+ ```bash
60
+ pip install -r requirements.txt
61
+ ```
62
+
63
+ **Tesseract not found**:
64
+ ```bash
65
+ # Install tesseract system package (see Dependencies)
66
+ ```
67
+
68
+ **Memory errors with large PDFs**:
69
+ ```python
70
+ # Process page by page instead of loading entire PDF
71
+ with pdfplumber.open("large.pdf") as pdf:
72
+ for page in pdf.pages:
73
+ text = page.extract_text()
74
+ # Process page immediately
75
+ ```
76
+
77
+ **Permission errors**:
78
+ ```bash
79
+ chmod +x scripts/*.py
80
+ ```
@@ -72,74 +72,7 @@ When creating a new PowerPoint presentation from scratch, use the **html2pptx**
72
72
  - **Build your palette**: Pick 3-5 colors that work together (dominant colors + supporting tones + accent)
73
73
  - **Ensure contrast**: Text must be clearly readable on backgrounds
74
74
 
75
- **Example color palettes** (use these to spark creativity - choose one, adapt it, or create your own):
76
-
77
- 1. **Classic Blue**: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6)
78
- 2. **Teal & Coral**: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF)
79
- 3. **Bold Red**: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71)
80
- 4. **Warm Blush**: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2)
81
- 5. **Burgundy Luxury**: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929)
82
- 6. **Deep Purple & Emerald**: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF)
83
- 7. **Cream & Forest Green**: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC)
84
- 8. **Pink & Purple**: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68)
85
- 9. **Lime & Plum**: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5)
86
- 10. **Black & Gold**: Gold (#BF9A4A), black (#000000), cream (#F4F6F6)
87
- 11. **Sage & Terracotta**: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C)
88
- 12. **Charcoal & Red**: Charcoal (#292929), red (#E33737), light gray (#CCCBCB)
89
- 13. **Vibrant Orange**: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831)
90
- 14. **Forest Green**: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF)
91
- 15. **Retro Rainbow**: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600)
92
- 16. **Vintage Earthy**: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE)
93
- 17. **Coastal Rose**: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE)
94
- 18. **Orange & Turquoise**: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC)
95
-
96
- #### Visual Details Options
97
-
98
- **Geometric Patterns**:
99
- - Diagonal section dividers instead of horizontal
100
- - Asymmetric column widths (30/70, 40/60, 25/75)
101
- - Rotated text headers at 90° or 270°
102
- - Circular/hexagonal frames for images
103
- - Triangular accent shapes in corners
104
- - Overlapping shapes for depth
105
-
106
- **Border & Frame Treatments**:
107
- - Thick single-color borders (10-20pt) on one side only
108
- - Double-line borders with contrasting colors
109
- - Corner brackets instead of full frames
110
- - L-shaped borders (top+left or bottom+right)
111
- - Underline accents beneath headers (3-5pt thick)
112
-
113
- **Typography Treatments**:
114
- - Extreme size contrast (72pt headlines vs 11pt body)
115
- - All-caps headers with wide letter spacing
116
- - Numbered sections in oversized display type
117
- - Monospace (Courier New) for data/stats/technical content
118
- - Condensed fonts (Arial Narrow) for dense information
119
- - Outlined text for emphasis
120
-
121
- **Chart & Data Styling**:
122
- - Monochrome charts with single accent color for key data
123
- - Horizontal bar charts instead of vertical
124
- - Dot plots instead of bar charts
125
- - Minimal gridlines or none at all
126
- - Data labels directly on elements (no legends)
127
- - Oversized numbers for key metrics
128
-
129
- **Layout Innovations**:
130
- - Full-bleed images with text overlays
131
- - Sidebar column (20-30% width) for navigation/context
132
- - Modular grid systems (3×3, 4×4 blocks)
133
- - Z-pattern or F-pattern content flow
134
- - Floating text boxes over colored shapes
135
- - Magazine-style multi-column layouts
136
-
137
- **Background Treatments**:
138
- - Solid color blocks occupying 40-60% of slide
139
- - Gradient fills (vertical or diagonal only)
140
- - Split backgrounds (two colors, diagonal or vertical)
141
- - Edge-to-edge color bands
142
- - Negative space as a design element
75
+ For 18 example palettes to spark creativity and a menu of visual treatment options (geometric patterns, border/frame treatments, typography, chart styling, layout, backgrounds), read [`design-references.md`](design-references.md).
143
76
 
144
77
  ### Layout Tips
145
78
  **When creating slides with charts or tables:**
@@ -188,22 +121,11 @@ When you need to create a presentation that follows an existing template's desig
188
121
  * Extract text: `python -m markitdown template.pptx > template-content.md`
189
122
  * Read `template-content.md`: Read the entire file to understand the contents of the template presentation. **NEVER set any range limits when reading this file.**
190
123
  * Create thumbnail grids: `python scripts/thumbnail.py template.pptx`
191
- * See [Creating Thumbnail Grids](#creating-thumbnail-grids) section for more details
124
+ * See [`utilities.md`](utilities.md) for thumbnail-grid options
192
125
 
193
126
  2. **Analyze template and save inventory to a file**:
194
127
  * **Visual Analysis**: Review thumbnail grid(s) to understand slide layouts, design patterns, and visual structure
195
- * Create and save a template inventory file at `template-inventory.md` containing:
196
- ```markdown
197
- # Template Inventory Analysis
198
- **Total Slides: [count]**
199
- **IMPORTANT: Slides are 0-indexed (first slide = 0, last slide = count-1)**
200
-
201
- ## [Category Name]
202
- - Slide 0: [Layout code if available] - Description/purpose
203
- - Slide 1: [Layout code] - Description/purpose
204
- - Slide 2: [Layout code] - Description/purpose
205
- [... EVERY slide must be listed individually with its index ...]
206
- ```
128
+ * Create and save a template inventory file at `template-inventory.md`. Format example: [`template-replacement-reference.md`](template-replacement-reference.md#template-inventory--mapping-examples).
207
129
  * **Using the thumbnail grid**: Reference the visual thumbnails to identify:
208
130
  - Layout patterns (title slides, content layouts, section dividers)
209
131
  - Image placeholder locations and counts
@@ -227,20 +149,7 @@ When you need to create a presentation that follows an existing template's desig
227
149
  * Count your actual content pieces BEFORE selecting the layout
228
150
  * Verify each placeholder in the chosen layout will be filled with meaningful content
229
151
  * Select one option representing the **best** layout for each content section.
230
- * Save `outline.md` with content AND template mapping that leverages available designs
231
- * Example template mapping:
232
- ```
233
- # Template slides to use (0-based indexing)
234
- # WARNING: Verify indices are within range! Template with 73 slides has indices 0-72
235
- # Mapping: slide numbers from outline -> template slide indices
236
- template_mapping = [
237
- 0, # Use slide 0 (Title/Cover)
238
- 34, # Use slide 34 (B1: Title and body)
239
- 34, # Use slide 34 again (duplicate for second B1)
240
- 50, # Use slide 50 (E1: Quote)
241
- 54, # Use slide 54 (F2: Closing + Text)
242
- ]
243
- ```
152
+ * Save `outline.md` with content AND template mapping that leverages available designs. Example mapping: [`template-replacement-reference.md`](template-replacement-reference.md#template-inventory--mapping-examples).
244
153
 
245
154
  4. **Duplicate, reorder, and delete slides using `rearrange.py`**:
246
155
  * Use the `scripts/rearrange.py` script to create a new presentation with slides in the desired order:
@@ -257,212 +166,31 @@ When you need to create a presentation that follows an existing template's desig
257
166
  python scripts/inventory.py working.pptx text-inventory.json
258
167
  ```
259
168
  * **Read text-inventory.json**: Read the entire text-inventory.json file to understand all shapes and their properties. **NEVER set any range limits when reading this file.**
260
-
261
- * The inventory JSON structure:
262
- ```json
263
- {
264
- "slide-0": {
265
- "shape-0": {
266
- "placeholder_type": "TITLE", // or null for non-placeholders
267
- "left": 1.5, // position in inches
268
- "top": 2.0,
269
- "width": 7.5,
270
- "height": 1.2,
271
- "paragraphs": [
272
- {
273
- "text": "Paragraph text",
274
- // Optional properties (only included when non-default):
275
- "bullet": true, // explicit bullet detected
276
- "level": 0, // only included when bullet is true
277
- "alignment": "CENTER", // CENTER, RIGHT (not LEFT)
278
- "space_before": 10.0, // space before paragraph in points
279
- "space_after": 6.0, // space after paragraph in points
280
- "line_spacing": 22.4, // line spacing in points
281
- "font_name": "Arial", // from first run
282
- "font_size": 14.0, // in points
283
- "bold": true,
284
- "italic": false,
285
- "underline": false,
286
- "color": "FF0000" // RGB color
287
- }
288
- ]
289
- }
290
- }
291
- }
292
- ```
293
-
294
- * Key features:
295
- - **Slides**: Named as "slide-0", "slide-1", etc.
296
- - **Shapes**: Ordered by visual position (top-to-bottom, left-to-right) as "shape-0", "shape-1", etc.
297
- - **Placeholder types**: TITLE, CENTER_TITLE, SUBTITLE, BODY, OBJECT, or null
298
- - **Default font size**: `default_font_size` in points extracted from layout placeholders (when available)
299
- - **Slide numbers are filtered**: Shapes with SLIDE_NUMBER placeholder type are automatically excluded from inventory
300
- - **Bullets**: When `bullet: true`, `level` is always included (even if 0)
301
- - **Spacing**: `space_before`, `space_after`, and `line_spacing` in points (only included when set)
302
- - **Colors**: `color` for RGB (e.g., "FF0000"), `theme_color` for theme colors (e.g., "DARK_1")
303
- - **Properties**: Only non-default values are included in the output
169
+ * Full JSON structure and field reference: [`template-replacement-reference.md`](template-replacement-reference.md#text-inventoryjson-structure-from-inventorypy)
304
170
 
305
171
  6. **Generate replacement text and save the data to a JSON file**
306
172
  Based on the text inventory from the previous step:
307
173
  - **CRITICAL**: First verify which shapes exist in the inventory - only reference shapes that are actually present
308
- - **VALIDATION**: The replace.py script will validate that all shapes in your replacement JSON exist in the inventory
309
- - If you reference a non-existent shape, you'll get an error showing available shapes
310
- - If you reference a non-existent slide, you'll get an error indicating the slide doesn't exist
311
- - All validation errors are shown at once before the script exits
312
- - **IMPORTANT**: The replace.py script uses inventory.py internally to identify ALL text shapes
313
- - **AUTOMATIC CLEARING**: ALL text shapes from the inventory will be cleared unless you provide "paragraphs" for them
314
- - Add a "paragraphs" field to shapes that need content (not "replacement_paragraphs")
315
- - Shapes without "paragraphs" in the replacement JSON will have their text cleared automatically
316
- - Paragraphs with bullets will be automatically left aligned. Don't set the `alignment` property on when `"bullet": true`
317
- - Generate appropriate replacement content for placeholder text
318
- - Use shape size to determine appropriate content length
174
+ - **VALIDATION**: The replace.py script will validate that all shapes in your replacement JSON exist in the inventory before applying anything; all errors are shown at once
175
+ - **AUTOMATIC CLEARING**: ALL text shapes from the inventory will be cleared unless you provide a "paragraphs" field for them (not "replacement_paragraphs")
176
+ - Paragraphs with bullets will be automatically left aligned. Don't set the `alignment` property when `"bullet": true`
319
177
  - **CRITICAL**: Include paragraph properties from the original inventory - don't just provide text
320
178
  - **IMPORTANT**: When bullet: true, do NOT include bullet symbols (•, -, *) in text - they're added automatically
321
- - **ESSENTIAL FORMATTING RULES**:
322
- - Headers/titles should typically have `"bold": true`
323
- - List items should have `"bullet": true, "level": 0` (level is required when bullet is true)
324
- - Preserve any alignment properties (e.g., `"alignment": "CENTER"` for centered text)
325
- - Include font properties when different from default (e.g., `"font_size": 14.0`, `"font_name": "Lora"`)
326
- - Colors: Use `"color": "FF0000"` for RGB or `"theme_color": "DARK_1"` for theme colors
327
- - The replacement script expects **properly formatted paragraphs**, not just text strings
328
- - **Overlapping shapes**: Prefer shapes with larger default_font_size or more appropriate placeholder_type
179
+ - Headers/titles should typically have `"bold": true`; list items need `"bullet": true, "level": 0`
180
+ - **Overlapping shapes**: Prefer shapes with larger default_font_size or more appropriate placeholder_type
329
181
  - Save the updated inventory with replacements to `replacement-text.json`
330
182
  - **WARNING**: Different template layouts have different shape counts - always check the actual inventory before creating replacements
331
-
332
- Example paragraphs field showing proper formatting:
333
- ```json
334
- "paragraphs": [
335
- {
336
- "text": "New presentation title text",
337
- "alignment": "CENTER",
338
- "bold": true
339
- },
340
- {
341
- "text": "Section Header",
342
- "bold": true
343
- },
344
- {
345
- "text": "First bullet point without bullet symbol",
346
- "bullet": true,
347
- "level": 0
348
- },
349
- {
350
- "text": "Red colored text",
351
- "color": "FF0000"
352
- },
353
- {
354
- "text": "Theme colored text",
355
- "theme_color": "DARK_1"
356
- },
357
- {
358
- "text": "Regular paragraph text without special formatting"
359
- }
360
- ]
361
- ```
362
-
363
- **Shapes not listed in the replacement JSON are automatically cleared**:
364
- ```json
365
- {
366
- "slide-0": {
367
- "shape-0": {
368
- "paragraphs": [...] // This shape gets new text
369
- }
370
- // shape-1 and shape-2 from inventory will be cleared automatically
371
- }
372
- }
373
- ```
374
-
375
- **Common formatting patterns for presentations**:
376
- - Title slides: Bold text, sometimes centered
377
- - Section headers within slides: Bold text
378
- - Bullet lists: Each item needs `"bullet": true, "level": 0`
379
- - Body text: Usually no special properties needed
380
- - Quotes: May have special alignment or font properties
183
+ - Example paragraphs field, cleared-shape example, and common formatting patterns: [`template-replacement-reference.md`](template-replacement-reference.md#replacement-json-examples)
381
184
 
382
185
  7. **Apply replacements using the `replace.py` script**
383
186
  ```bash
384
187
  python scripts/replace.py working.pptx replacement-text.json output.pptx
385
188
  ```
189
+ Validates all shapes/slides referenced exist, clears every inventoried shape, then applies new text with formatting only to shapes with "paragraphs" defined. See [`template-replacement-reference.md`](template-replacement-reference.md#replacepy-behavior-and-validation-errors) for exact validation-error output.
386
190
 
387
- The script will:
388
- - First extract the inventory of ALL text shapes using functions from inventory.py
389
- - Validate that all shapes in the replacement JSON exist in the inventory
390
- - Clear text from ALL shapes identified in the inventory
391
- - Apply new text only to shapes with "paragraphs" defined in the replacement JSON
392
- - Preserve formatting by applying paragraph properties from the JSON
393
- - Handle bullets, alignment, font properties, and colors automatically
394
- - Save the updated presentation
191
+ ## Utility commands
395
192
 
396
- Example validation errors:
397
- ```
398
- ERROR: Invalid shapes in replacement JSON:
399
- - Shape 'shape-99' not found on 'slide-0'. Available shapes: shape-0, shape-1, shape-4
400
- - Slide 'slide-999' not found in inventory
401
- ```
402
-
403
- ```
404
- ERROR: Replacement text made overflow worse in these shapes:
405
- - slide-0/shape-2: overflow worsened by 1.25" (was 0.00", now 1.25")
406
- ```
407
-
408
- ## Creating Thumbnail Grids
409
-
410
- To create visual thumbnail grids of PowerPoint slides for quick analysis and reference:
411
-
412
- ```bash
413
- python scripts/thumbnail.py template.pptx [output_prefix]
414
- ```
415
-
416
- **Features**:
417
- - Creates: `thumbnails.jpg` (or `thumbnails-1.jpg`, `thumbnails-2.jpg`, etc. for large decks)
418
- - Default: 5 columns, max 30 slides per grid (5×6)
419
- - Custom prefix: `python scripts/thumbnail.py template.pptx my-grid`
420
- - Note: The output prefix should include the path if you want output in a specific directory (e.g., `workspace/my-grid`)
421
- - Adjust columns: `--cols 4` (range: 3-6, affects slides per grid)
422
- - Grid limits: 3 cols = 12 slides/grid, 4 cols = 20, 5 cols = 30, 6 cols = 42
423
- - Slides are zero-indexed (Slide 0, Slide 1, etc.)
424
-
425
- **Use cases**:
426
- - Template analysis: Quickly understand slide layouts and design patterns
427
- - Content review: Visual overview of entire presentation
428
- - Navigation reference: Find specific slides by their visual appearance
429
- - Quality check: Verify all slides are properly formatted
430
-
431
- **Examples**:
432
- ```bash
433
- # Basic usage
434
- python scripts/thumbnail.py presentation.pptx
435
-
436
- # Combine options: custom name, columns
437
- python scripts/thumbnail.py template.pptx analysis --cols 4
438
- ```
439
-
440
- ## Converting Slides to Images
441
-
442
- To visually analyze PowerPoint slides, convert them to images using a two-step process:
443
-
444
- 1. **Convert PPTX to PDF**:
445
- ```bash
446
- soffice --headless --convert-to pdf template.pptx
447
- ```
448
-
449
- 2. **Convert PDF pages to JPEG images**:
450
- ```bash
451
- pdftoppm -jpeg -r 150 template.pdf slide
452
- ```
453
- This creates files like `slide-1.jpg`, `slide-2.jpg`, etc.
454
-
455
- Options:
456
- - `-r 150`: Sets resolution to 150 DPI (adjust for quality/size balance)
457
- - `-jpeg`: Output JPEG format (use `-png` for PNG if preferred)
458
- - `-f N`: First page to convert (e.g., `-f 2` starts from page 2)
459
- - `-l N`: Last page to convert (e.g., `-l 5` stops at page 5)
460
- - `slide`: Prefix for output files
461
-
462
- Example for specific range:
463
- ```bash
464
- pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide # Converts only pages 2-5
465
- ```
193
+ Thumbnail-grid generation (`scripts/thumbnail.py`) and slide-to-image conversion (`soffice`/`pdftoppm`) — used for visual analysis and template review — are documented in [`utilities.md`](utilities.md).
466
194
 
467
195
  ## Code Style Guidelines
468
196
  **IMPORTANT**: When generating code for PPTX operations:
@@ -0,0 +1,81 @@
1
+ # PPTX Design References
2
+
3
+ Reference material for the html2pptx workflow's design step. Read this when picking a color palette or visual treatment for a from-scratch presentation.
4
+
5
+ ## Color Palette Selection
6
+
7
+ **Choosing colors creatively**:
8
+ - **Think beyond defaults**: What colors genuinely match this specific topic? Avoid autopilot choices.
9
+ - **Consider multiple angles**: Topic, industry, mood, energy level, target audience, brand identity (if mentioned)
10
+ - **Be adventurous**: Try unexpected combinations - a healthcare presentation doesn't have to be green, finance doesn't have to be navy
11
+ - **Build your palette**: Pick 3-5 colors that work together (dominant colors + supporting tones + accent)
12
+ - **Ensure contrast**: Text must be clearly readable on backgrounds
13
+
14
+ **Example color palettes** (use these to spark creativity - choose one, adapt it, or create your own):
15
+
16
+ 1. **Classic Blue**: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6)
17
+ 2. **Teal & Coral**: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF)
18
+ 3. **Bold Red**: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71)
19
+ 4. **Warm Blush**: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2)
20
+ 5. **Burgundy Luxury**: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929)
21
+ 6. **Deep Purple & Emerald**: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF)
22
+ 7. **Cream & Forest Green**: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC)
23
+ 8. **Pink & Purple**: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68)
24
+ 9. **Lime & Plum**: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5)
25
+ 10. **Black & Gold**: Gold (#BF9A4A), black (#000000), cream (#F4F6F6)
26
+ 11. **Sage & Terracotta**: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C)
27
+ 12. **Charcoal & Red**: Charcoal (#292929), red (#E33737), light gray (#CCCBCB)
28
+ 13. **Vibrant Orange**: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831)
29
+ 14. **Forest Green**: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF)
30
+ 15. **Retro Rainbow**: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600)
31
+ 16. **Vintage Earthy**: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE)
32
+ 17. **Coastal Rose**: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE)
33
+ 18. **Orange & Turquoise**: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC)
34
+
35
+ ## Visual Details Options
36
+
37
+ **Geometric Patterns**:
38
+ - Diagonal section dividers instead of horizontal
39
+ - Asymmetric column widths (30/70, 40/60, 25/75)
40
+ - Rotated text headers at 90° or 270°
41
+ - Circular/hexagonal frames for images
42
+ - Triangular accent shapes in corners
43
+ - Overlapping shapes for depth
44
+
45
+ **Border & Frame Treatments**:
46
+ - Thick single-color borders (10-20pt) on one side only
47
+ - Double-line borders with contrasting colors
48
+ - Corner brackets instead of full frames
49
+ - L-shaped borders (top+left or bottom+right)
50
+ - Underline accents beneath headers (3-5pt thick)
51
+
52
+ **Typography Treatments**:
53
+ - Extreme size contrast (72pt headlines vs 11pt body)
54
+ - All-caps headers with wide letter spacing
55
+ - Numbered sections in oversized display type
56
+ - Monospace (Courier New) for data/stats/technical content
57
+ - Condensed fonts (Arial Narrow) for dense information
58
+ - Outlined text for emphasis
59
+
60
+ **Chart & Data Styling**:
61
+ - Monochrome charts with single accent color for key data
62
+ - Horizontal bar charts instead of vertical
63
+ - Dot plots instead of bar charts
64
+ - Minimal gridlines or none at all
65
+ - Data labels directly on elements (no legends)
66
+ - Oversized numbers for key metrics
67
+
68
+ **Layout Innovations**:
69
+ - Full-bleed images with text overlays
70
+ - Sidebar column (20-30% width) for navigation/context
71
+ - Modular grid systems (3×3, 4×4 blocks)
72
+ - Z-pattern or F-pattern content flow
73
+ - Floating text boxes over colored shapes
74
+ - Magazine-style multi-column layouts
75
+
76
+ **Background Treatments**:
77
+ - Solid color blocks occupying 40-60% of slide
78
+ - Gradient fills (vertical or diagonal only)
79
+ - Split backgrounds (two colors, diagonal or vertical)
80
+ - Edge-to-edge color bands
81
+ - Negative space as a design element
@@ -0,0 +1,150 @@
1
+ # Template Text-Replacement Reference
2
+
3
+ Full JSON schemas and examples for steps 5-7 of the "using a template" workflow (`inventory.py` → replacement JSON → `replace.py`). Read this when you need the exact field shapes, not just the procedure.
4
+
5
+ ## Template inventory + mapping examples
6
+
7
+ ```markdown
8
+ # Template Inventory Analysis
9
+ **Total Slides: [count]**
10
+ **IMPORTANT: Slides are 0-indexed (first slide = 0, last slide = count-1)**
11
+
12
+ ## [Category Name]
13
+ - Slide 0: [Layout code if available] - Description/purpose
14
+ - Slide 1: [Layout code] - Description/purpose
15
+ - Slide 2: [Layout code] - Description/purpose
16
+ [... EVERY slide must be listed individually with its index ...]
17
+ ```
18
+
19
+ ```
20
+ # Template slides to use (0-based indexing)
21
+ # WARNING: Verify indices are within range! Template with 73 slides has indices 0-72
22
+ # Mapping: slide numbers from outline -> template slide indices
23
+ template_mapping = [
24
+ 0, # Use slide 0 (Title/Cover)
25
+ 34, # Use slide 34 (B1: Title and body)
26
+ 34, # Use slide 34 again (duplicate for second B1)
27
+ 50, # Use slide 50 (E1: Quote)
28
+ 54, # Use slide 54 (F2: Closing + Text)
29
+ ]
30
+ ```
31
+
32
+ ## `text-inventory.json` structure (from `inventory.py`)
33
+
34
+ ```json
35
+ {
36
+ "slide-0": {
37
+ "shape-0": {
38
+ "placeholder_type": "TITLE", // or null for non-placeholders
39
+ "left": 1.5, // position in inches
40
+ "top": 2.0,
41
+ "width": 7.5,
42
+ "height": 1.2,
43
+ "paragraphs": [
44
+ {
45
+ "text": "Paragraph text",
46
+ // Optional properties (only included when non-default):
47
+ "bullet": true, // explicit bullet detected
48
+ "level": 0, // only included when bullet is true
49
+ "alignment": "CENTER", // CENTER, RIGHT (not LEFT)
50
+ "space_before": 10.0, // space before paragraph in points
51
+ "space_after": 6.0, // space after paragraph in points
52
+ "line_spacing": 22.4, // line spacing in points
53
+ "font_name": "Arial", // from first run
54
+ "font_size": 14.0, // in points
55
+ "bold": true,
56
+ "italic": false,
57
+ "underline": false,
58
+ "color": "FF0000" // RGB color
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ **Key features**:
67
+ - **Slides**: Named as "slide-0", "slide-1", etc.
68
+ - **Shapes**: Ordered by visual position (top-to-bottom, left-to-right) as "shape-0", "shape-1", etc.
69
+ - **Placeholder types**: TITLE, CENTER_TITLE, SUBTITLE, BODY, OBJECT, or null
70
+ - **Default font size**: `default_font_size` in points extracted from layout placeholders (when available)
71
+ - **Slide numbers are filtered**: Shapes with SLIDE_NUMBER placeholder type are automatically excluded from inventory
72
+ - **Bullets**: When `bullet: true`, `level` is always included (even if 0)
73
+ - **Spacing**: `space_before`, `space_after`, and `line_spacing` in points (only included when set)
74
+ - **Colors**: `color` for RGB (e.g., "FF0000"), `theme_color` for theme colors (e.g., "DARK_1")
75
+ - **Properties**: Only non-default values are included in the output
76
+
77
+ ## Replacement JSON examples
78
+
79
+ Example `paragraphs` field showing proper formatting:
80
+ ```json
81
+ "paragraphs": [
82
+ {
83
+ "text": "New presentation title text",
84
+ "alignment": "CENTER",
85
+ "bold": true
86
+ },
87
+ {
88
+ "text": "Section Header",
89
+ "bold": true
90
+ },
91
+ {
92
+ "text": "First bullet point without bullet symbol",
93
+ "bullet": true,
94
+ "level": 0
95
+ },
96
+ {
97
+ "text": "Red colored text",
98
+ "color": "FF0000"
99
+ },
100
+ {
101
+ "text": "Theme colored text",
102
+ "theme_color": "DARK_1"
103
+ },
104
+ {
105
+ "text": "Regular paragraph text without special formatting"
106
+ }
107
+ ]
108
+ ```
109
+
110
+ **Shapes not listed in the replacement JSON are automatically cleared**:
111
+ ```json
112
+ {
113
+ "slide-0": {
114
+ "shape-0": {
115
+ "paragraphs": [...] // This shape gets new text
116
+ }
117
+ // shape-1 and shape-2 from inventory will be cleared automatically
118
+ }
119
+ }
120
+ ```
121
+
122
+ **Common formatting patterns for presentations**:
123
+ - Title slides: Bold text, sometimes centered
124
+ - Section headers within slides: Bold text
125
+ - Bullet lists: Each item needs `"bullet": true, "level": 0`
126
+ - Body text: Usually no special properties needed
127
+ - Quotes: May have special alignment or font properties
128
+
129
+ ## `replace.py` behavior and validation errors
130
+
131
+ The script:
132
+ - First extracts the inventory of ALL text shapes using functions from inventory.py
133
+ - Validates that all shapes in the replacement JSON exist in the inventory
134
+ - Clears text from ALL shapes identified in the inventory
135
+ - Applies new text only to shapes with "paragraphs" defined in the replacement JSON
136
+ - Preserves formatting by applying paragraph properties from the JSON
137
+ - Handles bullets, alignment, font properties, and colors automatically
138
+ - Saves the updated presentation
139
+
140
+ Example validation errors:
141
+ ```
142
+ ERROR: Invalid shapes in replacement JSON:
143
+ - Shape 'shape-99' not found on 'slide-0'. Available shapes: shape-0, shape-1, shape-4
144
+ - Slide 'slide-999' not found in inventory
145
+ ```
146
+
147
+ ```
148
+ ERROR: Replacement text made overflow worse in these shapes:
149
+ - slide-0/shape-2: overflow worsened by 1.25" (was 0.00", now 1.25")
150
+ ```