openpencil/tests/engine
Danila Poyarkov 3849872b32 Unify tool definitions: define once, adapt for AI/CLI/MCP
Move tool logic to @open-pencil/core/tools/schema.ts as framework-agnostic
ToolDef objects. AI adapter generates valibot schemas + Vercel AI tool()
wrappers automatically.

26 tools (was 10): create_shape, render (JSX), set_fill, set_stroke,
set_effects, set_layout, set_constraints, update_node, delete, clone,
rename, reparent, group/ungroup, find_nodes, get_node, get_page_tree,
get_selection, select, list_pages, switch_page, list_variables,
list_collections, create_component, create_instance, eval.

src/ai/tools.ts: 269→28 lines (adapter only).

Tests for all 3 interfaces:
- 26 core tool tests (FigmaAPI directly)
- 11 AI adapter tests (valibot + Vercel AI SDK tool())
- 12 CLI integration tests (eval command on .fig fixture)
323 total, all passing.
2026-03-01 15:02:05 +03:00
..
eval-cli.test.ts Add 17 CLI integration tests for eval command 2026-03-01 13:07:06 +03:00
export-jsx.test.ts Add Code tab with JSX export and syntax highlighting 2026-03-01 12:12:45 +03:00
fig-import.test.ts Add fig-import unit tests for Tier 1 rendering features 2026-02-28 16:43:43 +03:00
fig-roundtrip.test.ts Add .fig roundtrip tests: real file parsing, property invariants, encode/decode cycle 2026-03-01 10:33:58 +03:00
figma-api.test.ts Fill Figma Plugin API gaps: 29 new tests, 30+ new properties and methods 2026-03-01 13:35:02 +03:00
layout.test.ts Add layout tests, fix cross-axis sizing bugs 2026-02-28 13:59:39 +03:00
render.test.ts JSX renderer in @open-pencil/core 2026-03-01 10:42:06 +03:00
scene-graph.test.ts Add variables support: collections, modes, bindings, UI panel 2026-03-01 01:47:52 +03:00
tools-ai-adapter.test.ts Unify tool definitions: define once, adapt for AI/CLI/MCP 2026-03-01 15:02:05 +03:00
tools-cli.test.ts Unify tool definitions: define once, adapt for AI/CLI/MCP 2026-03-01 15:02:05 +03:00
tools.test.ts Unify tool definitions: define once, adapt for AI/CLI/MCP 2026-03-01 15:02:05 +03:00