liteagents 2.6.1 → 2.8.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 +46 -0
- package/README.md +4 -2
- package/installer/cli.js +4 -1
- package/package.json +1 -1
- package/packages/ampcode/commands/live-canvas/README.md +38 -47
- package/packages/{claude/skills/live-canvas/templates/demo → ampcode/commands/live-canvas/dev}/post-variants.html +8 -3
- package/packages/ampcode/commands/live-canvas/templates/lab-banner.html +6 -0
- package/packages/ampcode/commands/live-canvas/templates/overlay-vanilla.js +64 -6
- package/packages/ampcode/commands/live-canvas.md +140 -161
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/.claude-plugin/plugin.json +1 -1
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +2 -2
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/package.json +1 -1
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/schema.json +1 -1
- package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/server.js +320 -27
- package/packages/claude/plugins/live-canvas-marketplace/setup.sh +83 -24
- package/packages/claude/skills/live-canvas/README.md +53 -57
- package/packages/claude/skills/live-canvas/SKILL.md +122 -158
- package/packages/{ampcode/commands/live-canvas/templates/demo → claude/skills/live-canvas/dev}/post-variants.html +8 -3
- package/packages/claude/skills/live-canvas/templates/lab-banner.html +6 -0
- package/packages/claude/skills/live-canvas/templates/overlay-vanilla.js +64 -6
- package/packages/droid/commands/live-canvas/README.md +38 -47
- package/packages/droid/commands/live-canvas/{templates/demo → dev}/post-variants.html +8 -3
- package/packages/droid/commands/live-canvas/templates/lab-banner.html +6 -0
- package/packages/droid/commands/live-canvas/templates/overlay-vanilla.js +64 -6
- package/packages/droid/commands/live-canvas.md +140 -161
- package/packages/opencode/command/live-canvas/README.md +38 -47
- package/packages/opencode/command/live-canvas/{templates/demo → dev}/post-variants.html +8 -3
- package/packages/opencode/command/live-canvas/templates/lab-banner.html +6 -0
- package/packages/opencode/command/live-canvas/templates/overlay-vanilla.js +64 -6
- package/packages/opencode/command/live-canvas.md +140 -161
- package/packages/ampcode/commands/live-canvas/templates/.claude/settings.local.json +0 -8
- package/packages/ampcode/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +0 -1299
- package/packages/ampcode/commands/live-canvas/templates/feedback-react/format-utils.ts +0 -283
- package/packages/ampcode/commands/live-canvas/templates/feedback-react/index.ts +0 -62
- package/packages/ampcode/commands/live-canvas/templates/feedback-react/selector-utils.ts +0 -423
- package/packages/ampcode/commands/live-canvas/templates/feedback-react/types.ts +0 -118
- package/packages/claude/skills/live-canvas/INTEGRATION_NOTES.md +0 -210
- package/packages/claude/skills/live-canvas/templates/.claude/settings.local.json +0 -8
- package/packages/claude/skills/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +0 -1299
- package/packages/claude/skills/live-canvas/templates/feedback-react/format-utils.ts +0 -283
- package/packages/claude/skills/live-canvas/templates/feedback-react/index.ts +0 -62
- package/packages/claude/skills/live-canvas/templates/feedback-react/selector-utils.ts +0 -423
- package/packages/claude/skills/live-canvas/templates/feedback-react/types.ts +0 -118
- package/packages/droid/commands/live-canvas/templates/.claude/settings.local.json +0 -8
- package/packages/droid/commands/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +0 -1299
- package/packages/droid/commands/live-canvas/templates/feedback-react/format-utils.ts +0 -283
- package/packages/droid/commands/live-canvas/templates/feedback-react/index.ts +0 -62
- package/packages/droid/commands/live-canvas/templates/feedback-react/selector-utils.ts +0 -423
- package/packages/droid/commands/live-canvas/templates/feedback-react/types.ts +0 -118
- package/packages/opencode/command/live-canvas/templates/.claude/settings.local.json +0 -8
- package/packages/opencode/command/live-canvas/templates/feedback-react/FeedbackOverlay.tsx +0 -1299
- package/packages/opencode/command/live-canvas/templates/feedback-react/format-utils.ts +0 -283
- package/packages/opencode/command/live-canvas/templates/feedback-react/index.ts +0 -62
- package/packages/opencode/command/live-canvas/templates/feedback-react/selector-utils.ts +0 -423
- package/packages/opencode/command/live-canvas/templates/feedback-react/types.ts +0 -118
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: live-canvas
|
|
3
|
-
description: Conduct design interviews, generate UI variations, and collect click-to-annotate feedback
|
|
4
|
-
usage: /live-canvas
|
|
5
|
-
auto_trigger: false
|
|
3
|
+
description: Conduct design interviews, generate UI variations, and collect live click-to-annotate feedback that streams into the session so edits land without leaving the browser. Use when the user wants rapid iterative UI refinement, not just batched feedback.
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Live Canvas Skill
|
|
@@ -17,120 +15,125 @@ This skill implements a complete design exploration workflow: interview, generat
|
|
|
17
15
|
|
|
18
16
|
**Never leave `.claude-design/` or `__live_canvas` routes behind.** If the user says "cancel", "abort", "stop", or "nevermind" at any point, confirm and then delete all temporary artifacts.
|
|
19
17
|
|
|
18
|
+
---
|
|
20
19
|
|
|
21
|
-
## Feedback Modes
|
|
22
|
-
|
|
23
|
-
Live Canvas supports two feedback transports. The skill auto-selects at runtime — the user never toggles modes manually.
|
|
24
|
-
|
|
25
|
-
- **Mode A — Batch (universal, works everywhere):** each Save writes to `.claude-design/feedback.jsonl`. User types "check" (or any message) to have the assistant read and act on the batch. Works in Claude Code, Droid, Amp, and Opencode identically.
|
|
26
|
-
- **Mode B — Live (Claude Code only):** the overlay POSTs each Save to a local MCP channel server; feedback arrives in the active session as a `<channel source="live-canvas" ...>` tag. Edits land without the user switching windows.
|
|
20
|
+
## Feedback Modes — always ask the user
|
|
27
21
|
|
|
28
|
-
**
|
|
22
|
+
Live Canvas supports two feedback transports. **The user picks every time** — never auto-select.
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Claude Code | A + B | Probe channel at Phase 0. If up → Live. If down → announce Batch and print the one-time setup block below. |
|
|
33
|
-
| Droid, Amp, Opencode | A only | Never probe the channel, never mention Live mode, never offer to install a plugin. Use Batch exclusively and collect feedback via paste-in-terminal (Phase 5). |
|
|
24
|
+
- **Live channel (Claude Code only):** the overlay POSTs each Save to a local MCP channel server; feedback arrives in the active session as a `<channel source="live-canvas" ...>` tag. Requires the session was launched with `live-claude` (or `claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace`) — channels are still an experimental Claude Code feature and a plain `claude` session silently drops the notifications. Any qualifying session can claim the channel by calling `mcp__live-canvas__channel_open`; only one holds it at a time.
|
|
25
|
+
- **JSON file (universal):** each Save accumulates locally; Submit writes `.claude-design/feedback.jsonl` (or downloads the JSON). User says "check" or pastes the file when ready. Works in any host.
|
|
34
26
|
|
|
35
|
-
###
|
|
27
|
+
### Host detection — do this first
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
This SKILL.md is the Claude Code variant of the skill. Same content is mirrored as docs for Droid/Amp/Opencode under `packages/<tool>/commands/live-canvas/`, but those tools don't support the MCP channel.
|
|
38
30
|
|
|
39
|
-
**
|
|
31
|
+
**If running under Droid, Amp, or Opencode (not Claude Code):**
|
|
32
|
+
- Skip the mode question entirely.
|
|
33
|
+
- Announce: `📝 JSON mode (Live channel requires Claude Code)`.
|
|
34
|
+
- Proceed to Phase 1 with `channelUrl` omitted in the overlay init.
|
|
35
|
+
- Never mention the channel plugin.
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
curl -s --max-time 1 http://localhost:8788/health
|
|
43
|
-
```
|
|
37
|
+
How to tell which host you're in: the environment variable `CLAUDECODE=1` is set by Claude Code. If unset, assume non-Claude and go straight to JSON.
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
### Mode selection (Claude Code only)
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|---|---|---|
|
|
49
|
-
| `{"ok":true,...}` | (don't bother checking) | **Case 1 — Live ready** |
|
|
50
|
-
| fails | exists | **Case 2 — Plugin installed, session not in dev mode** |
|
|
51
|
-
| fails | missing | **Case 3 — First-time user** |
|
|
41
|
+
Always ask, never auto-detect. Use `AskUserQuestion`:
|
|
52
42
|
|
|
53
|
-
**
|
|
43
|
+
> **Question: Pick a feedback mode**
|
|
44
|
+
> - **Live channel** — overlay streams each Save straight into this Claude session. **Requires this session to have been started with `live-claude`** (sets the `--dangerously-load-development-channels` flag). If you started with plain `claude`, pick JSON instead — Live mode will refuse to start and tell you to open a new `live-claude` terminal.
|
|
45
|
+
> - **JSON file** — overlay writes feedback to a local JSON file; tell me "check" when ready. Works in any session, plain `claude` included.
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
**If the user picks JSON**, try to bind the batch endpoint so submissions write to disk instead of triggering a browser download. Call `mcp__live-canvas__batch_open`:
|
|
56
48
|
|
|
57
|
-
|
|
49
|
+
| Tool result | What to do |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Tool not available (no MCP) | Announce `📝 JSON mode — overlay will offer JSON download on Submit`. Proceed to Phase 1 with both `channelUrl` and `batchEndpoint` omitted. |
|
|
52
|
+
| `{status: "opened", ...}` or `{status: "already_listening", ...}` | Announce `📝 JSON mode — submissions write to .claude-design/feedback.jsonl`. Proceed to Phase 1 with `batchEndpoint: 'http://localhost:8788/feedback-jsonl'` and `channelUrl` omitted. |
|
|
53
|
+
| `{status: "in_use", ...}` | Announce `📝 JSON mode — overlay will offer JSON download on Submit (another session holds the port)`. Proceed to Phase 1 with both `channelUrl` and `batchEndpoint` omitted. |
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
✨ Live mode — your feedback will stream into this session in real time.
|
|
61
|
-
```
|
|
55
|
+
Call `mcp__live-canvas__channel_close` on cleanup/abort to release the port (same teardown as Live mode).
|
|
62
56
|
|
|
63
|
-
|
|
57
|
+
**If the user picks Live**, claim the channel by calling the MCP tool `mcp__live-canvas__channel_open`. Branch on the result:
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
| Tool result | What to do |
|
|
60
|
+
|---|---|
|
|
61
|
+
| Tool not available (no such tool / MCP error) | **Case C: First-time setup needed.** Print the install block (below) and STOP. |
|
|
62
|
+
| `{status: "opened", ...}` (no `took_over`) | **Case A: Ready.** Announce `✨ Live mode — feedback streams into this session`. Proceed to Phase 1 with `channelUrl: 'http://localhost:8788'`. |
|
|
63
|
+
| `{status: "opened", took_over: <pid>, ...}` | **Case A (takeover): Ready.** Announce `✨ Live mode — feedback streams into this session (took over channel from prior live-canvas session pid <pid>)`. Proceed to Phase 1 the same as plain Case A. The prior session's MCP was a sibling instance of this plugin (same user); its `/live-canvas` workflow there is now over, but the lab files on disk are untouched. |
|
|
64
|
+
| `{status: "already_listening", ...}` | **Case A: Ready.** Announce `✨ Live mode — feedback streams into this session`. Proceed to Phase 1 with `channelUrl: 'http://localhost:8788'`. |
|
|
65
|
+
| `{status: "in_use", holder_pid, message, ...}` | **Case B: Foreign process holds the port.** A non-live-canvas process is using port 8788 (e.g., a dev server on the wrong port). Print the busy block (below) and STOP — the plugin won't kill processes it doesn't own. |
|
|
66
|
+
| `{status: "no_channel_capability", message, ...}` | **Case D: Session lacks the channels flag.** Print the relaunch block (below) and STOP. Do NOT proceed to Live mode — notifications would be silently dropped. |
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
You must call `mcp__live-canvas__channel_close` later — see Phase 8 (Cleanup) and Abort Handling. The MCP plugin also auto-releases the port on session disconnect as a safety net, but explicit close is cleaner.
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
> - "Batch for now" — continue without live mode. Feedback writes to JSONL; paste or say 'check' when ready.
|
|
71
|
-
> - "Restart for Live mode" — I'll abort here. Close this session, run the command below in your terminal, then `/live-canvas` again in the new one.
|
|
70
|
+
**Case B — busy block (foreign holder):**
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
Substitute the actual `holder_pid` from the tool response into the message below.
|
|
74
73
|
|
|
75
74
|
```
|
|
76
|
-
|
|
75
|
+
Port 8788 is held by pid <holder_pid>, which is NOT a live-canvas server
|
|
76
|
+
(it's some other process). I won't kill processes I don't own.
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
To use Live mode:
|
|
79
|
+
• Find what it is: ps -fp <holder_pid>
|
|
80
|
+
• Stop it if it's safe to stop (e.g. a stray dev server on the wrong port).
|
|
81
|
+
• Then re-run /live-canvas in this session and pick Live.
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Tip: save an alias so you don't retype this every time:
|
|
83
|
-
alias claude-live='claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace'
|
|
83
|
+
Or pick JSON now — JSON mode does not require port 8788.
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
If they pick "Batch for now", announce Batch mode and proceed to Phase 1 normally.
|
|
89
|
-
|
|
90
|
-
### Case 3 — First-time user
|
|
91
|
-
|
|
92
|
-
Channel plugin has never been set up. Use `AskUserQuestion`:
|
|
93
|
-
|
|
94
|
-
> **Question: Set up Live mode?**
|
|
95
|
-
> - "Yes, walk me through it" — I'll print the one-time setup commands.
|
|
96
|
-
> - "Just use Batch mode" — skip setup, start the skill normally.
|
|
97
|
-
|
|
98
|
-
If they pick setup, print the full sequence:
|
|
86
|
+
**Case D — relaunch block (no channels flag):**
|
|
99
87
|
|
|
100
88
|
```
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
89
|
+
This Claude session is plain `claude` — it can't receive Live-mode feedback.
|
|
90
|
+
Live mode needs a session started with `live-claude` (which sets the
|
|
91
|
+
experimental --dangerously-load-development-channels flag). Without it,
|
|
92
|
+
your browser Saves would POST 200 but never appear in chat.
|
|
93
|
+
|
|
94
|
+
To use Live mode:
|
|
95
|
+
|
|
96
|
+
1. Open a NEW terminal (you can keep this one running; it's fine to have
|
|
97
|
+
both). Do NOT --continue this session — start fresh in the project.
|
|
98
|
+
2. cd to your project directory.
|
|
99
|
+
3. Run: live-claude
|
|
100
|
+
(if the command isn't found: run `source ~/.zshrc` first, or re-run
|
|
101
|
+
packages/claude/plugins/live-canvas-marketplace/setup.sh)
|
|
102
|
+
(literal form: claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace)
|
|
103
|
+
4. In that NEW session, run /live-canvas and pick Live.
|
|
104
|
+
|
|
105
|
+
The lab files are written to disk in the project's `.claude-design/lab/`,
|
|
106
|
+
so any session in the right cwd can pick up where another left off.
|
|
107
|
+
|
|
108
|
+
Or pick JSON now to stay in this session — feedback gets written to a file
|
|
109
|
+
you paste back here. No relaunch needed.
|
|
110
|
+
```
|
|
114
111
|
|
|
115
|
-
|
|
112
|
+
**Case C — first-time setup block:**
|
|
116
113
|
|
|
117
|
-
Tip: alias for future sessions:
|
|
118
|
-
alias claude-live='claude --dangerously-load-development-channels plugin:live-canvas-channel@live-canvas-marketplace'
|
|
119
114
|
```
|
|
115
|
+
Live mode needs a one-time install. Two steps:
|
|
120
116
|
|
|
121
|
-
|
|
117
|
+
1. From this repo's root (or wherever liteagents lives):
|
|
118
|
+
bash packages/claude/plugins/live-canvas-marketplace/setup.sh
|
|
119
|
+
This copies the marketplace into ~/.claude/plugins/ and runs npm install.
|
|
122
120
|
|
|
123
|
-
|
|
121
|
+
2. In any Claude session, register and install the plugin:
|
|
122
|
+
/plugin marketplace add ~/.claude/plugins/live-canvas-marketplace
|
|
123
|
+
/plugin install live-canvas-channel@live-canvas-marketplace
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
That's it — once the plugin is installed, /live-canvas in any session can
|
|
126
|
+
claim the channel. Re-run /live-canvas and pick Live.
|
|
127
|
+
```
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
1.
|
|
129
|
+
Do not try to run any of these commands yourself. Three reasons:
|
|
130
|
+
1. The `/plugin` steps are Claude Code slash commands — not doable from inside a running session.
|
|
129
131
|
2. Accepting the research-preview safety prompt must be the user's explicit act.
|
|
130
132
|
3. If something goes wrong mid-install, the user needs to see each step's output to diagnose.
|
|
131
133
|
|
|
132
134
|
The user always executes these manually. Your job is to make the sequence obvious and copyable.
|
|
133
135
|
|
|
136
|
+
---
|
|
134
137
|
|
|
135
138
|
## Phase 0: Preflight Detection
|
|
136
139
|
|
|
@@ -208,6 +211,7 @@ theme.boxShadow // Elevation system
|
|
|
208
211
|
|
|
209
212
|
**Store inferred styles in the Design Brief** for consistent use across all variants.
|
|
210
213
|
|
|
214
|
+
---
|
|
211
215
|
|
|
212
216
|
## Phase 1: Interview
|
|
213
217
|
|
|
@@ -343,6 +347,7 @@ If target is unclear, propose a name based on repo patterns and confirm.
|
|
|
343
347
|
- "None" - No special constraints
|
|
344
348
|
- multiSelect: true
|
|
345
349
|
|
|
350
|
+
---
|
|
346
351
|
|
|
347
352
|
## Phase 2: Generate Design Brief
|
|
348
353
|
|
|
@@ -381,6 +386,7 @@ After the interview, create a structured Design Brief as JSON and save to `.clau
|
|
|
381
386
|
|
|
382
387
|
Display a summary to the user before proceeding.
|
|
383
388
|
|
|
389
|
+
---
|
|
384
390
|
|
|
385
391
|
## Phase 3: Generate Live Canvas
|
|
386
392
|
|
|
@@ -400,12 +406,6 @@ Create all files under `.claude-design/`:
|
|
|
400
406
|
│ │ └── VariantE.tsx
|
|
401
407
|
│ ├── components/
|
|
402
408
|
│ │ └── LabShell.tsx # Lab layout wrapper
|
|
403
|
-
│ ├── feedback/ # Interactive feedback system
|
|
404
|
-
│ │ ├── types.ts # TypeScript interfaces
|
|
405
|
-
│ │ ├── selector-utils.ts # Element identification
|
|
406
|
-
│ │ ├── format-utils.ts # Feedback formatting
|
|
407
|
-
│ │ ├── FeedbackOverlay.tsx # Main overlay component
|
|
408
|
-
│ │ └── index.ts # Module exports
|
|
409
409
|
│ └── data/
|
|
410
410
|
│ └── fixtures.ts # Shared mock data
|
|
411
411
|
├── design-brief.json
|
|
@@ -416,61 +416,54 @@ Create all files under `.claude-design/`:
|
|
|
416
416
|
|
|
417
417
|
**The overlay is the PRIMARY feature of Live Canvas.** Without it, users cannot provide interactive feedback. NEVER generate a lab without the overlay.
|
|
418
418
|
|
|
419
|
-
###
|
|
419
|
+
### The overlay
|
|
420
420
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
| Template | When to use |
|
|
424
|
-
|---|---|
|
|
425
|
-
| `feedback-react/FeedbackOverlay.tsx` | React / Next.js / Vite-React projects — integrates via JSX |
|
|
426
|
-
| `overlay-vanilla.js` | Everything else: vanilla JS, Vue, Svelte, Rails, Django, Phoenix, plain HTML, Go templates, etc. One script tag, zero dependencies. |
|
|
421
|
+
**One template, every framework:** `~/.claude/skills/live-canvas/templates/overlay-vanilla.js`. Single file, zero dependencies, plain DOM. Works in vanilla JS, Vue, Svelte, Rails, Django, Phoenix, plain HTML, Next.js, Vite-React, Remix — anywhere a `<script>` tag runs.
|
|
427
422
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
### Required files in the route directory
|
|
431
|
-
|
|
432
|
-
For **React-based** projects:
|
|
433
|
-
```
|
|
434
|
-
app/live-canvas/ # or app/__live_canvas/
|
|
435
|
-
├── page.tsx # Main lab page with variants + overlay import
|
|
436
|
-
└── FeedbackOverlay.tsx # Copy of feedback-react/FeedbackOverlay.tsx
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
Import: `import { FeedbackOverlay } from './FeedbackOverlay'`
|
|
440
|
-
|
|
441
|
-
For **non-React** projects:
|
|
442
|
-
```
|
|
443
|
-
<static-dir>/__live_canvas/
|
|
444
|
-
├── index.html # Or framework-appropriate entry point
|
|
445
|
-
└── overlay-vanilla.js # Copy of templates/overlay-vanilla.js
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
HTML: `<script src="overlay-vanilla.js"></script>` plus an init script that wires up mode + target (see "Wiring the overlay" below).
|
|
423
|
+
Copy it into a directory served by the dev server (e.g. `public/overlay-vanilla.js` for Next.js, `static/overlay-vanilla.js` for Vite, the public dir for Rails/Django). Reference it from the lab page.
|
|
449
424
|
|
|
450
425
|
### Wiring the overlay
|
|
451
426
|
|
|
452
|
-
|
|
427
|
+
The overlay needs one `init()` call with `target`, `channelUrl` (Live only), and optionally `batchEndpoint`.
|
|
453
428
|
|
|
454
|
-
**
|
|
429
|
+
**Server-rendered / vanilla HTML:**
|
|
455
430
|
|
|
456
431
|
```html
|
|
457
|
-
<script src="
|
|
432
|
+
<script src="/overlay-vanilla.js"></script>
|
|
458
433
|
<script>
|
|
459
434
|
LiveCanvas.init({
|
|
460
435
|
target: '<ComponentOrPageName>',
|
|
461
|
-
// Only include channelUrl when
|
|
462
|
-
//
|
|
436
|
+
// Only include channelUrl when the user picked Live and the probe succeeded.
|
|
437
|
+
// In JSON mode, OMIT channelUrl so the overlay skips the probe.
|
|
463
438
|
channelUrl: 'http://localhost:8788',
|
|
464
|
-
// Optional: where to POST
|
|
465
|
-
// When omitted,
|
|
439
|
+
// Optional: where to POST JSON payloads when channelUrl is missing.
|
|
440
|
+
// When omitted, Submit downloads a JSON file instead.
|
|
466
441
|
batchEndpoint: '/__live_canvas/feedback',
|
|
467
442
|
});
|
|
468
443
|
</script>
|
|
469
444
|
```
|
|
470
445
|
|
|
471
|
-
**React
|
|
446
|
+
**React / Next.js / Vite-React:** load the script with the framework's mechanism and init in a `useEffect`:
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
import Script from 'next/script';
|
|
450
|
+
import { useEffect } from 'react';
|
|
451
|
+
|
|
452
|
+
export default function Lab() {
|
|
453
|
+
useEffect(() => {
|
|
454
|
+
(window as any).LiveCanvas?.init({
|
|
455
|
+
target: 'PostCard',
|
|
456
|
+
channelUrl: 'http://localhost:8788', // omit in JSON mode
|
|
457
|
+
});
|
|
458
|
+
}, []);
|
|
459
|
+
return (<>
|
|
460
|
+
<Script src="/overlay-vanilla.js" strategy="afterInteractive" />
|
|
461
|
+
{/* variants ... */}
|
|
462
|
+
</>);
|
|
463
|
+
}
|
|
464
|
+
```
|
|
472
465
|
|
|
473
|
-
|
|
466
|
+
Vite-React: use `<script>` in `index.html` or `useEffect` with a dynamic `import()`. Same `LiveCanvas.init({...})` call.
|
|
474
467
|
|
|
475
468
|
### Why the templates live in the route directory
|
|
476
469
|
|
|
@@ -511,6 +504,7 @@ Create the most appropriate temporary route for the detected framework.
|
|
|
511
504
|
- Border radius → from existing cards, buttons, inputs
|
|
512
505
|
- Shadows → from existing elevated components
|
|
513
506
|
|
|
507
|
+
---
|
|
514
508
|
|
|
515
509
|
Each variant MUST explore a different design axis. Do not create minor variations—make them meaningfully distinct. **Use the project's existing visual language for all variants.**
|
|
516
510
|
|
|
@@ -551,6 +545,7 @@ The Live Canvas page must include:
|
|
|
551
545
|
1. **Header** with:
|
|
552
546
|
- Design Brief summary (target, scope, key requirements)
|
|
553
547
|
- Instructions for reviewing
|
|
548
|
+
- **Lab banner (REQUIRED)** — paste `~/.claude/skills/live-canvas/templates/lab-banner.html` at the top of the lab page. Same text in any mode. For React/TSX labs, translate the inline style to a JS object: camelCase keys, string values. E.g. `style="border-radius:8px; padding:10px 14px; font-size:13px"` → `style={{ borderRadius: '8px', padding: '10px 14px', fontSize: '13px' }}`. Keep the text and `role="note"`.
|
|
554
549
|
|
|
555
550
|
2. **Variant Grid** with:
|
|
556
551
|
- Clear labels (A, B, C, D, E)
|
|
@@ -571,43 +566,13 @@ The Live Canvas page must include:
|
|
|
571
566
|
|
|
572
567
|
⚠️ **THIS IS THE MOST IMPORTANT REQUIREMENT** ⚠️
|
|
573
568
|
|
|
574
|
-
The
|
|
569
|
+
The overlay (`overlay-vanilla.js`) enables users to click on elements and leave comments. Without it, the Live Canvas is just a static page with no way to collect structured feedback.
|
|
575
570
|
|
|
576
|
-
-
|
|
577
|
-
-
|
|
578
|
-
-
|
|
579
|
-
- Pass `targetName` prop with the component/page name
|
|
580
|
-
|
|
581
|
-
**Example integration:**
|
|
582
|
-
|
|
583
|
-
```tsx
|
|
584
|
-
import { FeedbackOverlay } from './FeedbackOverlay'; // Relative import - always works
|
|
585
|
-
|
|
586
|
-
export default function DesignLabPage() {
|
|
587
|
-
return (
|
|
588
|
-
<div className="min-h-screen bg-background">
|
|
589
|
-
<header>...</header>
|
|
590
|
-
|
|
591
|
-
<main>
|
|
592
|
-
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
|
593
|
-
<div data-variant="A">
|
|
594
|
-
<VariantA />
|
|
595
|
-
</div>
|
|
596
|
-
<div data-variant="B">
|
|
597
|
-
<VariantB />
|
|
598
|
-
</div>
|
|
599
|
-
{/* ... more variants */}
|
|
600
|
-
</div>
|
|
601
|
-
</main>
|
|
602
|
-
|
|
603
|
-
{/* CRITICAL: FeedbackOverlay must be included */}
|
|
604
|
-
<FeedbackOverlay targetName="ComponentName" />
|
|
605
|
-
</div>
|
|
606
|
-
);
|
|
607
|
-
}
|
|
608
|
-
```
|
|
571
|
+
- Copy `~/.claude/skills/live-canvas/templates/overlay-vanilla.js` into a directory served by the dev server (e.g. `public/`, `static/`, or wherever the framework serves static assets).
|
|
572
|
+
- Reference it from the lab page via `<script>` tag and call `LiveCanvas.init({...})` once with `target`, `channelUrl` (Live mode), and optional `batchEndpoint`. See "Wiring the overlay" above for the exact snippets per framework.
|
|
573
|
+
- Every variant container in the lab page MUST have a `data-variant="X"` attribute (A, B, C, D, E, or F). The overlay uses this to route comments to the right variant file.
|
|
609
574
|
|
|
610
|
-
**If you forget the
|
|
575
|
+
**If you forget to wire up the overlay, the user CANNOT provide feedback.** This defeats the entire purpose of the Live Canvas.
|
|
611
576
|
|
|
612
577
|
### Code Quality
|
|
613
578
|
|
|
@@ -633,6 +598,7 @@ export default function DesignLabPage() {
|
|
|
633
598
|
- Use ease-out for entrances, ease-in for exits
|
|
634
599
|
- Respect `prefers-reduced-motion`
|
|
635
600
|
|
|
601
|
+
---
|
|
636
602
|
|
|
637
603
|
## Phase 4: Present Live Canvas to User
|
|
638
604
|
|
|
@@ -660,17 +626,17 @@ Make sure your dev server is running, then:
|
|
|
660
626
|
4. Keep going, or tell me "done" whenever you're ready to synthesize a winner
|
|
661
627
|
```
|
|
662
628
|
|
|
663
|
-
**If
|
|
629
|
+
**If JSON mode:**
|
|
664
630
|
|
|
665
631
|
```
|
|
666
|
-
📝 Live Canvas ready —
|
|
632
|
+
📝 Live Canvas ready — JSON mode
|
|
667
633
|
|
|
668
634
|
Variants are at: http://localhost:3000/__live_canvas
|
|
669
635
|
|
|
670
636
|
Click "Add Feedback" (bottom-right), comment on elements, fill "Overall Direction", click Submit.
|
|
671
637
|
Then paste the JSON/markdown here, or just tell me your feedback in plain English.
|
|
672
638
|
|
|
673
|
-
(To
|
|
639
|
+
(To use Live mode next time: relaunch with `live-claude` and pick Live when /live-canvas asks.)
|
|
674
640
|
```
|
|
675
641
|
|
|
676
642
|
### Then proceed to Phase 5
|
|
@@ -681,6 +647,7 @@ Don't wait for the user to confirm they opened the browser — move on so the fe
|
|
|
681
647
|
|
|
682
648
|
Running `pnpm dev` or `npm run dev` starts a long-running process that never exits. If you run it, you'll wait forever. The user likely already has their dev server running, or can start it themselves in another terminal.
|
|
683
649
|
|
|
650
|
+
---
|
|
684
651
|
|
|
685
652
|
## Phase 5: Collect Feedback
|
|
686
653
|
|
|
@@ -711,7 +678,7 @@ make this more prominent
|
|
|
711
678
|
|
|
712
679
|
If multiple `<channel>` tags arrive together, batch the acknowledgments but do each edit one at a time so the user's dev server hot-reloads visibly between changes.
|
|
713
680
|
|
|
714
|
-
###
|
|
681
|
+
### JSON mode — interactive or pasted
|
|
715
682
|
|
|
716
683
|
The Live Canvas includes a Figma-like feedback overlay. When presenting the lab, include these instructions:
|
|
717
684
|
|
|
@@ -822,6 +789,7 @@ Example response format to guide user:
|
|
|
822
789
|
|
|
823
790
|
Then proceed to **Phase 6: Synthesize New Variant**.
|
|
824
791
|
|
|
792
|
+
---
|
|
825
793
|
|
|
826
794
|
## Phase 6: Synthesize New Variant
|
|
827
795
|
|
|
@@ -853,6 +821,7 @@ If "Getting closer" or "Went the wrong direction", gather more specific feedback
|
|
|
853
821
|
|
|
854
822
|
Then proceed to **Phase 7: Final Preview**.
|
|
855
823
|
|
|
824
|
+
---
|
|
856
825
|
|
|
857
826
|
## Phase 7: Final Preview
|
|
858
827
|
|
|
@@ -884,6 +853,7 @@ Once user is satisfied:
|
|
|
884
853
|
If "No, needs changes": gather feedback and iterate.
|
|
885
854
|
If "Abort": proceed to **Abort Handling** below.
|
|
886
855
|
|
|
856
|
+
---
|
|
887
857
|
|
|
888
858
|
## Abort Handling
|
|
889
859
|
|
|
@@ -901,6 +871,7 @@ When abort is detected:
|
|
|
901
871
|
- "Are you sure you want to cancel? This will delete all the Live Canvas files I created."
|
|
902
872
|
|
|
903
873
|
2. **If confirmed, clean up immediately:**
|
|
874
|
+
- If Live mode was active, call `mcp__live-canvas__channel_close` to release port 8788.
|
|
904
875
|
- Delete `.claude-design/` directory entirely
|
|
905
876
|
- Delete temporary route files (`app/__live_canvas/`, etc.)
|
|
906
877
|
- Do NOT generate any implementation plan
|
|
@@ -909,6 +880,7 @@ When abort is detected:
|
|
|
909
880
|
3. **Acknowledge:**
|
|
910
881
|
- "Design exploration cancelled. All temporary files have been cleaned up. Let me know if you want to start fresh later."
|
|
911
882
|
|
|
883
|
+
---
|
|
912
884
|
|
|
913
885
|
## Phase 8: Finalize
|
|
914
886
|
|
|
@@ -916,6 +888,8 @@ When user confirms (selected "Yes, finalize it"):
|
|
|
916
888
|
|
|
917
889
|
### 8.1: Cleanup
|
|
918
890
|
|
|
891
|
+
If Live mode was active, call `mcp__live-canvas__channel_close` to release port 8788 so another session can claim it.
|
|
892
|
+
|
|
919
893
|
Delete all temporary files:
|
|
920
894
|
- Remove `.claude-design/` directory entirely
|
|
921
895
|
- Remove temporary route files:
|
|
@@ -987,6 +961,7 @@ Create `DESIGN_PLAN.md` in the project root:
|
|
|
987
961
|
- [Any new tokens to add]
|
|
988
962
|
- [Existing tokens to use]
|
|
989
963
|
|
|
964
|
+
---
|
|
990
965
|
|
|
991
966
|
*Generated by Live Canvas skill*
|
|
992
967
|
```
|
|
@@ -1036,6 +1011,7 @@ If new file:
|
|
|
1036
1011
|
- **Styling approach:** [Tailwind classes, CSS modules, etc.]
|
|
1037
1012
|
- **Existing primitives:** [Button, Input, Card, etc.]
|
|
1038
1013
|
|
|
1014
|
+
---
|
|
1039
1015
|
|
|
1040
1016
|
*Updated by Live Canvas skill*
|
|
1041
1017
|
```
|
|
@@ -1045,6 +1021,7 @@ If updating existing file:
|
|
|
1045
1021
|
- Update any conflicting guidance with latest decisions
|
|
1046
1022
|
- Keep file concise and actionable
|
|
1047
1023
|
|
|
1024
|
+
---
|
|
1048
1025
|
|
|
1049
1026
|
## Error Handling
|
|
1050
1027
|
|
|
@@ -1070,6 +1047,7 @@ If cleanup is interrupted:
|
|
|
1070
1047
|
- Provide manual cleanup instructions
|
|
1071
1048
|
- Never leave partial state without informing user
|
|
1072
1049
|
|
|
1050
|
+
---
|
|
1073
1051
|
|
|
1074
1052
|
## Configuration Options
|
|
1075
1053
|
|
|
@@ -1079,6 +1057,7 @@ The plugin supports these optional configurations (via environment or project co
|
|
|
1079
1057
|
- `DESIGN_KEEP_LAB`: If `true`, don't delete lab until explicit cleanup command
|
|
1080
1058
|
- `DESIGN_MEMORY_PATH`: Custom path for Design Memory file
|
|
1081
1059
|
|
|
1060
|
+
---
|
|
1082
1061
|
|
|
1083
1062
|
## Example Session Flow
|
|
1084
1063
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "live-canvas-channel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Bridges the Live Canvas browser overlay to a Claude Code session. Each overlay Save becomes a claude/channel notification delivered over MCP.",
|
|
5
5
|
"author": { "name": "liteagents" },
|
|
6
6
|
"channels": [
|
package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Claude Code channel plugin that bridges the Live Canvas browser overlay to a run
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
- HTTP listener: `127.0.0.1:8788` (override with `LIVE_CANVAS_PORT`)
|
|
15
|
-
- `GET /health` — overlay probes this to
|
|
15
|
+
- `GET /health` — overlay probes this to confirm Live mode is reachable
|
|
16
16
|
- `POST /feedback` — wire-compatible with the overlay's v1.0 schema
|
|
17
17
|
- stdio: MCP protocol using `@modelcontextprotocol/sdk`
|
|
18
18
|
|
|
@@ -84,6 +84,6 @@ curl -X POST http://localhost:8788/feedback \
|
|
|
84
84
|
|
|
85
85
|
## Failure modes
|
|
86
86
|
|
|
87
|
-
- **Port in use** — another Claude session owns 8788. Logs to stderr and exits; overlay health probe fails; overlay falls back to
|
|
87
|
+
- **Port in use** — another Claude session owns 8788. Logs to stderr and exits; overlay health probe fails; overlay falls back to JSON mode silently. The skill itself never silently degrades — it stops and asks the user.
|
|
88
88
|
- **Invalid payload** — HTTP 400 with reason; no notification emitted.
|
|
89
89
|
- **MCP transport not connected** — HTTP call still returns 200 (so the overlay shows "pushed"), but stderr logs the drop. Avoids false-negative toasts.
|
package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"title": "LiveCanvasFeedback",
|
|
4
|
-
"description": "Payload shape posted by the Live Canvas overlay to POST /feedback.
|
|
4
|
+
"description": "Payload shape posted by the Live Canvas overlay to POST /feedback. v1.0 schema produced by overlay-vanilla.js.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"required": ["version", "target", "comment"],
|
|
7
7
|
"properties": {
|