pmx-canvas 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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/Readme.md +865 -0
- package/dist/canvas/global.css +3173 -0
- package/dist/canvas/index.js +183 -0
- package/dist/json-render/index.css +2 -0
- package/dist/json-render/index.js +389 -0
- package/dist/types/cli/agent.d.ts +13 -0
- package/dist/types/cli/index.d.ts +2 -0
- package/dist/types/cli/watch.d.ts +5 -0
- package/dist/types/client/App.d.ts +1 -0
- package/dist/types/client/canvas/AttentionHistory.d.ts +1 -0
- package/dist/types/client/canvas/AttentionToast.d.ts +1 -0
- package/dist/types/client/canvas/CanvasNode.d.ts +8 -0
- package/dist/types/client/canvas/CanvasViewport.d.ts +8 -0
- package/dist/types/client/canvas/CommandPalette.d.ts +4 -0
- package/dist/types/client/canvas/ContextMenu.d.ts +24 -0
- package/dist/types/client/canvas/ContextPinBar.d.ts +1 -0
- package/dist/types/client/canvas/ContextPinHud.d.ts +1 -0
- package/dist/types/client/canvas/DockedNode.d.ts +4 -0
- package/dist/types/client/canvas/EdgeLayer.d.ts +8 -0
- package/dist/types/client/canvas/ExpandedNodeOverlay.d.ts +1 -0
- package/dist/types/client/canvas/FocusFieldLayer.d.ts +1 -0
- package/dist/types/client/canvas/Minimap.d.ts +23 -0
- package/dist/types/client/canvas/SelectionBar.d.ts +1 -0
- package/dist/types/client/canvas/ShortcutOverlay.d.ts +3 -0
- package/dist/types/client/canvas/SnapshotPanel.d.ts +7 -0
- package/dist/types/client/canvas/snap-guides.d.ts +23 -0
- package/dist/types/client/canvas/use-node-drag.d.ts +15 -0
- package/dist/types/client/canvas/use-node-resize.d.ts +15 -0
- package/dist/types/client/canvas/use-pan-zoom.d.ts +16 -0
- package/dist/types/client/ext-app/bridge.d.ts +161 -0
- package/dist/types/client/icons.d.ts +70 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/nodes/ContextNode.d.ts +34 -0
- package/dist/types/client/nodes/ExtAppFrame.d.ts +18 -0
- package/dist/types/client/nodes/FileNode.d.ts +5 -0
- package/dist/types/client/nodes/GroupNode.d.ts +6 -0
- package/dist/types/client/nodes/ImageNode.d.ts +10 -0
- package/dist/types/client/nodes/InlineFormatBar.d.ts +7 -0
- package/dist/types/client/nodes/InlineMarkdownEditor.d.ts +14 -0
- package/dist/types/client/nodes/LedgerNode.d.ts +4 -0
- package/dist/types/client/nodes/MarkdownNode.d.ts +6 -0
- package/dist/types/client/nodes/McpAppNode.d.ts +4 -0
- package/dist/types/client/nodes/MdFormatBar.d.ts +8 -0
- package/dist/types/client/nodes/PromptNode.d.ts +5 -0
- package/dist/types/client/nodes/ResponseNode.d.ts +5 -0
- package/dist/types/client/nodes/StatusNode.d.ts +4 -0
- package/dist/types/client/nodes/StatusSummary.d.ts +4 -0
- package/dist/types/client/nodes/TraceNode.d.ts +4 -0
- package/dist/types/client/nodes/WebpageNode.d.ts +5 -0
- package/dist/types/client/nodes/image-warnings.d.ts +6 -0
- package/dist/types/client/nodes/inline-editor-commands.d.ts +11 -0
- package/dist/types/client/nodes/md-format.d.ts +25 -0
- package/dist/types/client/state/attention-bridge.d.ts +3 -0
- package/dist/types/client/state/attention-store.d.ts +25 -0
- package/dist/types/client/state/canvas-store.d.ts +74 -0
- package/dist/types/client/state/intent-bridge.d.ts +158 -0
- package/dist/types/client/state/sse-bridge.d.ts +5 -0
- package/dist/types/client/theme/tokens.d.ts +27 -0
- package/dist/types/client/types.d.ts +40 -0
- package/dist/types/client/utils/ext-app-tool-result.d.ts +1 -0
- package/dist/types/client/utils/placement.d.ts +1 -0
- package/dist/types/client/utils/platform.d.ts +2 -0
- package/dist/types/json-render/catalog.d.ts +815 -0
- package/dist/types/json-render/charts/components.d.ts +54 -0
- package/dist/types/json-render/charts/definitions.d.ts +103 -0
- package/dist/types/json-render/charts/extra-components.d.ts +58 -0
- package/dist/types/json-render/charts/extra-definitions.d.ts +181 -0
- package/dist/types/json-render/renderer/index.d.ts +16 -0
- package/dist/types/json-render/schema.d.ts +46 -0
- package/dist/types/json-render/server.d.ts +55 -0
- package/dist/types/mcp/server.d.ts +22 -0
- package/dist/types/server/agent-context.d.ts +21 -0
- package/dist/types/server/artifact-paths.d.ts +3 -0
- package/dist/types/server/canvas-operations.d.ts +154 -0
- package/dist/types/server/canvas-provenance.d.ts +13 -0
- package/dist/types/server/canvas-schema.d.ts +49 -0
- package/dist/types/server/canvas-serialization.d.ts +25 -0
- package/dist/types/server/canvas-state.d.ts +174 -0
- package/dist/types/server/canvas-validation.d.ts +33 -0
- package/dist/types/server/chart-template.d.ts +29 -0
- package/dist/types/server/code-graph.d.ts +67 -0
- package/dist/types/server/context-cards.d.ts +24 -0
- package/dist/types/server/diagram-presets.d.ts +28 -0
- package/dist/types/server/ext-app-call-registry.d.ts +16 -0
- package/dist/types/server/ext-app-tool-result.d.ts +1 -0
- package/dist/types/server/file-watcher.d.ts +16 -0
- package/dist/types/server/index.d.ts +243 -0
- package/dist/types/server/mcp-app-candidate.d.ts +25 -0
- package/dist/types/server/mcp-app-host.d.ts +65 -0
- package/dist/types/server/mcp-app-runtime.d.ts +47 -0
- package/dist/types/server/mutation-history.d.ts +105 -0
- package/dist/types/server/placement.d.ts +37 -0
- package/dist/types/server/server.d.ts +103 -0
- package/dist/types/server/spatial-analysis.d.ts +87 -0
- package/dist/types/server/trace-manager.d.ts +48 -0
- package/dist/types/server/web-artifacts.d.ts +50 -0
- package/dist/types/server/webpage-node.d.ts +25 -0
- package/dist/types/shared/auto-arrange.d.ts +29 -0
- package/dist/types/shared/ext-app-tool-result.d.ts +9 -0
- package/dist/types/shared/placement.d.ts +26 -0
- package/dist/types/shared/semantic-attention.d.ts +97 -0
- package/package.json +109 -0
- package/skills/data-analysis/SKILL.md +324 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/frontend-design/SKILL.md +45 -0
- package/skills/json-render-codegen/SKILL.md +112 -0
- package/skills/json-render-core/SKILL.md +265 -0
- package/skills/json-render-ink/SKILL.md +273 -0
- package/skills/json-render-mcp/SKILL.md +132 -0
- package/skills/json-render-react/SKILL.md +264 -0
- package/skills/json-render-shadcn/SKILL.md +159 -0
- package/skills/playwright-cli/SKILL.md +67 -0
- package/skills/pmx-canvas/SKILL.md +668 -0
- package/skills/pmx-canvas/evals/evals.json +186 -0
- package/skills/pmx-canvas-testing/SKILL.md +78 -0
- package/skills/published-consumer-e2e/SKILL.md +43 -0
- package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +241 -0
- package/skills/web-artifacts-builder/SKILL.md +80 -0
- package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +167 -0
- package/skills/web-artifacts-builder/scripts/init-artifact.sh +425 -0
- package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/src/cli/agent.ts +2144 -0
- package/src/cli/index.ts +622 -0
- package/src/cli/watch.ts +88 -0
- package/src/client/App.tsx +507 -0
- package/src/client/canvas/AttentionHistory.tsx +81 -0
- package/src/client/canvas/AttentionToast.tsx +19 -0
- package/src/client/canvas/CanvasNode.tsx +363 -0
- package/src/client/canvas/CanvasViewport.tsx +590 -0
- package/src/client/canvas/CommandPalette.tsx +302 -0
- package/src/client/canvas/ContextMenu.tsx +601 -0
- package/src/client/canvas/ContextPinBar.tsx +25 -0
- package/src/client/canvas/ContextPinHud.tsx +22 -0
- package/src/client/canvas/DockedNode.tsx +66 -0
- package/src/client/canvas/EdgeLayer.tsx +280 -0
- package/src/client/canvas/ExpandedNodeOverlay.tsx +260 -0
- package/src/client/canvas/FocusFieldLayer.tsx +107 -0
- package/src/client/canvas/Minimap.tsx +301 -0
- package/src/client/canvas/SelectionBar.tsx +69 -0
- package/src/client/canvas/ShortcutOverlay.tsx +69 -0
- package/src/client/canvas/SnapshotPanel.tsx +236 -0
- package/src/client/canvas/snap-guides.ts +170 -0
- package/src/client/canvas/use-node-drag.ts +51 -0
- package/src/client/canvas/use-node-resize.ts +59 -0
- package/src/client/canvas/use-pan-zoom.ts +191 -0
- package/src/client/ext-app/bridge.ts +542 -0
- package/src/client/icons.tsx +424 -0
- package/src/client/index.tsx +7 -0
- package/src/client/nodes/ContextNode.tsx +412 -0
- package/src/client/nodes/ExtAppFrame.tsx +509 -0
- package/src/client/nodes/FileNode.tsx +256 -0
- package/src/client/nodes/GroupNode.tsx +39 -0
- package/src/client/nodes/ImageNode.tsx +160 -0
- package/src/client/nodes/InlineFormatBar.tsx +169 -0
- package/src/client/nodes/InlineMarkdownEditor.tsx +123 -0
- package/src/client/nodes/LedgerNode.tsx +37 -0
- package/src/client/nodes/MarkdownNode.tsx +359 -0
- package/src/client/nodes/McpAppNode.tsx +85 -0
- package/src/client/nodes/MdFormatBar.tsx +109 -0
- package/src/client/nodes/PromptNode.tsx +597 -0
- package/src/client/nodes/ResponseNode.tsx +153 -0
- package/src/client/nodes/StatusNode.tsx +84 -0
- package/src/client/nodes/StatusSummary.tsx +38 -0
- package/src/client/nodes/TraceNode.tsx +120 -0
- package/src/client/nodes/WebpageNode.tsx +288 -0
- package/src/client/nodes/image-warnings.ts +95 -0
- package/src/client/nodes/inline-editor-commands.ts +37 -0
- package/src/client/nodes/md-format.ts +206 -0
- package/src/client/state/attention-bridge.ts +328 -0
- package/src/client/state/attention-store.ts +73 -0
- package/src/client/state/canvas-store.ts +631 -0
- package/src/client/state/intent-bridge.ts +315 -0
- package/src/client/state/sse-bridge.ts +965 -0
- package/src/client/theme/global.css +3173 -0
- package/src/client/theme/tokens.ts +72 -0
- package/src/client/types-shims.d.ts +5 -0
- package/src/client/types.ts +81 -0
- package/src/client/utils/ext-app-tool-result.ts +4 -0
- package/src/client/utils/placement.ts +4 -0
- package/src/client/utils/platform.ts +2 -0
- package/src/json-render/catalog.ts +256 -0
- package/src/json-render/charts/components.tsx +198 -0
- package/src/json-render/charts/definitions.ts +81 -0
- package/src/json-render/charts/extra-components.tsx +267 -0
- package/src/json-render/charts/extra-definitions.ts +145 -0
- package/src/json-render/renderer/index.css +174 -0
- package/src/json-render/renderer/index.tsx +86 -0
- package/src/json-render/schema.ts +62 -0
- package/src/json-render/server.ts +597 -0
- package/src/mcp/server.ts +1377 -0
- package/src/server/agent-context.ts +242 -0
- package/src/server/artifact-paths.ts +17 -0
- package/src/server/canvas-operations.ts +1279 -0
- package/src/server/canvas-provenance.ts +243 -0
- package/src/server/canvas-schema.ts +432 -0
- package/src/server/canvas-serialization.ts +95 -0
- package/src/server/canvas-state.ts +1134 -0
- package/src/server/canvas-validation.ts +114 -0
- package/src/server/chart-template.ts +449 -0
- package/src/server/code-graph.ts +370 -0
- package/src/server/context-cards.ts +31 -0
- package/src/server/diagram-presets.ts +71 -0
- package/src/server/ext-app-call-registry.ts +77 -0
- package/src/server/ext-app-tool-result.ts +4 -0
- package/src/server/file-watcher.ts +121 -0
- package/src/server/index.ts +647 -0
- package/src/server/mcp-app-candidate.ts +174 -0
- package/src/server/mcp-app-host.ts +814 -0
- package/src/server/mcp-app-runtime.ts +459 -0
- package/src/server/mutation-history.ts +350 -0
- package/src/server/placement.ts +125 -0
- package/src/server/server.ts +3846 -0
- package/src/server/spatial-analysis.ts +356 -0
- package/src/server/trace-manager.ts +333 -0
- package/src/server/web-artifacts/scripts/bundle-artifact.sh +167 -0
- package/src/server/web-artifacts/scripts/init-artifact.sh +426 -0
- package/src/server/web-artifacts/scripts/shadcn-components.tar.gz +0 -0
- package/src/server/web-artifacts.ts +442 -0
- package/src/server/webpage-node.ts +328 -0
- package/src/shared/auto-arrange.ts +439 -0
- package/src/shared/ext-app-tool-result.ts +76 -0
- package/src/shared/placement.ts +81 -0
- package/src/shared/semantic-attention.ts +598 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: json-render-shadcn
|
|
3
|
+
description: Pre-built shadcn/ui components for json-render. Use when working with @json-render/shadcn, adding standard UI components to a catalog, or building web UIs with Radix UI + Tailwind CSS components.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @json-render/shadcn
|
|
7
|
+
|
|
8
|
+
Pre-built shadcn/ui component definitions and implementations for json-render. Provides 36 components built on Radix UI + Tailwind CSS.
|
|
9
|
+
|
|
10
|
+
## Two Entry Points
|
|
11
|
+
|
|
12
|
+
| Entry Point | Exports | Use For |
|
|
13
|
+
|-------------|---------|---------|
|
|
14
|
+
| `@json-render/shadcn/catalog` | `shadcnComponentDefinitions` | Catalog schemas (no React dependency, safe for server) |
|
|
15
|
+
| `@json-render/shadcn` | `shadcnComponents` | React implementations |
|
|
16
|
+
|
|
17
|
+
## Usage Pattern
|
|
18
|
+
|
|
19
|
+
Pick the components you need from the standard definitions. Do not spread all definitions -- explicitly select what your app uses:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { defineCatalog } from "@json-render/core";
|
|
23
|
+
import { schema } from "@json-render/react/schema";
|
|
24
|
+
import { shadcnComponentDefinitions } from "@json-render/shadcn/catalog";
|
|
25
|
+
import { defineRegistry } from "@json-render/react";
|
|
26
|
+
import { shadcnComponents } from "@json-render/shadcn";
|
|
27
|
+
|
|
28
|
+
// Catalog: pick definitions
|
|
29
|
+
const catalog = defineCatalog(schema, {
|
|
30
|
+
components: {
|
|
31
|
+
Card: shadcnComponentDefinitions.Card,
|
|
32
|
+
Stack: shadcnComponentDefinitions.Stack,
|
|
33
|
+
Heading: shadcnComponentDefinitions.Heading,
|
|
34
|
+
Button: shadcnComponentDefinitions.Button,
|
|
35
|
+
Input: shadcnComponentDefinitions.Input,
|
|
36
|
+
},
|
|
37
|
+
actions: {},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Registry: pick matching implementations
|
|
41
|
+
const { registry } = defineRegistry(catalog, {
|
|
42
|
+
components: {
|
|
43
|
+
Card: shadcnComponents.Card,
|
|
44
|
+
Stack: shadcnComponents.Stack,
|
|
45
|
+
Heading: shadcnComponents.Heading,
|
|
46
|
+
Button: shadcnComponents.Button,
|
|
47
|
+
Input: shadcnComponents.Input,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> State actions (`setState`, `pushState`, `removeState`) are built into the React schema and handled by `ActionProvider` automatically. No need to declare them.
|
|
53
|
+
|
|
54
|
+
## Extending with Custom Components
|
|
55
|
+
|
|
56
|
+
Add custom components alongside standard ones:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const catalog = defineCatalog(schema, {
|
|
60
|
+
components: {
|
|
61
|
+
// Standard
|
|
62
|
+
Card: shadcnComponentDefinitions.Card,
|
|
63
|
+
Stack: shadcnComponentDefinitions.Stack,
|
|
64
|
+
|
|
65
|
+
// Custom
|
|
66
|
+
Metric: {
|
|
67
|
+
props: z.object({
|
|
68
|
+
label: z.string(),
|
|
69
|
+
value: z.string(),
|
|
70
|
+
trend: z.enum(["up", "down", "neutral"]).nullable(),
|
|
71
|
+
}),
|
|
72
|
+
description: "KPI metric display",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
actions: {},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const { registry } = defineRegistry(catalog, {
|
|
79
|
+
components: {
|
|
80
|
+
Card: shadcnComponents.Card,
|
|
81
|
+
Stack: shadcnComponents.Stack,
|
|
82
|
+
Metric: ({ props }) => <div>{props.label}: {props.value}</div>,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Available Components
|
|
88
|
+
|
|
89
|
+
### Layout
|
|
90
|
+
- **Card** - Container with optional title, description, maxWidth, centered
|
|
91
|
+
- **Stack** - Flex container with direction, gap, align, justify
|
|
92
|
+
- **Grid** - Grid layout with columns (number) and gap
|
|
93
|
+
- **Separator** - Visual divider with orientation
|
|
94
|
+
|
|
95
|
+
### Navigation
|
|
96
|
+
- **Tabs** - Tabbed navigation with tabs array, defaultValue, value
|
|
97
|
+
- **Accordion** - Collapsible sections with items array and type (single/multiple)
|
|
98
|
+
- **Collapsible** - Single collapsible section with title
|
|
99
|
+
- **Pagination** - Page navigation with totalPages and page
|
|
100
|
+
|
|
101
|
+
### Overlay
|
|
102
|
+
- **Dialog** - Modal dialog with title, description, openPath
|
|
103
|
+
- **Drawer** - Bottom drawer with title, description, openPath
|
|
104
|
+
- **Tooltip** - Hover tooltip with content and text
|
|
105
|
+
- **Popover** - Click-triggered popover with trigger and content
|
|
106
|
+
- **DropdownMenu** - Dropdown with label and items array
|
|
107
|
+
|
|
108
|
+
### Content
|
|
109
|
+
- **Heading** - Heading text with level (h1-h4)
|
|
110
|
+
- **Text** - Paragraph with variant (body, caption, muted, lead, code)
|
|
111
|
+
- **Image** - Image with alt, width, height
|
|
112
|
+
- **Avatar** - User avatar with src, name, size
|
|
113
|
+
- **Badge** - Status badge with text and variant (default, secondary, destructive, outline)
|
|
114
|
+
- **Alert** - Alert banner with title, message, type (success, warning, info, error)
|
|
115
|
+
- **Carousel** - Scrollable carousel with items array
|
|
116
|
+
- **Table** - Data table with columns (string[]) and rows (string[][])
|
|
117
|
+
|
|
118
|
+
### Feedback
|
|
119
|
+
- **Progress** - Progress bar with value, max, label
|
|
120
|
+
- **Skeleton** - Loading placeholder with width, height, rounded
|
|
121
|
+
- **Spinner** - Loading spinner with size and label
|
|
122
|
+
|
|
123
|
+
### Input
|
|
124
|
+
- **Button** - Button with label, variant (primary, secondary, danger), disabled
|
|
125
|
+
- **Link** - Anchor link with label and href
|
|
126
|
+
- **Input** - Text input with label, name, type, placeholder, value, checks
|
|
127
|
+
- **Textarea** - Multi-line input with label, name, placeholder, rows, value, checks
|
|
128
|
+
- **Select** - Dropdown select with label, name, options (string[]), value, checks
|
|
129
|
+
- **Checkbox** - Checkbox with label, name, checked, checks, validateOn
|
|
130
|
+
- **Radio** - Radio group with label, name, options (string[]), value, checks, validateOn
|
|
131
|
+
- **Switch** - Toggle switch with label, name, checked, checks, validateOn
|
|
132
|
+
- **Slider** - Range slider with label, min, max, step, value
|
|
133
|
+
- **Toggle** - Toggle button with label, pressed, variant
|
|
134
|
+
- **ToggleGroup** - Group of toggles with items, type, value
|
|
135
|
+
- **ButtonGroup** - Button group with buttons array and selected
|
|
136
|
+
|
|
137
|
+
## Built-in Actions (from `@json-render/react`)
|
|
138
|
+
|
|
139
|
+
These are built into the React schema and handled by `ActionProvider` automatically. They appear in prompts without needing to be declared in the catalog.
|
|
140
|
+
|
|
141
|
+
- **setState** - Set a value at a state path (`{ statePath, value }`)
|
|
142
|
+
- **pushState** - Push a value onto an array (`{ statePath, value, clearStatePath? }`)
|
|
143
|
+
- **removeState** - Remove an array item by index (`{ statePath, index }`)
|
|
144
|
+
- **validateForm** - Validate all fields, write `{ valid, errors }` to state (`{ statePath? }`)
|
|
145
|
+
|
|
146
|
+
## Validation Timing (`validateOn`)
|
|
147
|
+
|
|
148
|
+
All form components support `validateOn` to control when validation runs:
|
|
149
|
+
- `"change"` — validate on every input change (default for Select, Checkbox, Radio, Switch)
|
|
150
|
+
- `"blur"` — validate when field loses focus (default for Input, Textarea)
|
|
151
|
+
- `"submit"` — validate only on form submission
|
|
152
|
+
|
|
153
|
+
## Important Notes
|
|
154
|
+
|
|
155
|
+
- The `/catalog` entry point has no React dependency -- use it for server-side prompt generation
|
|
156
|
+
- Components use Tailwind CSS classes -- your app must have Tailwind configured
|
|
157
|
+
- Component implementations use bundled shadcn/ui primitives (not your app's `components/ui/`)
|
|
158
|
+
- All form inputs support `checks` for validation (type + message pairs) and `validateOn` for timing
|
|
159
|
+
- Events: inputs emit `change`/`submit`/`focus`/`blur`; buttons emit `press`; selects emit `change`/`select`
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playwright-cli
|
|
3
|
+
description: Browser automation via the Playwright CLI for validating PMX Canvas, embedded web artifacts, and external integrations from the terminal. Use when you need to open pages, click through UI flows, inspect element structure, take screenshots, or verify that a canvas-hosted app actually works in the browser.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Playwright CLI
|
|
7
|
+
|
|
8
|
+
Use this skill when PMX Canvas work needs a real browser check instead of static inspection.
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
- Verify a PMX Canvas UI flow after changing the client
|
|
13
|
+
- Open an embedded `mcp-app` or `/artifact?path=...` route and confirm it renders
|
|
14
|
+
- Click through context menus, pins, groups, snapshots, and other browser-only interactions
|
|
15
|
+
- Capture screenshots or accessibility snapshots while keeping terminal context small
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @playwright/cli@latest
|
|
21
|
+
playwright-cli --version
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Requires Node.js 18+.
|
|
25
|
+
|
|
26
|
+
## Core Workflow
|
|
27
|
+
|
|
28
|
+
1. Open the target URL with `playwright-cli open <url>`
|
|
29
|
+
2. Capture a structural snapshot with `playwright-cli snapshot`
|
|
30
|
+
3. Read the saved snapshot file to find element refs
|
|
31
|
+
4. Interact with the page using `click`, `fill`, `press`, or `goto`
|
|
32
|
+
5. Verify with another snapshot or a screenshot
|
|
33
|
+
6. Close the session when done
|
|
34
|
+
|
|
35
|
+
For PMX Canvas work, prefer a named session so you can keep a browser attached to the canvas while testing artifact tabs separately.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
playwright-cli -s=canvas open http://localhost:4313
|
|
39
|
+
playwright-cli -s=canvas snapshot
|
|
40
|
+
playwright-cli -s=canvas screenshot
|
|
41
|
+
playwright-cli -s=canvas close
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Commands You Will Use Most
|
|
45
|
+
|
|
46
|
+
- `open [url]` — launch browser and optionally navigate
|
|
47
|
+
- `goto <url>` — move to another page
|
|
48
|
+
- `snapshot` — save page structure to disk
|
|
49
|
+
- `screenshot [ref]` — capture page or element image
|
|
50
|
+
- `click <ref>` — click an element by snapshot ref
|
|
51
|
+
- `fill <ref> <text>` — fill an input or textarea
|
|
52
|
+
- `press <key>` — send keyboard input
|
|
53
|
+
- `tab-new [url]`, `tab-list`, `tab-select <index>` — manage multiple pages
|
|
54
|
+
- `close` — close the current browser session
|
|
55
|
+
|
|
56
|
+
## PMX Canvas Guidance
|
|
57
|
+
|
|
58
|
+
- Start the canvas first: `bun run src/cli/index.ts --no-open`
|
|
59
|
+
- Use this skill after `canvas_build_web_artifact` when you need browser validation
|
|
60
|
+
- Prefer visible browser automation for UI investigation so the human can follow along
|
|
61
|
+
- Store screenshots and snapshots on disk, then only read back the specific files you need
|
|
62
|
+
|
|
63
|
+
## Pairing With Other Skills
|
|
64
|
+
|
|
65
|
+
- Use `pmx-canvas` to create, pin, connect, and inspect nodes
|
|
66
|
+
- Use `web-artifacts-builder` to scaffold richer React/shadcn artifacts
|
|
67
|
+
- Use this skill to validate the generated artifact route and embedded canvas node in a browser
|