Commit graph

26 commits

Author SHA1 Message Date
rcoenen db15d8d583
fix(tools): create vectors from SVG paths (#440)
- Accept SVG path data with tight curve-aware node bounds
- Validate complete VectorNetwork topology while preserving JSON input
- Reject empty and malformed paths before creating blank layers

Co-authored-by: Danila Poyarkov <dev@dannote.net>
2026-08-01 20:17:42 +03:00
rcoenen 9f80c35838
fix(tools): describe visible strokes (#447)
- Include stroke color and rounded weight in node and child summaries
- Select the first visible stroke when hidden paints precede it
- Cover both describe output paths with mixed stroke visibility

Co-authored-by: Rob Coenen <753704+rcoenen@users.noreply.github.com>
2026-08-01 17:40:30 +03:00
rcoenen 90d1d37113
fix(design-jsx): accept inline SVG attributes (#445)
- Validate inline SVG roots against their supported root props
- Leave descendant SVG markup to the SVG renderer instead of Design JSX validation
- Keep warnings for unsupported root props and cover both paths

Co-authored-by: Rob Coenen <753704+rcoenen@users.noreply.github.com>
2026-08-01 16:57:32 +03:00
rcoenen bffd53d349
fix(tools): describe every supported shape (#448)
- Name every create_shape node type in the tool description
- Direct arbitrary geometry requests to SVG-backed create_vector input
- Keep the prose synchronized with the declared type enum

Co-authored-by: Rob Coenen <753704+rcoenen@users.noreply.github.com>
2026-08-01 16:39:57 +03:00
Danila Poyarkov bfe9a5a4ba test(core): cover utility-backed API boundaries
- Exercise Iconify query encoding and HTTP error handling with an injected fetch client

- Verify strict JSON parsing rejects malformed and prototype-polluting stock photo requests
2026-07-13 10:15:39 +03:00
Joseph Cumines 99e4153ec5 test(tools): create control-case node on the plain graph
CodeRabbit found the RotatedPlain control node was created on
instead of , so the unstroked control assertion was not actually
validating the same setup without a stroke.
2026-06-19 11:47:37 +10:00
Joseph Cumines ad22513bc7 fix(tools): address CodeRabbit review on analyze_overlaps
- Export OverlapScope, AnalyzeOverlapsSummary, and OverlapIntersection
  from the analyze barrel so consumers don't deep-import.
- Expand the local rectangle by stroke overflow before transforming
  through the world matrix, so stroked rotated nodes get their true
  rotated footprint instead of an underestimated canvas-space expansion.
- Add clipPolygon to geometry and preserve the clipped polygon through
  the full clip chain in computeNodeBounds, so a later outer clip can't
  reintroduce corners an inner clip already removed.
- Cap returned overlaps to an empty list when limit is 0 or negative;
  summary totals still reflect the complete result set.
- Trim whitespace from scope and severity inputs so " major " resolves.
- Add geometry and overlap tests covering each fix.
2026-06-19 11:38:38 +10:00
Joseph Cumines f862beb08d Add heuristic overlap detection tool and CLI
Implement the analyze overlaps CLI command, RPC endpoint, and ToolDef
to enable heuristic detection of visual overlaps, parent overflows, and
overlay patterns. Geometry computation now uses world-matrix visual
bounds to handle nested ancestor rotations and clipping frames correctly.

Update file-backed CLI commands to use Node fs/promises instead of Bun
runtime file APIs. This is required for the published CLI to function
when installed and executed in a standard Node environment. Add the
package.json subpath export to the core package for metadata consumers.
2026-06-19 09:54:27 +10:00
Danila Poyarkov 1ed7de6056 chore(lint): reject broad unknown type assertions
- Add AST-based lint checks for broad unknown object assertions and local JsonObject aliases
- Centralize JsonObject in core and package-local MCP RPC JSON typing
- Replace baseline Record<string, unknown> assertions with named shared/domain types
2026-05-25 00:26:02 +03:00
Danila Poyarkov abd795bd9a chore: format codebase 2026-05-24 12:15:29 +03:00
Danila Poyarkov 779e0e493f fix(mcp): improve agent-rendered JSX 2026-05-19 17:57:43 +03:00
Danila Poyarkov 39acdd82c7 test(engine): split image coverage by domain 2026-05-16 12:38:00 +03:00
Danila Poyarkov 6eb50affc4 test(engine): move root tests into domains 2026-05-16 12:30:27 +03:00
Danila Poyarkov a1339e845b refactor(tools): use acorn AST parser for eval wrapping
Replace hand-rolled regex heuristic with proper acorn JS parsing.
The AST correctly identifies ExpressionStatement as the last node
regardless of trailing semicolons, comments, or complex syntax.

Fixes edge cases like '42;' which the regex wrongly treated as a
statement.

Co-authored-by: stiff <v.stiff@gmail.com>
Co-authored-by: Jais Pedersen <jais@pedersens.net>
2026-05-11 12:15:38 +03:00
Danila Poyarkov 9e013e60e7 fix(mcp): fix stdio handshake and eval return values
Stdio handshake:
Server now sends { type: register, token } to WebSocket clients on
connection, so the stdio bridge receives the token immediately instead
of deadlocking while both sides wait to receive.

Eval return values (REPL-style):
Add wrapEvalCode() that detects when the last non-empty line is a value
expression and promotes it to a return statement. Bare expressions like
JSON.stringify(result) now return the value instead of undefined.
Single implementation in packages/core/src/tools/analyze/eval-wrap.ts
used by both the tool and the automation bridge.

Co-authored-by: stiff <v.stiff@gmail.com>
Co-authored-by: Jais Pedersen <jais@pedersens.net>
2026-05-11 12:05:43 +03:00
Danila Poyarkov 432f945da6 chore(tests): narrow no-empty-function exceptions
- Replace simple no-op test callbacks with explicit undefined returns
- Remove no-empty-function exceptions for autosave, stroke picker, font settings, pen, tauri, AI adapter, and undo helper tests
- Validate check plus affected engine and E2E tests
2026-05-06 12:32:54 +03:00
Danila Poyarkov 1367ee3b35 chore(tests): guard modify tool assertions
- Replace non-null assertions in modify tool tests
- Use expectDefined and getNodeOrThrow for graph, proxy, and style-run lookups
- Validate check and affected modify tool tests
2026-05-06 11:20:49 +03:00
Danila Poyarkov 6ec18f1dfb chore(tests): remove targeted non-null assertions
- Replace low-count E2E non-null assertions with store guards and optional expectations
- Use expectDefined for tool adapter and XPath node lookups
- Validate affected engine and E2E tests
2026-05-06 03:13:58 +03:00
Danila Poyarkov 39675b2969 chore(tests): remove easy non-null assertions
- Replace browser store non-null assertions with explicit initialization guards
- Use expectDefined for optional test resources and tool results
- Clean low-count non-null assertions in font, icon, snap, OKHCL, and visual tests
2026-05-06 02:59:56 +03:00
Danila Poyarkov 9e4d7bee5d chore(lint): fix unused test code
- Remove stale imports and unused locals from split engine and e2e tests
- Drop the targeted no-unused-vars test allowances
- Keep check and affected test suites warning-free
2026-05-06 02:53:19 +03:00
Danila Poyarkov a63ac93a3d chore(lint): enforce type imports in tests
- Remove the broad test exception for consistent type imports
- Mark test-only core and helper imports as type imports where appropriate
- Keep targeted validation for affected engine tests
2026-05-06 02:35:57 +03:00
Danila Poyarkov 654aa421e9 chore(lint): reduce test rule exceptions
- Re-enable duplicate imports, radix, prefer-const, nested ternary, and silent catch checks in tests
- Drop the redundant spec-file override covered by the broader test override
- Fix the remaining test offenders surfaced by the stricter rules
2026-05-06 02:31:07 +03:00
Danila Poyarkov c3f5189f8f style: tighten import grouping
- Configure oxfmt custom import groups for workspace, app, package, and test aliases
- Keep type imports grouped with their matching source category instead of one global tail group
- Expand the format script to cover formatter config, Vite files, and scripts
2026-05-06 02:22:08 +03:00
Danila Poyarkov 930cf39216 test: organize prefixed test files into folders
- Move top-level engine and e2e prefixed test files under domain folders
- Update fixture path helpers after moving render and pen tests
- Add lint coverage to prevent new top-level prefixed test files
- Refresh testing docs for the new fig and layout paths
2026-05-06 02:13:18 +03:00
Danila Poyarkov e42dffa003 chore(lint): consolidate oxlint config
- Merge structural lint rules into oxlint.json and remove the second config file
- Add #tests/* path aliases and rewrite deep test helper imports
- Ban new deep parent-relative imports through the shared lint config
2026-05-06 02:05:02 +03:00
Danila Poyarkov 2aecb2df85 test(tools): split tool registry coverage
- Move tools.test.ts into focused registry, create, modify, read, and structure files
- Add shared tool test helpers for graph setup and tool lookup
- Preserve all 38 tool tests after the split
2026-05-06 01:51:19 +03:00