Skip to content

feat: add sketch harness#123

Merged
yuh-yang merged 2 commits into
HKUDS:mainfrom
zhangxilong-43:feature/add-sketch-harness
Mar 23, 2026
Merged

feat: add sketch harness#123
yuh-yang merged 2 commits into
HKUDS:mainfrom
zhangxilong-43:feature/add-sketch-harness

Conversation

@zhangxilong-43

Copy link
Copy Markdown
Collaborator

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:

  • sketch-cli build — builds .sketch files from JSON design specs with artboard layout,
    design tokens, and component primitives (rect, text, circle, image, group)
  • sketch-cli list-styles — lists available shared styles from design tokens
  • Three example specs included: login page, dashboard, card list

Type of Change

  • New Software CLI — adds a CLI harness for a new application

For New Software CLIs

  • .md SOP document exists at /agent-harness/.md
  • SKILL.md exists inside the Python package (cli_anything//SKILL.md)
  • Unit tests at cli_anything//tests/test_core.py are present and pass
    without backend
    • Note: Node.js harness — tests at sketch/agent-harness/tests/build.test.js, run via
      Jest
  • E2E tests at cli_anything//tests/test_full_e2e.py are present
  • README.md includes the new software (with link to harness directory)
  • registry.json includes an entry for the new software (for the CLI-Hub)
  • repl_skin.py in utils/ is an unmodified copy from the plugin
    • N/A: Node.js harness, no repl_skin.py

General Checklist

  • Code follows existing patterns and conventions
  • --json flag is supported on any new commands
  • Commit messages follow the conventional format (feat:, fix:, docs:, test:)
  • I have tested my changes locally

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

@yuh-yang yuh-yang added the community-contrib-CLI Community-contributed CLI or harness label Mar 22, 2026
@yuh-yang

Copy link
Copy Markdown
Collaborator

the test results look good to me! putting an approval on my side

yuh-yang
yuh-yang previously approved these changes Mar 22, 2026
@omerarslan0

Copy link
Copy Markdown
Collaborator

Nice work on the tests — the ZIP structure validation is solid.

Two quick questions before I approve:

  1. Sketch is macOS-only — do the tests actually invoke Sketch, or just generate the .sketch ZIP format? If it's the latter, this is more of a file format generator than a true Sketch harness.

  2. sketch-constructor dependency — the library appears to be largely unmaintained, and Sketch's file format changes frequently. Is there a plan if it breaks with a future Sketch version?

@zhangxilong-43

zhangxilong-43 commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator Author

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.

@yuh-yang

Copy link
Copy Markdown
Collaborator

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.

@yuh-yang

Copy link
Copy Markdown
Collaborator

@omerarslan0 bypassing the limitations and merging this first. This may be interesting to a group of people.

@yuh-yang yuh-yang merged commit ffa5238 into HKUDS:main Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contrib-CLI Community-contributed CLI or harness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants