feat: add sketch harness#123
Conversation
|
the test results look good to me! putting an approval on my side |
|
Nice work on the tests — the ZIP structure validation is solid. Two quick questions before I approve:
|
|
Thank you for your question. @omerarslan0 Question 1: Currently, there are many design drafting tools available, but most are commercially operated, and there isn't any open-source design drafting software that can be directly operated using a CLI. To meet the Agent's need to directly draw design drafts, I chose sketch-constructor to create a .sketch format file because its format is publicly available, and the official website also provides sketch-constructor to help with construction (it may not support some advanced features). Question 2: This tool is temporary, but our need is real. If software that supports a CLI becomes available in the future, I will create it based on that. |
|
I think it makes sense if the CLI supports building realistic and valid .sketch files that Sketch can open. If rendering is not actually needed for the use-cases with Sketch, this'd be enough and complete. |
|
@omerarslan0 bypassing the limitations and merging this first. This may be interesting to a group of people. |
Description
Add a CLI harness for Sketch — generates .sketch design files from JSON design
specifications using sketch-constructor (Node.js). This is the first non-Python
harness in the project, built with Commander.js instead of Click, and Jest instead of
pytest.
The CLI supports:
design tokens, and component primitives (rect, text, circle, image, group)
Type of Change
For New Software CLIs
without backend
Jest
General Checklist
Test Results
PASS tests/build.test.js
sketch-cli build
example: login-page
✓ input JSON exists
✓ builds without errors (104 ms)
✓ output file exists
✓ output is a valid ZIP file (PK magic bytes)
✓ ZIP contains required Sketch structure (5 ms)
✓ ZIP contains at least one page JSON (3 ms)
example: dashboard
✓ input JSON exists
✓ builds without errors (77 ms)
✓ output file exists
✓ output is a valid ZIP file (PK magic bytes) (1 ms)
✓ ZIP contains required Sketch structure (3 ms)
✓ ZIP contains at least one page JSON (3 ms)
example: card-list
✓ input JSON exists
✓ builds without errors (79 ms)
✓ output file exists
✓ output is a valid ZIP file (PK magic bytes) (1 ms)
✓ ZIP contains required Sketch structure (3 ms)
✓ ZIP contains at least one page JSON (3 ms)
sketch-cli list-styles
✓ lists styles from default tokens (58 ms)
Test Suites: 1 passed, 1 total
Tests: 19 passed, 19 total
Snapshots: 0 total
Time: 0.458 s