@mclawnet/agent 0.5.9 → 0.6.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 (81) hide show
  1. package/cli.js +168 -61
  2. package/dist/__tests__/cli.test.d.ts +2 -0
  3. package/dist/__tests__/cli.test.d.ts.map +1 -0
  4. package/dist/__tests__/service-config.test.d.ts +2 -0
  5. package/dist/__tests__/service-config.test.d.ts.map +1 -0
  6. package/dist/__tests__/service-linux.test.d.ts +2 -0
  7. package/dist/__tests__/service-linux.test.d.ts.map +1 -0
  8. package/dist/__tests__/service-macos.test.d.ts +2 -0
  9. package/dist/__tests__/service-macos.test.d.ts.map +1 -0
  10. package/dist/__tests__/service-windows.test.d.ts +2 -0
  11. package/dist/__tests__/service-windows.test.d.ts.map +1 -0
  12. package/dist/backend-adapter.d.ts +2 -0
  13. package/dist/backend-adapter.d.ts.map +1 -1
  14. package/dist/chunk-CBZIH6FY.js +93 -0
  15. package/dist/chunk-CBZIH6FY.js.map +1 -0
  16. package/dist/{chunk-KHPEQTWF.js → chunk-GLO5OZAY.js} +203 -213
  17. package/dist/chunk-GLO5OZAY.js.map +1 -0
  18. package/dist/chunk-RO47ET27.js +88 -0
  19. package/dist/chunk-RO47ET27.js.map +1 -0
  20. package/dist/hub-connection.d.ts.map +1 -1
  21. package/dist/index.js +5 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/linux-6AR7SXHW.js +176 -0
  24. package/dist/linux-6AR7SXHW.js.map +1 -0
  25. package/dist/macos-XVPWIH4C.js +174 -0
  26. package/dist/macos-XVPWIH4C.js.map +1 -0
  27. package/dist/service/config.d.ts +19 -0
  28. package/dist/service/config.d.ts.map +1 -0
  29. package/dist/service/index.d.ts +6 -0
  30. package/dist/service/index.d.ts.map +1 -0
  31. package/dist/service/index.js +47 -0
  32. package/dist/service/index.js.map +1 -0
  33. package/dist/service/linux.d.ts +18 -0
  34. package/dist/service/linux.d.ts.map +1 -0
  35. package/dist/service/macos.d.ts +18 -0
  36. package/dist/service/macos.d.ts.map +1 -0
  37. package/dist/service/types.d.ts +19 -0
  38. package/dist/service/types.d.ts.map +1 -0
  39. package/dist/service/windows.d.ts +18 -0
  40. package/dist/service/windows.d.ts.map +1 -0
  41. package/dist/session-manager.d.ts +4 -7
  42. package/dist/session-manager.d.ts.map +1 -1
  43. package/dist/skill-loader.d.ts +8 -0
  44. package/dist/skill-loader.d.ts.map +1 -0
  45. package/dist/start.d.ts.map +1 -1
  46. package/dist/start.js +2 -1
  47. package/dist/windows-NLONSCDA.js +165 -0
  48. package/dist/windows-NLONSCDA.js.map +1 -0
  49. package/package.json +7 -5
  50. package/skills/academic-search/SKILL.md +147 -0
  51. package/skills/architecture/SKILL.md +294 -0
  52. package/skills/changelog-generator/SKILL.md +112 -0
  53. package/skills/chart-visualization/SKILL.md +183 -0
  54. package/skills/code-review/SKILL.md +304 -0
  55. package/skills/codebase-health/SKILL.md +281 -0
  56. package/skills/consulting-analysis/SKILL.md +584 -0
  57. package/skills/content-research-writer/SKILL.md +546 -0
  58. package/skills/data-analysis/SKILL.md +194 -0
  59. package/skills/deep-research/SKILL.md +198 -0
  60. package/skills/docx/SKILL.md +211 -0
  61. package/skills/github-deep-research/SKILL.md +207 -0
  62. package/skills/image-generation/SKILL.md +209 -0
  63. package/skills/lead-research-assistant/SKILL.md +207 -0
  64. package/skills/mcp-builder/SKILL.md +304 -0
  65. package/skills/meeting-insights-analyzer/SKILL.md +335 -0
  66. package/skills/pair-programming/SKILL.md +196 -0
  67. package/skills/pdf/SKILL.md +309 -0
  68. package/skills/performance-analysis/SKILL.md +261 -0
  69. package/skills/podcast-generation/SKILL.md +224 -0
  70. package/skills/pptx/SKILL.md +497 -0
  71. package/skills/project-learnings/SKILL.md +280 -0
  72. package/skills/security-audit/SKILL.md +211 -0
  73. package/skills/skill-creator/SKILL.md +200 -0
  74. package/skills/technical-writing/SKILL.md +286 -0
  75. package/skills/testing/SKILL.md +363 -0
  76. package/skills/video-generation/SKILL.md +247 -0
  77. package/skills/web-design-guidelines/SKILL.md +203 -0
  78. package/skills/webapp-testing/SKILL.md +162 -0
  79. package/skills/workflow-automation/SKILL.md +299 -0
  80. package/skills/xlsx/SKILL.md +305 -0
  81. package/dist/chunk-KHPEQTWF.js.map +0 -1
@@ -0,0 +1,497 @@
1
+ ---
2
+ name: pptx
3
+ description: Create, edit, and analyze PowerPoint presentations (.pptx) with support for layouts, speaker notes, and visual design. Use when building presentations from scratch, modifying existing slides, or extracting content from .pptx files.
4
+ ---
5
+
6
+ # PPTX creation, editing, and analysis
7
+
8
+ ## Overview
9
+
10
+ A user may ask you to create, edit, or analyze the contents of a .pptx file. A .pptx file is essentially a ZIP archive containing XML files and other resources that you can read or edit. You have different tools and workflows available for different tasks.
11
+
12
+ ## When to Use
13
+
14
+ - Creating new PowerPoint presentations from scratch or from templates
15
+ - Editing slide content, layouts, or speaker notes in existing presentations
16
+ - Extracting text, images, or metadata from .pptx files
17
+ - Analyzing presentation structure and design patterns
18
+
19
+ ## When NOT to Use
20
+
21
+ - **Word documents** — use the `docx` skill
22
+ - **Spreadsheets** — use the `xlsx` skill
23
+ - **PDF documents** — use the `pdf` skill
24
+ - **Simple slide decks with no special formatting** — consider Markdown-based slides instead
25
+
26
+ ## Reading and analyzing content
27
+
28
+ ### Text extraction
29
+ If you just need to read the text contents of a presentation, you should convert the document to markdown:
30
+
31
+ ```bash
32
+ # Convert document to markdown
33
+ python -m markitdown path-to-file.pptx
34
+ ```
35
+
36
+ ### Raw XML access
37
+ You need raw XML access for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. For any of these features, you'll need to unpack a presentation and read its raw XML contents.
38
+
39
+ #### Unpacking a file
40
+ `python ooxml/scripts/unpack.py <office_file> <output_dir>`
41
+
42
+ **Note**: The unpack.py script is located at `skills/pptx/ooxml/scripts/unpack.py` relative to the project root. If the script doesn't exist at this path, use `find . -name "unpack.py"` to locate it.
43
+
44
+ #### Key file structures
45
+ * `ppt/presentation.xml` - Main presentation metadata and slide references
46
+ * `ppt/slides/slide{N}.xml` - Individual slide contents (slide1.xml, slide2.xml, etc.)
47
+ * `ppt/notesSlides/notesSlide{N}.xml` - Speaker notes for each slide
48
+ * `ppt/comments/modernComment_*.xml` - Comments for specific slides
49
+ * `ppt/slideLayouts/` - Layout templates for slides
50
+ * `ppt/slideMasters/` - Master slide templates
51
+ * `ppt/theme/` - Theme and styling information
52
+ * `ppt/media/` - Images and other media files
53
+
54
+ #### Typography and color extraction
55
+ **When given an example design to emulate**: Always analyze the presentation's typography and colors first using the methods below:
56
+ 1. **Read theme file**: Check `ppt/theme/theme1.xml` for colors (`<a:clrScheme>`) and fonts (`<a:fontScheme>`)
57
+ 2. **Sample slide content**: Examine `ppt/slides/slide1.xml` for actual font usage (`<a:rPr>`) and colors
58
+ 3. **Search for patterns**: Use grep to find color (`<a:solidFill>`, `<a:srgbClr>`) and font references across all XML files
59
+
60
+ ## Creating a new PowerPoint presentation **without a template**
61
+
62
+ When creating a new PowerPoint presentation from scratch, use the **html2pptx** workflow to convert HTML slides to PowerPoint with accurate positioning.
63
+
64
+ ### Design Principles
65
+
66
+ **CRITICAL**: Before creating any presentation, analyze the content and choose appropriate design elements:
67
+ 1. **Consider the subject matter**: What is this presentation about? What tone, industry, or mood does it suggest?
68
+ 2. **Check for branding**: If the user mentions a company/organization, consider their brand colors and identity
69
+ 3. **Match palette to content**: Select colors that reflect the subject
70
+ 4. **State your approach**: Explain your design choices before writing code
71
+
72
+ **Requirements**:
73
+ - ✅ State your content-informed design approach BEFORE writing code
74
+ - ✅ Use web-safe fonts only: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact
75
+ - ✅ Create clear visual hierarchy through size, weight, and color
76
+ - ✅ Ensure readability: strong contrast, appropriately sized text, clean alignment
77
+ - ✅ Be consistent: repeat patterns, spacing, and visual language across slides
78
+
79
+ #### Color Palette Selection
80
+
81
+ **Choosing colors creatively**:
82
+ - **Think beyond defaults**: What colors genuinely match this specific topic? Avoid autopilot choices.
83
+ - **Consider multiple angles**: Topic, industry, mood, energy level, target audience, brand identity (if mentioned)
84
+ - **Be adventurous**: Try unexpected combinations - a healthcare presentation doesn't have to be green, finance doesn't have to be navy
85
+ - **Build your palette**: Pick 3-5 colors that work together (dominant colors + supporting tones + accent)
86
+ - **Ensure contrast**: Text must be clearly readable on backgrounds
87
+
88
+ **Example color palettes** (use these to spark creativity - choose one, adapt it, or create your own):
89
+
90
+ 1. **Classic Blue**: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6)
91
+ 2. **Teal & Coral**: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF)
92
+ 3. **Bold Red**: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71)
93
+ 4. **Warm Blush**: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2)
94
+ 5. **Burgundy Luxury**: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929)
95
+ 6. **Deep Purple & Emerald**: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF)
96
+ 7. **Cream & Forest Green**: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC)
97
+ 8. **Pink & Purple**: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68)
98
+ 9. **Lime & Plum**: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5)
99
+ 10. **Black & Gold**: Gold (#BF9A4A), black (#000000), cream (#F4F6F6)
100
+ 11. **Sage & Terracotta**: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C)
101
+ 12. **Charcoal & Red**: Charcoal (#292929), red (#E33737), light gray (#CCCBCB)
102
+ 13. **Vibrant Orange**: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831)
103
+ 14. **Forest Green**: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF)
104
+ 15. **Retro Rainbow**: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600)
105
+ 16. **Vintage Earthy**: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE)
106
+ 17. **Coastal Rose**: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE)
107
+ 18. **Orange & Turquoise**: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC)
108
+
109
+ #### Visual Details Options
110
+
111
+ **Geometric Patterns**:
112
+ - Diagonal section dividers instead of horizontal
113
+ - Asymmetric column widths (30/70, 40/60, 25/75)
114
+ - Rotated text headers at 90° or 270°
115
+ - Circular/hexagonal frames for images
116
+ - Triangular accent shapes in corners
117
+ - Overlapping shapes for depth
118
+
119
+ **Border & Frame Treatments**:
120
+ - Thick single-color borders (10-20pt) on one side only
121
+ - Double-line borders with contrasting colors
122
+ - Corner brackets instead of full frames
123
+ - L-shaped borders (top+left or bottom+right)
124
+ - Underline accents beneath headers (3-5pt thick)
125
+
126
+ **Typography Treatments**:
127
+ - Extreme size contrast (72pt headlines vs 11pt body)
128
+ - All-caps headers with wide letter spacing
129
+ - Numbered sections in oversized display type
130
+ - Monospace (Courier New) for data/stats/technical content
131
+ - Condensed fonts (Arial Narrow) for dense information
132
+ - Outlined text for emphasis
133
+
134
+ **Chart & Data Styling**:
135
+ - Monochrome charts with single accent color for key data
136
+ - Horizontal bar charts instead of vertical
137
+ - Dot plots instead of bar charts
138
+ - Minimal gridlines or none at all
139
+ - Data labels directly on elements (no legends)
140
+ - Oversized numbers for key metrics
141
+
142
+ **Layout Innovations**:
143
+ - Full-bleed images with text overlays
144
+ - Sidebar column (20-30% width) for navigation/context
145
+ - Modular grid systems (3×3, 4×4 blocks)
146
+ - Z-pattern or F-pattern content flow
147
+ - Floating text boxes over colored shapes
148
+ - Magazine-style multi-column layouts
149
+
150
+ **Background Treatments**:
151
+ - Solid color blocks occupying 40-60% of slide
152
+ - Gradient fills (vertical or diagonal only)
153
+ - Split backgrounds (two colors, diagonal or vertical)
154
+ - Edge-to-edge color bands
155
+ - Negative space as a design element
156
+
157
+ ### Layout Tips
158
+ **When creating slides with charts or tables:**
159
+ - **Two-column layout (PREFERRED)**: Use a header spanning the full width, then two columns below - text/bullets in one column and the featured content in the other. This provides better balance and makes charts/tables more readable. Use flexbox with unequal column widths (e.g., 40%/60% split) to optimize space for each content type.
160
+ - **Full-slide layout**: Let the featured content (chart/table) take up the entire slide for maximum impact and readability
161
+ - **NEVER vertically stack**: Do not place charts/tables below text in a single column - this causes poor readability and layout issues
162
+
163
+ ### Workflow
164
+ 1. **MANDATORY - READ ENTIRE FILE**: Read [`html2pptx.md`](html2pptx.md) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for detailed syntax, critical formatting rules, and best practices before proceeding with presentation creation.
165
+ 2. Create an HTML file for each slide with proper dimensions (e.g., 720pt × 405pt for 16:9)
166
+ - Use `<p>`, `<h1>`-`<h6>`, `<ul>`, `<ol>` for all text content
167
+ - Use `class="placeholder"` for areas where charts/tables will be added (render with gray background for visibility)
168
+ - **CRITICAL**: Rasterize gradients and icons as PNG images FIRST using Sharp, then reference in HTML
169
+ - **LAYOUT**: For slides with charts/tables/images, use either full-slide layout or two-column layout for better readability
170
+ 3. Create and run a JavaScript file using the [`html2pptx.js`](scripts/html2pptx.js) library to convert HTML slides to PowerPoint and save the presentation
171
+ - Use the `html2pptx()` function to process each HTML file
172
+ - Add charts and tables to placeholder areas using PptxGenJS API
173
+ - Save the presentation using `pptx.writeFile()`
174
+ 4. **Visual validation**: Generate thumbnails and inspect for layout issues
175
+ - Create thumbnail grid: `python scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4`
176
+ - Read and carefully examine the thumbnail image for:
177
+ - **Text cutoff**: Text being cut off by header bars, shapes, or slide edges
178
+ - **Text overlap**: Text overlapping with other text or shapes
179
+ - **Positioning issues**: Content too close to slide boundaries or other elements
180
+ - **Contrast issues**: Insufficient contrast between text and backgrounds
181
+ - If issues found, adjust HTML margins/spacing/colors and regenerate the presentation
182
+ - Repeat until all slides are visually correct
183
+
184
+ ## Editing an existing PowerPoint presentation
185
+
186
+ When edit slides in an existing PowerPoint presentation, you need to work with the raw Office Open XML (OOXML) format. This involves unpacking the .pptx file, editing the XML content, and repacking it.
187
+
188
+ ### Workflow
189
+ 1. **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~500 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for detailed guidance on OOXML structure and editing workflows before any presentation editing.
190
+ 2. Unpack the presentation: `python ooxml/scripts/unpack.py <office_file> <output_dir>`
191
+ 3. Edit the XML files (primarily `ppt/slides/slide{N}.xml` and related files)
192
+ 4. **CRITICAL**: Validate immediately after each edit and fix any validation errors before proceeding: `python ooxml/scripts/validate.py <dir> --original <file>`
193
+ 5. Pack the final presentation: `python ooxml/scripts/pack.py <input_directory> <office_file>`
194
+
195
+ ## Creating a new PowerPoint presentation **using a template**
196
+
197
+ When you need to create a presentation that follows an existing template's design, you'll need to duplicate and re-arrange template slides before then replacing placeholder context.
198
+
199
+ ### Workflow
200
+ 1. **Extract template text AND create visual thumbnail grid**:
201
+ * Extract text: `python -m markitdown template.pptx > template-content.md`
202
+ * 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.**
203
+ * Create thumbnail grids: `python scripts/thumbnail.py template.pptx`
204
+ * See [Creating Thumbnail Grids](#creating-thumbnail-grids) section for more details
205
+
206
+ 2. **Analyze template and save inventory to a file**:
207
+ * **Visual Analysis**: Review thumbnail grid(s) to understand slide layouts, design patterns, and visual structure
208
+ * Create and save a template inventory file at `template-inventory.md` containing:
209
+ ```markdown
210
+ # Template Inventory Analysis
211
+ **Total Slides: [count]**
212
+ **IMPORTANT: Slides are 0-indexed (first slide = 0, last slide = count-1)**
213
+
214
+ ## [Category Name]
215
+ - Slide 0: [Layout code if available] - Description/purpose
216
+ - Slide 1: [Layout code] - Description/purpose
217
+ - Slide 2: [Layout code] - Description/purpose
218
+ [... EVERY slide must be listed individually with its index ...]
219
+ ```
220
+ * **Using the thumbnail grid**: Reference the visual thumbnails to identify:
221
+ - Layout patterns (title slides, content layouts, section dividers)
222
+ - Image placeholder locations and counts
223
+ - Design consistency across slide groups
224
+ - Visual hierarchy and structure
225
+ * This inventory file is REQUIRED for selecting appropriate templates in the next step
226
+
227
+ 3. **Create presentation outline based on template inventory**:
228
+ * Review available templates from step 2.
229
+ * Choose an intro or title template for the first slide. This should be one of the first templates.
230
+ * Choose safe, text-based layouts for the other slides.
231
+ * **CRITICAL: Match layout structure to actual content**:
232
+ - Single-column layouts: Use for unified narrative or single topic
233
+ - Two-column layouts: Use ONLY when you have exactly 2 distinct items/concepts
234
+ - Three-column layouts: Use ONLY when you have exactly 3 distinct items/concepts
235
+ - Image + text layouts: Use ONLY when you have actual images to insert
236
+ - Quote layouts: Use ONLY for actual quotes from people (with attribution), never for emphasis
237
+ - Never use layouts with more placeholders than you have content
238
+ - If you have 2 items, don't force them into a 3-column layout
239
+ - If you have 4+ items, consider breaking into multiple slides or using a list format
240
+ * Count your actual content pieces BEFORE selecting the layout
241
+ * Verify each placeholder in the chosen layout will be filled with meaningful content
242
+ * Select one option representing the **best** layout for each content section.
243
+ * Save `outline.md` with content AND template mapping that leverages available designs
244
+ * Example template mapping:
245
+ ```
246
+ # Template slides to use (0-based indexing)
247
+ # WARNING: Verify indices are within range! Template with 73 slides has indices 0-72
248
+ # Mapping: slide numbers from outline -> template slide indices
249
+ template_mapping = [
250
+ 0, # Use slide 0 (Title/Cover)
251
+ 34, # Use slide 34 (B1: Title and body)
252
+ 34, # Use slide 34 again (duplicate for second B1)
253
+ 50, # Use slide 50 (E1: Quote)
254
+ 54, # Use slide 54 (F2: Closing + Text)
255
+ ]
256
+ ```
257
+
258
+ 4. **Duplicate, reorder, and delete slides using `rearrange.py`**:
259
+ * Use the `scripts/rearrange.py` script to create a new presentation with slides in the desired order:
260
+ ```bash
261
+ python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52
262
+ ```
263
+ * The script handles duplicating repeated slides, deleting unused slides, and reordering automatically
264
+ * Slide indices are 0-based (first slide is 0, second is 1, etc.)
265
+ * The same slide index can appear multiple times to duplicate that slide
266
+
267
+ 5. **Extract ALL text using the `inventory.py` script**:
268
+ * **Run inventory extraction**:
269
+ ```bash
270
+ python scripts/inventory.py working.pptx text-inventory.json
271
+ ```
272
+ * **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.**
273
+
274
+ * The inventory JSON structure:
275
+ ```json
276
+ {
277
+ "slide-0": {
278
+ "shape-0": {
279
+ "placeholder_type": "TITLE", // or null for non-placeholders
280
+ "left": 1.5, // position in inches
281
+ "top": 2.0,
282
+ "width": 7.5,
283
+ "height": 1.2,
284
+ "paragraphs": [
285
+ {
286
+ "text": "Paragraph text",
287
+ // Optional properties (only included when non-default):
288
+ "bullet": true, // explicit bullet detected
289
+ "level": 0, // only included when bullet is true
290
+ "alignment": "CENTER", // CENTER, RIGHT (not LEFT)
291
+ "space_before": 10.0, // space before paragraph in points
292
+ "space_after": 6.0, // space after paragraph in points
293
+ "line_spacing": 22.4, // line spacing in points
294
+ "font_name": "Arial", // from first run
295
+ "font_size": 14.0, // in points
296
+ "bold": true,
297
+ "italic": false,
298
+ "underline": false,
299
+ "color": "FF0000" // RGB color
300
+ }
301
+ ]
302
+ }
303
+ }
304
+ }
305
+ ```
306
+
307
+ * Key features:
308
+ - **Slides**: Named as "slide-0", "slide-1", etc.
309
+ - **Shapes**: Ordered by visual position (top-to-bottom, left-to-right) as "shape-0", "shape-1", etc.
310
+ - **Placeholder types**: TITLE, CENTER_TITLE, SUBTITLE, BODY, OBJECT, or null
311
+ - **Default font size**: `default_font_size` in points extracted from layout placeholders (when available)
312
+ - **Slide numbers are filtered**: Shapes with SLIDE_NUMBER placeholder type are automatically excluded from inventory
313
+ - **Bullets**: When `bullet: true`, `level` is always included (even if 0)
314
+ - **Spacing**: `space_before`, `space_after`, and `line_spacing` in points (only included when set)
315
+ - **Colors**: `color` for RGB (e.g., "FF0000"), `theme_color` for theme colors (e.g., "DARK_1")
316
+ - **Properties**: Only non-default values are included in the output
317
+
318
+ 6. **Generate replacement text and save the data to a JSON file**
319
+ Based on the text inventory from the previous step:
320
+ - **CRITICAL**: First verify which shapes exist in the inventory - only reference shapes that are actually present
321
+ - **VALIDATION**: The replace.py script will validate that all shapes in your replacement JSON exist in the inventory
322
+ - If you reference a non-existent shape, you'll get an error showing available shapes
323
+ - If you reference a non-existent slide, you'll get an error indicating the slide doesn't exist
324
+ - All validation errors are shown at once before the script exits
325
+ - **IMPORTANT**: The replace.py script uses inventory.py internally to identify ALL text shapes
326
+ - **AUTOMATIC CLEARING**: ALL text shapes from the inventory will be cleared unless you provide "paragraphs" for them
327
+ - Add a "paragraphs" field to shapes that need content (not "replacement_paragraphs")
328
+ - Shapes without "paragraphs" in the replacement JSON will have their text cleared automatically
329
+ - Paragraphs with bullets will be automatically left aligned. Don't set the `alignment` property on when `"bullet": true`
330
+ - Generate appropriate replacement content for placeholder text
331
+ - Use shape size to determine appropriate content length
332
+ - **CRITICAL**: Include paragraph properties from the original inventory - don't just provide text
333
+ - **IMPORTANT**: When bullet: true, do NOT include bullet symbols (•, -, *) in text - they're added automatically
334
+ - **ESSENTIAL FORMATTING RULES**:
335
+ - Headers/titles should typically have `"bold": true`
336
+ - List items should have `"bullet": true, "level": 0` (level is required when bullet is true)
337
+ - Preserve any alignment properties (e.g., `"alignment": "CENTER"` for centered text)
338
+ - Include font properties when different from default (e.g., `"font_size": 14.0`, `"font_name": "Lora"`)
339
+ - Colors: Use `"color": "FF0000"` for RGB or `"theme_color": "DARK_1"` for theme colors
340
+ - The replacement script expects **properly formatted paragraphs**, not just text strings
341
+ - **Overlapping shapes**: Prefer shapes with larger default_font_size or more appropriate placeholder_type
342
+ - Save the updated inventory with replacements to `replacement-text.json`
343
+ - **WARNING**: Different template layouts have different shape counts - always check the actual inventory before creating replacements
344
+
345
+ Example paragraphs field showing proper formatting:
346
+ ```json
347
+ "paragraphs": [
348
+ {
349
+ "text": "New presentation title text",
350
+ "alignment": "CENTER",
351
+ "bold": true
352
+ },
353
+ {
354
+ "text": "Section Header",
355
+ "bold": true
356
+ },
357
+ {
358
+ "text": "First bullet point without bullet symbol",
359
+ "bullet": true,
360
+ "level": 0
361
+ },
362
+ {
363
+ "text": "Red colored text",
364
+ "color": "FF0000"
365
+ },
366
+ {
367
+ "text": "Theme colored text",
368
+ "theme_color": "DARK_1"
369
+ },
370
+ {
371
+ "text": "Regular paragraph text without special formatting"
372
+ }
373
+ ]
374
+ ```
375
+
376
+ **Shapes not listed in the replacement JSON are automatically cleared**:
377
+ ```json
378
+ {
379
+ "slide-0": {
380
+ "shape-0": {
381
+ "paragraphs": [...] // This shape gets new text
382
+ }
383
+ // shape-1 and shape-2 from inventory will be cleared automatically
384
+ }
385
+ }
386
+ ```
387
+
388
+ **Common formatting patterns for presentations**:
389
+ - Title slides: Bold text, sometimes centered
390
+ - Section headers within slides: Bold text
391
+ - Bullet lists: Each item needs `"bullet": true, "level": 0`
392
+ - Body text: Usually no special properties needed
393
+ - Quotes: May have special alignment or font properties
394
+
395
+ 7. **Apply replacements using the `replace.py` script**
396
+ ```bash
397
+ python scripts/replace.py working.pptx replacement-text.json output.pptx
398
+ ```
399
+
400
+ The script will:
401
+ - First extract the inventory of ALL text shapes using functions from inventory.py
402
+ - Validate that all shapes in the replacement JSON exist in the inventory
403
+ - Clear text from ALL shapes identified in the inventory
404
+ - Apply new text only to shapes with "paragraphs" defined in the replacement JSON
405
+ - Preserve formatting by applying paragraph properties from the JSON
406
+ - Handle bullets, alignment, font properties, and colors automatically
407
+ - Save the updated presentation
408
+
409
+ Example validation errors:
410
+ ```
411
+ ERROR: Invalid shapes in replacement JSON:
412
+ - Shape 'shape-99' not found on 'slide-0'. Available shapes: shape-0, shape-1, shape-4
413
+ - Slide 'slide-999' not found in inventory
414
+ ```
415
+
416
+ ```
417
+ ERROR: Replacement text made overflow worse in these shapes:
418
+ - slide-0/shape-2: overflow worsened by 1.25" (was 0.00", now 1.25")
419
+ ```
420
+
421
+ ## Creating Thumbnail Grids
422
+
423
+ To create visual thumbnail grids of PowerPoint slides for quick analysis and reference:
424
+
425
+ ```bash
426
+ python scripts/thumbnail.py template.pptx [output_prefix]
427
+ ```
428
+
429
+ **Features**:
430
+ - Creates: `thumbnails.jpg` (or `thumbnails-1.jpg`, `thumbnails-2.jpg`, etc. for large decks)
431
+ - Default: 5 columns, max 30 slides per grid (5×6)
432
+ - Custom prefix: `python scripts/thumbnail.py template.pptx my-grid`
433
+ - Note: The output prefix should include the path if you want output in a specific directory (e.g., `workspace/my-grid`)
434
+ - Adjust columns: `--cols 4` (range: 3-6, affects slides per grid)
435
+ - Grid limits: 3 cols = 12 slides/grid, 4 cols = 20, 5 cols = 30, 6 cols = 42
436
+ - Slides are zero-indexed (Slide 0, Slide 1, etc.)
437
+
438
+ **Use cases**:
439
+ - Template analysis: Quickly understand slide layouts and design patterns
440
+ - Content review: Visual overview of entire presentation
441
+ - Navigation reference: Find specific slides by their visual appearance
442
+ - Quality check: Verify all slides are properly formatted
443
+
444
+ **Examples**:
445
+ ```bash
446
+ # Basic usage
447
+ python scripts/thumbnail.py presentation.pptx
448
+
449
+ # Combine options: custom name, columns
450
+ python scripts/thumbnail.py template.pptx analysis --cols 4
451
+ ```
452
+
453
+ ## Converting Slides to Images
454
+
455
+ To visually analyze PowerPoint slides, convert them to images using a two-step process:
456
+
457
+ 1. **Convert PPTX to PDF**:
458
+ ```bash
459
+ soffice --headless --convert-to pdf template.pptx
460
+ ```
461
+
462
+ 2. **Convert PDF pages to JPEG images**:
463
+ ```bash
464
+ pdftoppm -jpeg -r 150 template.pdf slide
465
+ ```
466
+ This creates files like `slide-1.jpg`, `slide-2.jpg`, etc.
467
+
468
+ Options:
469
+ - `-r 150`: Sets resolution to 150 DPI (adjust for quality/size balance)
470
+ - `-jpeg`: Output JPEG format (use `-png` for PNG if preferred)
471
+ - `-f N`: First page to convert (e.g., `-f 2` starts from page 2)
472
+ - `-l N`: Last page to convert (e.g., `-l 5` stops at page 5)
473
+ - `slide`: Prefix for output files
474
+
475
+ Example for specific range:
476
+ ```bash
477
+ pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide # Converts only pages 2-5
478
+ ```
479
+
480
+ ## Code Style Guidelines
481
+ **IMPORTANT**: When generating code for PPTX operations:
482
+ - Write concise code
483
+ - Avoid verbose variable names and redundant operations
484
+ - Avoid unnecessary print statements
485
+
486
+ ## Dependencies
487
+
488
+ Required dependencies (should already be installed):
489
+
490
+ - **markitdown**: `pip install "markitdown[pptx]"` (for text extraction from presentations)
491
+ - **pptxgenjs**: `npm install -g pptxgenjs` (for creating presentations via html2pptx)
492
+ - **playwright**: `npm install -g playwright` (for HTML rendering in html2pptx)
493
+ - **react-icons**: `npm install -g react-icons react react-dom` (for icons)
494
+ - **sharp**: `npm install -g sharp` (for SVG rasterization and image processing)
495
+ - **LibreOffice**: `sudo apt-get install libreoffice` (for PDF conversion)
496
+ - **Poppler**: `sudo apt-get install poppler-utils` (for pdftoppm to convert PDF to images)
497
+ - **defusedxml**: `pip install defusedxml` (for secure XML parsing)