@zseven-w/qoder-openpencil 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +77 -0
- package/LICENSE +21 -0
- package/NOTICE +10 -0
- package/README.md +46 -2
- package/README.zh.md +38 -0
- package/THIRD_PARTY_NOTICES.md +69 -0
- package/bin/qoder-openpencil.mjs +90 -0
- package/package.json +71 -4
- package/platforms.json +65 -0
- package/plugins/openpencil/.mcp.json +10 -0
- package/plugins/openpencil/.qoder-plugin/plugin.json +19 -0
- package/plugins/openpencil/CONNECTORS.md +9 -0
- package/plugins/openpencil/LICENSE +21 -0
- package/plugins/openpencil/NOTICE +10 -0
- package/plugins/openpencil/assets/icon.png +0 -0
- package/plugins/openpencil/assets/logo.png +0 -0
- package/plugins/openpencil/mcp.json +11 -0
- package/plugins/openpencil/plugin.json +19 -0
- package/plugins/openpencil/scripts/browser-launch.mjs +37 -0
- package/plugins/openpencil/scripts/canvas-codegen.mjs +141 -0
- package/plugins/openpencil/scripts/canvas-controller.mjs +293 -0
- package/plugins/openpencil/scripts/canvas-images.mjs +93 -0
- package/plugins/openpencil/scripts/canvas-panel.mjs +82 -0
- package/plugins/openpencil/scripts/canvas-selection.mjs +61 -0
- package/plugins/openpencil/scripts/document-format.mjs +48 -0
- package/plugins/openpencil/scripts/editor-runtime.mjs +453 -0
- package/plugins/openpencil/scripts/editor-session.mjs +230 -0
- package/plugins/openpencil/scripts/launch-mcp +22 -0
- package/plugins/openpencil/scripts/launch-mcp.cmd +21 -0
- package/plugins/openpencil/scripts/mcp-bridge.mjs +70 -0
- package/plugins/openpencil/scripts/runtime-install.mjs +128 -0
- package/plugins/openpencil/scripts/transport.mjs +138 -0
- package/plugins/openpencil/skills/openpencil-design/SKILL.md +125 -0
- package/plugins/openpencil/skills/openpencil-design/references/codegen.md +34 -0
- package/plugins/openpencil/skills/openpencil-design/references/images.md +54 -0
- package/plugins/openpencil/skills/openpencil-design/references/node-schema.md +208 -0
- package/plugins/openpencil/skills/openpencil-setup/SKILL.md +59 -0
- package/plugins/openpencil/ui/app.html +226 -0
- package/plugins/openpencil/ui/codegen.js +80 -0
- package/plugins/openpencil/ui/panel.css +311 -0
- package/plugins/openpencil/ui/panel.html +11 -0
- package/plugins/openpencil/ui/panel.js +219 -0
- package/plugins/openpencil/ui/selection.js +19 -0
- package/scripts/build-editor-runtime.mjs +35 -0
- package/scripts/canvas.mjs +75 -0
- package/scripts/check-package.mjs +81 -0
- package/scripts/check-release-version.mjs +53 -0
- package/scripts/collab-bootstrap-config.mjs +66 -0
- package/scripts/configure-runtime.mjs +15 -0
- package/scripts/host-config.mjs +352 -0
- package/scripts/managed-handshake.mjs +23 -0
- package/scripts/node-registration.mjs +17 -0
- package/scripts/pack-package.mjs +41 -0
- package/scripts/pack-plugin.mjs +166 -0
- package/scripts/platforms.mjs +84 -0
- package/scripts/plugin-host-check.mjs +174 -0
- package/scripts/publish-release.mjs +294 -0
- package/scripts/registry-convergence.mjs +40 -0
- package/scripts/setup.mjs +147 -0
- package/scripts/stage-editor-runtime.mjs +189 -0
- package/scripts/sync-platform-versions.mjs +63 -0
- package/scripts/verify-platform-packages.mjs +270 -0
- package/scripts/verify-selective-install.mjs +219 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpencil-design
|
|
3
|
+
description: Create or edit editable .op UI designs with the Qoder OpenPencil plugin, including the embedded Rust MCP App canvas (Global tab & Session Sidebar), layout inspection, PNG previews, and verified saves. Use for OpenPencil or OP/op design requests such as “用op设计” or “用 OP 修改选中元素”, not generic frontend implementation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Design with OpenPencil in Qoder
|
|
7
|
+
|
|
8
|
+
Recognize “OP” and “op” as OpenPencil in requests for UI design, canvas edits
|
|
9
|
+
or `.op` files, including “用op设计一个单页 APP”. Open or reuse this plugin's
|
|
10
|
+
conversation canvas; export to code only when the user requests implementation.
|
|
11
|
+
|
|
12
|
+
Use the connected Rust MCP tools as the source of truth. Start with
|
|
13
|
+
`get_editor_state` and read the relevant nodes. Preserve existing document
|
|
14
|
+
content and use the user's chosen file, page, selection, and reference.
|
|
15
|
+
For connection failures, see [setup](../openpencil-setup/SKILL.md).
|
|
16
|
+
|
|
17
|
+
## Open the interactive canvas
|
|
18
|
+
|
|
19
|
+
For an interactive conversation canvas in Qoder, call `open_canvas` (passing the
|
|
20
|
+
user's existing absolute `.op` path, or omitting it for a new document). Qoder's
|
|
21
|
+
MCP Apps host natively mounts the Rust WASM canvas in an independent fullscreen
|
|
22
|
+
workspace tab or side-by-side session sidebar tab (users can also open it directly
|
|
23
|
+
from **More → OpenPencil Canvas** or the session sidebar **+ → Apps** menu).
|
|
24
|
+
When working in a remote session or CLI environment without MCP Apps rendering,
|
|
25
|
+
use `canvas_open_browser` and present the returned `panelUrl`. Verify
|
|
26
|
+
`canvas_status` and `get_editor_state` before making edits; all native tools then
|
|
27
|
+
edit that managed canvas. Do not open a new managed document just to inspect an
|
|
28
|
+
existing desktop editor selection.
|
|
29
|
+
|
|
30
|
+
## Establish the output
|
|
31
|
+
|
|
32
|
+
For a new design, resolve **one page or multiple pages** explicitly if the brief
|
|
33
|
+
does not establish it; continue inspecting references while awaiting the answer.
|
|
34
|
+
Do not silently choose three pages. Distinguish document pages from top-level
|
|
35
|
+
frames/boards. Establish viewport and content goals from the brief. Preserve
|
|
36
|
+
provided copy; do not reduce real content to fit a decorative mockup.
|
|
37
|
+
|
|
38
|
+
Load only the relevant connected design guidelines/style guides/UI kits.
|
|
39
|
+
Use [node and layout reference](references/node-schema.md) for field conventions;
|
|
40
|
+
the live tool schemas and guidelines take precedence over this bundled snapshot.
|
|
41
|
+
Reuse the document's variables, components, and style before inventing new ones.
|
|
42
|
+
For a new phone screen, load `get_guidelines` with `topic: "mobile"` before
|
|
43
|
+
creating its root frame. Use the Rust runtime's canonical status bar; do not
|
|
44
|
+
hand-draw a replacement or use emoji for system indicators.
|
|
45
|
+
|
|
46
|
+
## Image acquisition
|
|
47
|
+
|
|
48
|
+
For new photos, illustrations or product imagery needed by the design, use
|
|
49
|
+
Qoder's available image-generation capability by default. Preserve suitable
|
|
50
|
+
user-provided/existing images and keep native text, controls and vector artwork
|
|
51
|
+
editable. Before generation, send a brief chat progress update describing the
|
|
52
|
+
intended assets and noting that generation may consume Qoder credits/quota.
|
|
53
|
+
Continue without a separate per-call permission question while respecting
|
|
54
|
+
host-required approvals. Do not invent a credit balance, price or refund claim.
|
|
55
|
+
|
|
56
|
+
Honor requests such as “不要生图”, “只搜图” or “use stock images only” throughout
|
|
57
|
+
the task. The plugin does not invoke generation providers itself or store API
|
|
58
|
+
keys. Unavailable/failed generation falls back to stock search with a clear note;
|
|
59
|
+
never silently switch providers, call a separate paid API, or retry an uncertain
|
|
60
|
+
generation. Reuse successful assets after an import/save failure instead of
|
|
61
|
+
generating them again.
|
|
62
|
+
|
|
63
|
+
For image slots, search fallback and local-asset import, read the
|
|
64
|
+
[image workflow](references/images.md). Images are assets within editable UI;
|
|
65
|
+
keep text, controls and layout as native nodes.
|
|
66
|
+
|
|
67
|
+
## Build and edit
|
|
68
|
+
|
|
69
|
+
For prompts such as “modify the selected elements”, call `canvas_selection` on
|
|
70
|
+
the managed canvas immediately before planning the edit. It returns `pageId`,
|
|
71
|
+
`nodeIds`, names, types and parent IDs. Read the selected nodes with `batch_get`;
|
|
72
|
+
limit edits to those nodes and their descendants. An empty selection is not a
|
|
73
|
+
request to edit the whole page: ask the user to select a target. For a desktop
|
|
74
|
+
editor without a managed canvas, use `get_editor_state` and read its selection.
|
|
75
|
+
|
|
76
|
+
Use the current Qoder chat for instructions, progress and results. Treat host
|
|
77
|
+
selection context (`ui/update-model-context`) as a hint and verify it with
|
|
78
|
+
`canvas_selection` when starting the edit. Once the target is resolved, keep those
|
|
79
|
+
node IDs through the edit rather than silently following later selection changes.
|
|
80
|
+
If the document/page no longer matches or a target was deleted, stop and explain
|
|
81
|
+
rather than choosing another target. Preview the affected roots and verify the
|
|
82
|
+
saved design before reporting completion.
|
|
83
|
+
|
|
84
|
+
- Create fresh UI trees using `batch_design.script`: sandboxed JavaScript with
|
|
85
|
+
`I(parent, node)` and `K(kitRef, parent, overrides)`, helpers, arrays, and loops.
|
|
86
|
+
Build section by section; keep each batch at most 25 recorded operations.
|
|
87
|
+
Reuse returned IDs, not assumed ID sequences.
|
|
88
|
+
- After creating a phone root, read it back before adding screen content. Locate
|
|
89
|
+
and preserve the runtime's `role: "status-bar"` subtree, including its children.
|
|
90
|
+
If it is absent, diagnose the connected runtime and guidelines before
|
|
91
|
+
proceeding; do not invent a bar and claim native support was verified.
|
|
92
|
+
Respect existing custom bars and explicit requests for no status bar.
|
|
93
|
+
- Use `batch_design.operations` for editing existing nodes with `U/C/R/M/D/G`.
|
|
94
|
+
Do not mix creation and edits in script, and do not use `I()` in operations.
|
|
95
|
+
Prefer native UI kits (`list_ui_kits`) for standard controls.
|
|
96
|
+
- The batch is transactional. When it returns errors, repair the whole failing
|
|
97
|
+
batch before resending. After a transport timeout, inspect the canvas first:
|
|
98
|
+
a write may already have applied. Never automatically retry a mutation.
|
|
99
|
+
- Use horizontal/vertical layout, padding, gap, and container sizing deliberately.
|
|
100
|
+
For repeated cards in a row, use consistent `fill_container` widths.
|
|
101
|
+
Absolute x/y coordinates on children do not replace a proper flow layout.
|
|
102
|
+
- Use `design_refine` on the affected root when appropriate, then inspect the
|
|
103
|
+
returned changes. After structural repair or `finalize_design`, reread
|
|
104
|
+
`get_editor_state` and `batch_get` because repaired trees may have new IDs.
|
|
105
|
+
|
|
106
|
+
## Inspect and deliver
|
|
107
|
+
|
|
108
|
+
1. Inspect `snapshot_layout` and run `lint_document` on the affected subtree.
|
|
109
|
+
Address clipping, overlap, unreadable text, and missing content.
|
|
110
|
+
2. Render affected roots with `get_screenshot` and actually view the image.
|
|
111
|
+
Check copy, hierarchy, spacing, colors, and reference fidelity.
|
|
112
|
+
For phone screens with system chrome, verify exactly one complete set of
|
|
113
|
+
time, cellular signal, Wi-Fi, and battery indicators.
|
|
114
|
+
3. For managed interactive persistence, the panel Save button flushes pending
|
|
115
|
+
browser edits. `canvas_save` and intercepted `save_document` save the daemon's
|
|
116
|
+
current snapshot; verify pending edits have synced before calling them. Save
|
|
117
|
+
As requires a new path; source conflicts stop saves and retain recovery drafts.
|
|
118
|
+
Read/reopen the saved file to verify page count and key nodes.
|
|
119
|
+
4. Return clickable absolute file links and local image previews where available.
|
|
120
|
+
Distinguish changes on canvas, saved artifacts, visual QA, and publication.
|
|
121
|
+
|
|
122
|
+
Use the embedded Qoder MCP App tab, browser panel, or native editor for
|
|
123
|
+
interactive editing. Do not describe a PNG preview as an embedded interactive
|
|
124
|
+
canvas. Export to code only when the user asks, following
|
|
125
|
+
[the code-generation workflow](references/codegen.md).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Code panel → Qoder implementation
|
|
2
|
+
|
|
3
|
+
Use this workflow when the user requests conversion to code, clicks Generate in
|
|
4
|
+
the managed canvas's Code panel, or says “继续转代码” / “continue converting to code”.
|
|
5
|
+
Selection reminders alone never authorize implementation.
|
|
6
|
+
|
|
7
|
+
1. Read `canvas_codegen_status` when continuing a panel request. Its `requestId`,
|
|
8
|
+
framework, page ID, node IDs and expected document version are fixed. Match its
|
|
9
|
+
request ID to the triggering message; stop if superseded or cancelled. Read
|
|
10
|
+
`canvas_status` and compare versions before work. If the design changed, ask
|
|
11
|
+
the user to generate a fresh request; do not silently convert another target.
|
|
12
|
+
2. Read the captured nodes with `batch_get`, inspect their native screenshot,
|
|
13
|
+
and inspect the current workspace. Follow the project's framework, components,
|
|
14
|
+
tokens and asset conventions. With no implementation project, create a small
|
|
15
|
+
runnable project in the current workspace without overwriting unrelated files.
|
|
16
|
+
3. The panel request includes deterministic `codegen_export` baseline source.
|
|
17
|
+
Use it as a structural starting point, not a claim of production readiness.
|
|
18
|
+
Inspect text, spacing, fonts, images, states, responsive behavior and accessibility.
|
|
19
|
+
Reuse image assets from the design; export required local assets into the project.
|
|
20
|
+
4. Implement and run relevant checks. For a web project, inspect the rendered
|
|
21
|
+
page against the native design screenshot. Do not modify the `.op` design as
|
|
22
|
+
a side effect of implementation.
|
|
23
|
+
5. For a panel request, call `canvas_codegen_complete` with its `requestId` and
|
|
24
|
+
the absolute `codePath` of the primary source file after verification. The
|
|
25
|
+
extension must match the requested framework (`.tsx`/`.jsx`, `.vue`, `.svelte`,
|
|
26
|
+
`.html`, `.dart`, `.swift`, or `.kt`) and be a regular UTF-8 file at most 2 MiB.
|
|
27
|
+
6. Return links to the runnable project and primary source, launch instructions,
|
|
28
|
+
checks performed and remaining limitations.
|
|
29
|
+
|
|
30
|
+
The embedded Qoder MCP App sends an explicit Generate request through `ui/message`
|
|
31
|
+
when local messaging is available (Qoder returns `{}` on acceptance). Standalone
|
|
32
|
+
browser panels and remote sessions without messaging keep the baseline source and
|
|
33
|
+
tell the user to say “继续转代码” in the current Qoder chat. Failed or uncertain
|
|
34
|
+
messages are never replayed automatically.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Image acquisition
|
|
2
|
+
|
|
3
|
+
## Qoder generation by default
|
|
4
|
+
|
|
5
|
+
Preserve suitable existing/user-provided images. For new photo, illustration or
|
|
6
|
+
product assets needed by the design, use Qoder's available built-in image
|
|
7
|
+
generation tool by default. Follow `SKILL.md`: announce the intended assets and
|
|
8
|
+
possible credit/quota use in a brief progress update, then proceed without a
|
|
9
|
+
separate permission question while respecting host-required approvals.
|
|
10
|
+
Honor explicit no-generation/stock-only instructions throughout the task.
|
|
11
|
+
|
|
12
|
+
Keep the resolved target IDs through generation and import. If a call times out,
|
|
13
|
+
check for an existing output instead of resubmitting. Generate only the required
|
|
14
|
+
asset; do not flatten the editable interface into an image. Preserve requested
|
|
15
|
+
transparency and inspect the actual output. Reuse completed assets after an
|
|
16
|
+
import/save failure. If generation is unavailable or fails, use stock search;
|
|
17
|
+
do not switch implicitly to an API/CLI requiring separate credentials.
|
|
18
|
+
|
|
19
|
+
## Stock search fallback and explicit stock-only requests
|
|
20
|
+
|
|
21
|
+
For search slots, use `type: "image"`, explicit dimensions and a concrete English
|
|
22
|
+
`imageSearchQuery` describing subject, action and composition. Omit `imagePrompt`
|
|
23
|
+
for this search route.
|
|
24
|
+
|
|
25
|
+
After structural repair, reread current node IDs. Run the native `enrich_images`
|
|
26
|
+
with `root_ids` scoped to the requested roots or selected image nodes, then read
|
|
27
|
+
its `targets`, `resolved`, `failed` and `unresolved` counts. Never omit scope for
|
|
28
|
+
a selected-subtree edit: omission fills the whole active page.
|
|
29
|
+
|
|
30
|
+
`enrich_images` is search-only (Openverse with Wikimedia fallback). A slot with
|
|
31
|
+
only `imagePrompt` is explicitly Generate and will be skipped. For an unresolved
|
|
32
|
+
slot covered by search fallback or a stock-only instruction, set a concrete
|
|
33
|
+
`imageSearchQuery` and clear `imagePrompt` with `update_node` before enrichment.
|
|
34
|
+
Do not overwrite already populated or unrelated slots.
|
|
35
|
+
|
|
36
|
+
## Import, inspect and persist
|
|
37
|
+
|
|
38
|
+
For a managed canvas:
|
|
39
|
+
|
|
40
|
+
1. Persist a chosen generated asset in the user's project asset directory with a
|
|
41
|
+
non-overwriting filename. Copy the actual output path returned by the tool or
|
|
42
|
+
materialize its available output bytes; do not guess a path or rely only on a
|
|
43
|
+
preview.
|
|
44
|
+
2. Read the current canvas and target. Confirm the document, page and original
|
|
45
|
+
image node still match the task. A later selection change does not retarget an
|
|
46
|
+
in-flight asset. Create an image node first if the design needs a new slot.
|
|
47
|
+
3. Call `canvas_import_image` with the absolute local `filePath`, exact `nodeId`,
|
|
48
|
+
active `pageId` and fresh `expectedVersion` from `canvas_status`. It accepts
|
|
49
|
+
PNG/JPEG/WebP up to 8 MiB, embeds the bytes in the document, clears resolved
|
|
50
|
+
acquisition hints and preserves geometry. A version mismatch requires a fresh
|
|
51
|
+
read and target review, not blind retry.
|
|
52
|
+
4. Render and view the affected root, inspect crop/subject/transparency and
|
|
53
|
+
unrelated content, then use `canvas_save`. Reopen/read the saved `.op` and
|
|
54
|
+
verify the image bytes are embedded, not a temporary path or `blob:` URL.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# OpenPencil node and layout reference
|
|
2
|
+
|
|
3
|
+
Adapted from the MIT-licensed OpenPencil bundled skill. The connected server
|
|
4
|
+
is authoritative: inspect its current schema and design guidelines before edits.
|
|
5
|
+
|
|
6
|
+
## PenNode Schema
|
|
7
|
+
|
|
8
|
+
### Common Properties
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"type": "frame|rectangle|text|ellipse|line|polygon|path|image|icon_font|group|ref",
|
|
13
|
+
"name": "Display Name",
|
|
14
|
+
"role": "semantic-role",
|
|
15
|
+
"x": 0, "y": 0,
|
|
16
|
+
"rotation": 0, "opacity": 1, "visible": true
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Container Properties (frame, rectangle, group, ellipse)
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"width": 400, // number | "fill_container" | "fit_content"
|
|
25
|
+
"height": 300,
|
|
26
|
+
"layout": "vertical", // "none" | "vertical" | "horizontal"
|
|
27
|
+
"gap": 16,
|
|
28
|
+
"padding": [16, 24], // number | [v, h] | [top, right, bottom, left]
|
|
29
|
+
"justifyContent": "center", // "start" | "center" | "end" | "space_between" | "space_around"
|
|
30
|
+
"alignItems": "center", // "start" | "center" | "end"
|
|
31
|
+
"clipContent": true,
|
|
32
|
+
"cornerRadius": 12, // number | [tl, tr, br, bl]
|
|
33
|
+
"fill": [{ "type": "solid", "color": "#FFFFFF" }],
|
|
34
|
+
"stroke": { "thickness": 1, "fill": [{ "type": "solid", "color": "#E5E7EB" }], "align": "inside", "dashPattern": [5, 3] },
|
|
35
|
+
"effects": [{ "type": "shadow", "offsetX": 0, "offsetY": 4, "blur": 12, "spread": 0, "color": "rgba(0,0,0,0.08)" }],
|
|
36
|
+
"children": []
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Text
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"type": "text",
|
|
45
|
+
"content": "Hello", // string or StyledTextSegment[]
|
|
46
|
+
"fontSize": 16, "fontFamily": "Inter", "fontWeight": 600,
|
|
47
|
+
"textAlign": "center", // "left" | "center" | "right"
|
|
48
|
+
"textGrowth": "fixed-width", // "auto" | "fixed-width" | "fixed-width-height"
|
|
49
|
+
"lineHeight": 1.5, "letterSpacing": 0,
|
|
50
|
+
"fill": [{ "type": "solid", "color": "#111111" }]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Rich text: `"content": [{ "text": "Bold ", "fontWeight": "bold" }, { "text": "normal" }]`
|
|
55
|
+
|
|
56
|
+
### Icons — Two Options
|
|
57
|
+
|
|
58
|
+
#### Option A: `icon_font` (RECOMMENDED — renders directly, no post-processing needed)
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{ "type": "icon_font", "name": "Lock Icon", "iconFontName": "lock",
|
|
62
|
+
"width": 20, "height": 20,
|
|
63
|
+
"fill": [{ "type": "solid", "color": "#6B7280" }] }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Field is `iconFontName` (NOT `iconName`, NOT `icon`).** Values are lowercase kebab-case Lucide names: `mail`, `lock`, `eye`, `eye-off`, `chrome`, `apple`, `message-circle`, `x`, `arrow-right`, `search`, `heart`, `star`, `check`, `plus`, `bell`, `home`, `user`, `settings`, `chevron-right`, `download`, `globe`, `layers`, `zap`, `shield`, `play`.
|
|
67
|
+
|
|
68
|
+
Works in ALL contexts: CLI, MCP tools, or direct `.op` files — no `design:refine` required.
|
|
69
|
+
|
|
70
|
+
#### Option B: `path` (requires post-processing)
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "type": "path", "name": "HeartIcon", "width": 24, "height": 24,
|
|
74
|
+
"fill": [{ "type": "solid", "color": "#111111" }] }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
PascalCase + "Icon" suffix. Auto-resolved from Lucide set during post-processing.
|
|
78
|
+
|
|
79
|
+
> **Path icons need post-processing.** After inserting path nodes, run `op design:refine --root-id <id>` or use `op insert --post-process`. Without this, path icons won't render visually. The standalone MCP server (used by ACP agents) does NOT have hook implementations registered, so path icons will NOT resolve there — **prefer `icon_font` in MCP contexts.**
|
|
80
|
+
|
|
81
|
+
### Image
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{ "type": "image", "src": "https://example.com/photo.jpg", "width": 400, "height": 300,
|
|
85
|
+
"objectFit": "crop", "cornerRadius": 12 }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For a new raster asset, use Qoder's available built-in image generation tool by default, then import
|
|
89
|
+
its output into the image node. `imagePrompt` alone marks Generate intent;
|
|
90
|
+
it does not invoke the host's tool automatically. Both acquisition fields mean
|
|
91
|
+
Auto. Follow the [image workflow](images.md) for generation and portable imports.
|
|
92
|
+
|
|
93
|
+
Search fallback or an explicit stock-only request (resolve with scoped
|
|
94
|
+
`enrich_images` after structural repair):
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{ "type": "image", "width": 400, "height": 300,
|
|
98
|
+
"imageSearchQuery": "modern office workspace natural light wide interior" }
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`design_refine` repairs structure; it is not proof that a real image was acquired.
|
|
102
|
+
|
|
103
|
+
Image adjustments (all -100 to 100): `exposure`, `contrast`, `saturation`, `temperature`, `tint`, `highlights`, `shadows`.
|
|
104
|
+
|
|
105
|
+
### Polygon
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{ "type": "polygon", "polygonCount": 6, "width": 80, "height": 80, "cornerRadius": 4,
|
|
109
|
+
"fill": [{ "type": "solid", "color": "#6366F1" }] }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Icon Font
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{ "type": "icon_font", "iconFontName": "lucide:home", "width": 24, "height": 24,
|
|
116
|
+
"fill": [{ "type": "solid", "color": "#111111" }] }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Line
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{ "type": "line", "x2": 200, "y2": 0,
|
|
123
|
+
"stroke": { "thickness": 1, "fill": [{ "type": "solid", "color": "#E5E7EB" }] } }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Fill Types
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{ "type": "solid", "color": "#3B82F6" }
|
|
130
|
+
{ "type": "linear_gradient", "angle": 135,
|
|
131
|
+
"stops": [{ "offset": 0, "color": "#6366F1" }, { "offset": 1, "color": "#8B5CF6" }] }
|
|
132
|
+
{ "type": "radial_gradient", "cx": 0.5, "cy": 0.5, "radius": 0.5,
|
|
133
|
+
"stops": [{ "offset": 0, "color": "#FFF" }, { "offset": 1, "color": "#000" }] }
|
|
134
|
+
{ "type": "image", "url": "https://example.com/texture.jpg", "mode": "fill" }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Image fill modes: `fill`, `fit`, `crop`, `tile`, `stretch`. Image fill also supports adjustment filters (`exposure`, `contrast`, `saturation`, etc.).
|
|
138
|
+
|
|
139
|
+
### Ref Node (Component Instance)
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{ "type": "ref", "ref": "reusable-frame-id",
|
|
143
|
+
"descendants": { "child-id": { "content": "Override text" } } }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
References a `frame` with `reusable: true`. Override specific descendant properties via `descendants`.
|
|
147
|
+
|
|
148
|
+
### Design Variables
|
|
149
|
+
|
|
150
|
+
Reference with `$` prefix: `"color": "$primaryColor"`, `"gap": "$spacing"`.
|
|
151
|
+
|
|
152
|
+
## Semantic Roles
|
|
153
|
+
|
|
154
|
+
Roles declare intent — the engine applies smart defaults. Always prefer roles over manual styling.
|
|
155
|
+
|
|
156
|
+
| Category | Roles |
|
|
157
|
+
|----------|-------|
|
|
158
|
+
| **Layout** | `section`, `row`, `column`, `centered-content`, `divider`, `spacer` |
|
|
159
|
+
| **Navigation** | `navbar`, `nav-links`, `nav-link` |
|
|
160
|
+
| **Phone system chrome** | `status-bar` (preserve the runtime-generated subtree) |
|
|
161
|
+
| **Interactive** | `button`, `icon-button`, `badge`, `tag`, `pill`, `input`, `form-input`, `search-bar` |
|
|
162
|
+
| **Cards** | `card`, `feature-card`, `stat-card`, `pricing-card`, `image-card` |
|
|
163
|
+
| **Content** | `hero`, `feature-grid`, `cta-section`, `footer`, `testimonial`, `stats-section` |
|
|
164
|
+
| **Typography** | `heading`, `subheading`, `body-text`, `caption`, `label` |
|
|
165
|
+
| **Media** | `avatar`, `icon`, `phone-mockup`, `screenshot-frame` |
|
|
166
|
+
| **Table** | `table`, `table-row`, `table-header`, `table-cell` |
|
|
167
|
+
| **Form** | `form-group` |
|
|
168
|
+
|
|
169
|
+
Key defaults:
|
|
170
|
+
- `navbar` → height: 56-72, horizontal, space_between, center-aligned
|
|
171
|
+
- `button` → padding: [12, 24], cornerRadius: 8, centered
|
|
172
|
+
- `card` → vertical, gap: 12, cornerRadius: 12, padding: 24
|
|
173
|
+
- `heading` → lineHeight: 1.2, letterSpacing: -0.5
|
|
174
|
+
- `body-text` → fill_container, textGrowth: fixed-width, lineHeight: 1.5
|
|
175
|
+
|
|
176
|
+
### Phone Status Bar
|
|
177
|
+
|
|
178
|
+
For a new phone screen, load `get_guidelines` with `topic: "mobile"`, create the
|
|
179
|
+
root, then read back its runtime-generated `role: "status-bar"` before adding
|
|
180
|
+
content. Preserve its structure and indicator children; do not substitute
|
|
181
|
+
hand-drawn or emoji indicators. Missing canonical chrome requires runtime
|
|
182
|
+
diagnosis, not a claim of successful native setup. Visually verify one complete
|
|
183
|
+
set of time, cellular signal, Wi-Fi, and battery after saving and reopening.
|
|
184
|
+
Respect existing custom bars and an explicit no-status-bar brief; a narrow frame
|
|
185
|
+
alone does not establish phone-screen intent.
|
|
186
|
+
|
|
187
|
+
## Layout Rules
|
|
188
|
+
|
|
189
|
+
1. **NEVER set x/y on children inside layout containers** — engine positions them
|
|
190
|
+
2. **Siblings must use same width strategy** — all `fill_container` or all fixed
|
|
191
|
+
3. **NEVER `fill_container` inside `fit_content` parent** — circular dependency
|
|
192
|
+
4. Cards in horizontal row: ALL `width: "fill_container"`, `height: "fill_container"`
|
|
193
|
+
|
|
194
|
+
### Sizing Decision
|
|
195
|
+
|
|
196
|
+
| Question | Answer |
|
|
197
|
+
|----------|--------|
|
|
198
|
+
| Stretch to fill? | `"fill_container"` |
|
|
199
|
+
| Shrink to content? | `"fit_content"` |
|
|
200
|
+
| Exact size? | number (px) |
|
|
201
|
+
|
|
202
|
+
### Design Type Sizing
|
|
203
|
+
|
|
204
|
+
| Type | Width | Height |
|
|
205
|
+
|------|-------|--------|
|
|
206
|
+
| Landing page | 1200 | 0 (auto) |
|
|
207
|
+
| Mobile screen | 375 | 812 |
|
|
208
|
+
| Dashboard | 1200 | 0 (auto) |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpencil-setup
|
|
3
|
+
description: Connect and diagnose the local Rust OpenPencil plugin for Qoder (Qoder Desktop, Qoder CN, Qoder IDE/CLI). Use for initial setup, local plugin ZIP import, missing tools, or a disconnected local canvas.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Connect OpenPencil to Qoder
|
|
7
|
+
|
|
8
|
+
This plugin opens a managed interactive Rust OpenPencil canvas directly inside
|
|
9
|
+
Qoder (via MCP Apps 2026-01-26) or connects to an already running OpenPencil
|
|
10
|
+
desktop editor.
|
|
11
|
+
|
|
12
|
+
## Quick setup
|
|
13
|
+
|
|
14
|
+
1. Install `@zseven-w/qoder-openpencil` (Node.js 22+) and run:
|
|
15
|
+
`qoder-openpencil setup` (or `npm run setup` from `packages/op-qoder`).
|
|
16
|
+
Setup verifies an isolated native edit/save/reopen before changing host
|
|
17
|
+
configuration, records the current Node 22+ executable privately in
|
|
18
|
+
`~/.qoder-openpencil/node-path`, installs the plugin into Qoder's canonical
|
|
19
|
+
cache (`<QODER_CONFIG_DIR>/plugins/cache/local/openpencil/<version>/`),
|
|
20
|
+
registers `openpencil@local` in `plugins/installed_plugins_v2.json`, and
|
|
21
|
+
enables `enabledPlugins["openpencil@local"] = true` in `settings.json`
|
|
22
|
+
(preserving all unrelated plugins and settings).
|
|
23
|
+
2. **Import via Qoder Desktop UI (ZIP)**:
|
|
24
|
+
Run `qoder-openpencil pack-plugin` to generate `openpencil-qoder-plugin.zip`
|
|
25
|
+
with `.qoder-plugin/plugin.json` and `.mcp.json` directly at the ZIP root,
|
|
26
|
+
then import it through **Extensions → Import local plugin** (or pass it to
|
|
27
|
+
`qoder-settings.install_extension`).
|
|
28
|
+
3. **Qoder IDE / CLI `mcpServers` mode**:
|
|
29
|
+
Run `qoder-openpencil print-config` to paste into `settings.json`, or run
|
|
30
|
+
`qoder-openpencil setup --mcp-settings` to merge `mcpServers.openpencil` and
|
|
31
|
+
install standalone skills into `<QODER_CONFIG_DIR>/skills/`.
|
|
32
|
+
4. Run `qoder-openpencil host-check` (or `npm run host-check`) to verify that
|
|
33
|
+
`launch-mcp` starts cleanly under a minimal GUI `PATH`, serves `open_canvas`
|
|
34
|
+
with `qoder/ui` entrypoints, and exposes `ui://openpencil/canvas/...`.
|
|
35
|
+
|
|
36
|
+
## Interactive canvas
|
|
37
|
+
|
|
38
|
+
1. Open directly from Qoder's left **More → OpenPencil Canvas** menu (Global
|
|
39
|
+
fullscreen workspace tab), from the session sidebar **+ → Apps → OpenPencil
|
|
40
|
+
Canvas** (side-by-side tab), or by calling `open_canvas` in chat.
|
|
41
|
+
2. Runtime configuration stays private in `~/.qoder-openpencil/runtime.json`.
|
|
42
|
+
A custom complete Rust runtime can be selected with
|
|
43
|
+
`qoder-openpencil configure-runtime /abs/runtime/root` or
|
|
44
|
+
`OPENPENCIL_EDITOR_RUNTIME_DIR`.
|
|
45
|
+
3. Each conversation keeps one canvas. Recovery drafts persist in
|
|
46
|
+
`~/.qoder-openpencil/sessions/`.
|
|
47
|
+
4. If the current chat has not reloaded newly installed MCP tools yet,
|
|
48
|
+
`qoder-openpencil canvas` (or `npm run canvas` from a checkout) opens the
|
|
49
|
+
same managed canvas through a persistent terminal.
|
|
50
|
+
|
|
51
|
+
## Existing desktop editor
|
|
52
|
+
|
|
53
|
+
1. Try `get_editor_state` through this plugin's tools.
|
|
54
|
+
2. If unavailable, run `qoder-openpencil doctor` (or
|
|
55
|
+
`node scripts/mcp-bridge.mjs --doctor` from the installed plugin directory).
|
|
56
|
+
The doctor reads `~/.openpencil/.op-mcp-port` and verifies instance identity.
|
|
57
|
+
3. For a headless/web endpoint without a discovery record, set
|
|
58
|
+
`OPENPENCIL_MCP_PORT` or pass `--port PORT` to `mcp-bridge.mjs`. Only local
|
|
59
|
+
loopback ports are accepted.
|