Commit aff3c88
feat: enhance Figma integration with full API property coverage (#251)
* feat: expose --max-cost CLI flag with cost threshold warnings
Wire the existing maxCost infrastructure to a new --max-cost CLI option.
When no budget is set, warn users at $2/$5/$10 thresholds to encourage
setting a limit. This is opt-in only — no default limit that could break
existing long-running loops.
Closes #211
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Figma-specific agent prompts in context builder
When sourceType is 'figma', inject domain-specific guidelines into the
agent preamble: auto-layout to flexbox/grid mapping, color token
extraction with @theme inline, typography fidelity, constraint
conversion, responsive breakpoints, and placeholder images.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: auto-inject Figma design tokens and cap spec size
When fetching from Figma in default 'spec' mode, also fetch design
tokens (CSS variables) and prepend them to the spec. The agent gets
ready-to-use tokens for @theme inline instead of parsing the raw tree.
Also pass all Figma CLI options through to fetchFromSource (previously
only label/status/limit/issue were passed).
Cap in-prompt spec at 15KB to reduce token waste — full spec remains
on disk in specs/ directory.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: show model name and cost in loop header and separator
Display the model name (e.g. '3-sonnet') and cumulative cost in the
loop header subtitle line, and add the full model name to the iteration
separator. Users can now see what model is running and how much it costs
at a glance.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add context-builder and task-executor tests
Add 42 new tests covering:
- buildIterationContext: preamble content, Tailwind v4 guidance,
iteration-aware trimming (full/abbreviated/minimal), plan rules,
design quality guidelines, validation feedback, iteration log
- compressValidationFeedback: truncation, section headers, ANSI stripping
- buildTrimmedPlanContext: task info, subtasks, completion counts
- buildCommitMessage: conventional commit detection (feat/fix/docs/
refactor/test/chore), prefix stripping (bracket and colon formats)
- buildPrBody: task URL, description truncation, execution details
Export buildCommitMessage and buildPrBody for testability.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: enhance Figma integration with full API property coverage
Add ~20 missing Figma REST API properties to types, parsers, and agent
guidelines for significantly improved design-to-code fidelity.
Layout: layoutSizingHorizontal/Vertical (FIXED/HUG/FILL), layoutWrap,
layoutPositioning (absolute children), counterAxisSpacing, layoutAlign,
min/maxWidth/Height, clipsContent, scrollBehavior, overflowDirection.
Visual: individualStrokeWeights (per-side borders), strokeDashes,
rotation, isMask, imageTransform→object-position, image filters→CSS
filter(), hero section detection, icon SVG export.
Typography: fontStyle, textTruncation + maxLines with CSS line-clamp
hints, hyperlink detection.
Effects: progressive blur detection, backdrop-filter hints.
New parsers: font-checker (Google Fonts validation), image-collector,
icon-collector (VECTOR/INSTANCE node detection + SVG export).
Agent guidelines updated with sizing, wrap, absolute positioning,
overflow, sticky/fixed, borders, rotation, and image filter rules.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add universal design-to-code rules for z-index, image priority, and sequential patterns
- Text/content elements always get higher z-index than visual layers (universal stacking rule)
- Classify image semantic importance: person images are CRITICAL priority, never hidden at any breakpoint
- Detect sequential/numbered patterns (01, 02, 03) in sibling elements, preserve exact design order
- Add Universal Stacking & Layout Rules section to generated implementation plans
- Add image-optimizer utility and plan-generator for Figma integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prevent division-by-zero in imageTransformToObjectPosition
Replace magic 0.99 threshold with epsilon-based comparison
(1e-4) to eliminate the gap where values in [0.99, 1.0) could
cause division by near-zero or inconsistent behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: sanitize Figma asset filenames and validate CDN URLs
Add sanitizeAssetFilename(), isValidFigmaCdnUrl(), and
sanitizeSvgContent() utilities. Apply to all four Figma
asset download locations in run.ts to prevent path traversal,
SSRF, and SVG XSS attacks.
Addresses GitHub Advanced Security review comments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: harden security sanitization and eliminate TOCTOU races
- Rewrite sanitizeSvgContent with iterative stripping for nested/malformed tags
- Add PNG magic byte validation (isValidPngBuffer) for all image downloads
- Remove existsSync checks before mkdirSync (TOCTOU race conditions)
- Remove unused existsSync import from source.ts
- Update pnpm-lock.yaml for sharp optional dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve remaining CodeQL security alerts
- Rewrite sanitizeSvgContent with substring-based parser instead of
regex to satisfy CodeQL js/bad-tag-filter and
js/incomplete-multi-character-sanitization rules
- Fix TOCTOU race in readCache using fd-based stat+read (openSync/fstatSync)
- Fix TOCTOU race in image-optimizer using readFileSync buffer instead
of separate statSync + sharp(filePath) calls
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent a43c8a9 commit aff3c88
24 files changed
Lines changed: 4319 additions & 126 deletions
File tree
- docs
- blog
- docs/sources
- src
- commands
- integrations/figma
- data
- parsers
- utils
- loop
- skills
- ui
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
93 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
94 | 108 | | |
95 | 109 | | |
96 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
250 | 275 | | |
251 | 276 | | |
252 | 277 | | |
| |||
255 | 280 | | |
256 | 281 | | |
257 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
258 | 334 | | |
259 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
260 | 349 | | |
261 | 350 | | |
262 | 351 | | |
| |||
278 | 367 | | |
279 | 368 | | |
280 | 369 | | |
| 370 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
0 commit comments