@popmelt.com/core 0.8.17 → 0.9.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/README.md CHANGED
@@ -1,14 +1,57 @@
1
1
  <p align="center">
2
- <img src="src/assets/bar - popmelt.png" alt="Popmelt" width="360" />
2
+ <img src="https://raw.githubusercontent.com/popmelt/core/main/src/assets/popmelt-logo.svg" alt="Popmelt" width="72" />
3
3
  </p>
4
4
 
5
5
  # Popmelt
6
6
 
7
- Popmelt is a design collaboration layer for AI coding agents. It gives you a visual toolbar inside your running React app so you can annotate UI, adjust it directly, and hand the result to Claude Code, Codex, or GitHub Copilot without translating every design decision into a written prompt.
7
+ Popmelt is a design collaboration layer that lives inside your local app projects. When your app is running locally, Popmelt appears as a toolbar in the browser.
8
8
 
9
- Popmelt is local-first. Your project, annotations, screenshots, conversations, decisions, and models remain in your development environment.
9
+ Point to any part of your UI, describe what you have in mind, and work through it with Codex or Claude Code in a thread right on the page. You can stack as many threads as you want, so different ideas can move forward without losing their context.
10
10
 
11
- ## Install
11
+ As you collaborate, Popmelt builds an **Imprint**: a living project memory of your intent, preferences, and design decisions. Later threads can use that shared understanding instead of starting from scratch.
12
+
13
+ Popmelt is local-first. Its annotations, screenshots, threads, and Imprint live with your project under `.popmelt/`.
14
+
15
+ ## What you need
16
+
17
+ - A local React project
18
+ - Node.js 18 or newer
19
+ - React 18 or newer
20
+ - The Codex CLI or Claude Code CLI installed, available in your terminal, and signed in
21
+
22
+ The Codex and Claude Code desktop apps work too. Open your local app in their built-in browser and use Popmelt there just as you would in any other browser. The corresponding CLI still needs to be installed and signed in because it runs the threads.
23
+
24
+ ## Install with your coding agent
25
+
26
+ From inside your project, give your coding agent this prompt:
27
+
28
+ > Let's install `@popmelt.com/core` in this project
29
+
30
+ Your agent can detect the framework, add the provider and integration, and preserve your existing development command. Restart the development server when it is finished.
31
+
32
+ ## Use Popmelt
33
+
34
+ 1. Run your project locally and open it in a browser
35
+ 2. Double-tap Command on macOS or Control on Windows and Linux to open the Popmelt toolbar
36
+ 3. Select part of the UI and leave a note about what should change
37
+ 4. Press Command+Enter on macOS or Control+Enter on Windows and Linux to send the thread to your coding agent. Review the result and keep iterating from the same thread
38
+ 5. To edit text directly, double-tap a text element. Popmelt marks the change so you can send it like any other annotation
39
+
40
+ Each annotation owns its thread. Status stays attached to the relevant part of the page while work is queued or running, and you can reopen any thread from its badge. Tool and Imprint receipts show what helped the agent reach its result.
41
+
42
+ ## Imprint
43
+
44
+ As you work, Popmelt recognizes choices that may be useful beyond the current thread and proposes an Imprint update:
45
+
46
+ - **Yes** adds the learning to the project's shared understanding
47
+ - **This time** keeps it local to the current situation
48
+ - **No** leaves the Imprint unchanged and gives you room to explain what Popmelt misunderstood
49
+
50
+ Confirmed Imprint knowledge is available to future threads when it is relevant. Popmelt can also search the project's collaboration history when a question depends on earlier discussions, feedback, or the evolution of a part of the UI.
51
+
52
+ Open the Imprint panel with `I` to inspect the project's current understanding, supporting evidence, relationships, and exceptions.
53
+
54
+ ## Manual setup
12
55
 
13
56
  Install Popmelt and its icon peer dependency:
14
57
 
@@ -16,15 +59,9 @@ Install Popmelt and its icon peer dependency:
16
59
  npm install @popmelt.com/core lucide-react
17
60
  ```
18
61
 
19
- Popmelt requires React 18+ and Node.js 18+. At least one supported AI CLI must be installed and authenticated:
20
-
21
- - Claude Code
22
- - Codex CLI
23
- - GitHub Copilot CLI
24
-
25
62
  ### Add the provider
26
63
 
27
- Wrap your application with `PopmeltProvider`. The component that calls `useRouter()` must be a client component in Next.js.
64
+ Wrap your app with `PopmeltProvider`. In Next.js, the component that calls `useRouter()` must be a client component.
28
65
 
29
66
  ```tsx
30
67
  'use client';
@@ -40,13 +77,13 @@ export function Providers({ children }: { children: React.ReactNode }) {
40
77
  }
41
78
  ```
42
79
 
43
- `navigate` is optional for single-page use. Pass your router's navigation function to support annotations and screenshots across routes.
80
+ `navigate` is optional for single-page use. Pass your router's navigation function when Popmelt needs to restore annotations across routes.
44
81
 
45
82
  ### Next.js
46
83
 
47
- For Next.js, both steps below are required.
84
+ Next.js needs both the command wrapper and the config wrapper.
48
85
 
49
- 1. Run the dev server through the Popmelt wrapper. Update the existing `dev` script while preserving any flags your project already uses:
86
+ Update the existing development script while preserving any flags already in use:
50
87
 
51
88
  ```json
52
89
  {
@@ -56,13 +93,7 @@ For Next.js, both steps below are required.
56
93
  }
57
94
  ```
58
95
 
59
- For example, a Turbopack project can use:
60
-
61
- ```json
62
- "dev": "popmelt wrap -- next dev --turbopack"
63
- ```
64
-
65
- 2. Wrap the Next config:
96
+ Then wrap the Next config:
66
97
 
67
98
  ```ts
68
99
  // next.config.ts
@@ -73,11 +104,11 @@ const nextConfig = {};
73
104
  export default withPopmelt(nextConfig);
74
105
  ```
75
106
 
76
- The command wrapper starts the bridge for this project. The Next config wrapper connects the browser UI to that bridge. Using only one of these two pieces is not a complete setup.
107
+ The command wrapper starts the project bridge. The config wrapper connects the browser toolbar to it. Using only one is not a complete setup.
77
108
 
78
109
  ### Vite
79
110
 
80
- Add the Vite plugin. It starts and connects the bridge with the Vite dev server.
111
+ Add the Vite plugin:
81
112
 
82
113
  ```ts
83
114
  // vite.config.ts
@@ -92,7 +123,7 @@ export default defineConfig({
92
123
 
93
124
  ### Astro
94
125
 
95
- Add the Astro integration. It starts and connects the bridge with the Astro dev server.
126
+ Add the Astro integration:
96
127
 
97
128
  ```js
98
129
  // astro.config.mjs
@@ -106,7 +137,7 @@ export default defineConfig({
106
137
 
107
138
  ### Other development servers
108
139
 
109
- The wrapper works with any dev command:
140
+ The wrapper can start Popmelt alongside another development command:
110
141
 
111
142
  ```json
112
143
  {
@@ -116,137 +147,46 @@ The wrapper works with any dev command:
116
147
  }
117
148
  ```
118
149
 
119
- You can also start the bridge from custom server startup code:
120
-
121
- ```ts
122
- import { startPopmelt } from '@popmelt.com/core/server';
123
-
124
- await startPopmelt();
125
- ```
126
-
127
150
  ## Verify the installation
128
151
 
129
- Start the app using its normal development command:
152
+ Start the app normally:
130
153
 
131
154
  ```bash
132
155
  npm run dev
133
156
  ```
134
157
 
135
- You should see both the bridge URL and the application URL in the terminal. Open the app and double-tap Cmd on macOS or Ctrl on Windows/Linux. The Popmelt toolbar should appear.
158
+ Open the local app in a browser and double-tap Command or Control. The Popmelt toolbar should appear.
136
159
 
137
160
  If the toolbar opens but cannot reach an AI, check that:
138
161
 
139
- - The dev script includes `popmelt wrap` when using Next.js.
140
- - The framework plugin or config wrapper is installed.
141
- - A supported AI CLI is available and authenticated.
142
- - Another project is not using an old Popmelt bridge. Restart the dev command to reconnect the correct project.
143
-
144
- ## Installing with an AI
145
-
146
- You can hand the following checklist to an AI coding agent:
147
-
148
- > Install `@popmelt.com/core` and `lucide-react`. Add `PopmeltProvider` at the application root. Preserve the existing dev command, but for Next.js prefix it with `popmelt wrap --` and wrap `next.config` with `withPopmelt`. For Vite or Astro, add the corresponding Popmelt plugin. Start the app and verify that the toolbar opens after double-tapping Cmd/Ctrl and that the bridge belongs to this project.
149
-
150
- The important Next.js detail is that `withPopmelt()` does not start the bridge by itself. The `dev` script must also use the Popmelt wrapper.
151
-
152
- ## Use Popmelt
153
-
154
- Double-tap Cmd/Ctrl to open or collapse the toolbar. Hover any toolbar control to see its guidance panel.
155
-
156
- | Tool | Shortcut | Use it to |
157
- | --------- | -------- | ------------------------------------------------------------------------------------- |
158
- | Comment | `C` | Pin feedback to a specific element and start a conversation with your AI. |
159
- | Handle | `H` | Adjust layout, spacing, typography, color, borders, and effects directly on the page. |
160
- | Rectangle | `R` | Mark a rectangular region. |
161
- | Oval | `O` | Mark an oval region. |
162
- | Line | `L` | Point at or connect parts of the UI. |
163
- | Pen | `P` | Draw a freehand annotation. |
164
- | Text | `T` | Add a label or edit existing page text inline. |
165
- | Model | `M` | Review project patterns, components, and design-model suggestions. |
166
-
167
- ### Hand off work
162
+ - The selected AI CLI is installed and signed in
163
+ - A Next.js development script includes `popmelt wrap`
164
+ - The framework plugin or config wrapper is installed
165
+ - The development server was restarted after installation
168
166
 
169
- Create one or more annotations, then press Cmd/Ctrl+Enter. Popmelt sends the visual state, element context, requested edits, and relevant project history to the selected AI.
167
+ ## Data and privacy
170
168
 
171
- The conversation opens in a thread beside the page. You can continue working while jobs run, reopen threads from their status badges, answer questions, and send follow-up guidance. Messages sent while an active thread is working are staged and delivered together on its next run.
169
+ Popmelt stores its annotations, screenshots, threads, UI preferences, and Imprint locally under `.popmelt/`. Unsent annotation drafts and preview state also use browser storage.
172
170
 
173
- ### Comment on elements
171
+ When you send a thread, the context needed to complete that work is passed to your selected AI provider and is subject to that provider's privacy policy.
174
172
 
175
- Select Comment and click an element. Type what should change, then hand it off with Cmd/Ctrl+Enter. The annotation remains attached to that element as the page scrolls and across supported route changes.
176
-
177
- If the AI needs clarification, the annotation shows a Question badge. Open the thread, answer it, and send the reply.
178
-
179
- ### Adjust UI directly
180
-
181
- Select Handle and hover an element. Depending on the element, you can adjust:
182
-
183
- - Width, height, padding, and gap
184
- - Flex and grid alignment
185
- - Font family, weight, size, line height, letter spacing, and alignment
186
- - Text and background colors
187
- - Opacity, radius, borders, and effects
188
- - Raw CSS for properties not represented by a dedicated control
189
-
190
- Right-click the focused element to open the full Handle panel. Values inherited from the page appear as placeholders until you explicitly change them. Hover and scrub numeric field icons to tune values; use modifier keys shown in the panel guidance for snapping and finer control.
191
-
192
- Handle changes are previews. They are recorded with the annotation so the AI can implement the corresponding source-code changes.
193
-
194
- You can also drag supported elements to propose a new position, and use Cmd/Ctrl+C and Cmd/Ctrl+V in Handle mode to duplicate supported page structures as visual guidance.
195
-
196
- ### Edit text inline
197
-
198
- Select Text and hover page copy. Recognized text elements receive a bounding box. Click to edit the actual visible text in place, then finish the edit to retain it as a pending change.
199
-
200
- Clicking outside editable page copy still creates a free-positioned text annotation.
201
-
202
- ### Draw visual guidance
203
-
204
- Rectangle, Oval, Line, and Pen annotations are useful when the desired result is easier to show than describe. Add labels where useful, then submit them with the rest of the page context.
205
-
206
- ### Work across routes
207
-
208
- Pass `navigate` to `PopmeltProvider` to enable route-aware annotations and multi-page capture. Annotation and status badges appear only on their relevant routes. When a handoff includes multiple routes, Popmelt captures each route and sends them together.
209
-
210
- ## AI providers and models
211
-
212
- Popmelt detects supported AI CLIs available in the project environment. Click the provider icon to switch providers. Click the model name, or hover the provider controls, to choose among detected models.
213
-
214
- When supported by the selected model, the model guidance panel also exposes:
215
-
216
- - Thinking or reasoning effort
217
- - Standard or faster service tiers
218
-
219
- These settings persist per provider and model and apply to annotations, replies, and model work.
220
-
221
- ## Threads and job status
222
-
223
- Each handoff creates or continues a conversation thread. Status badges stay available while work is queued or running and return you to the associated element and conversation.
224
-
225
- Use Cancel in the thread to stop the active job associated with that conversation. Closing a thread does not delete it. Delete its annotation to remove that thread, or use Cmd/Ctrl+Backspace to clear all local annotations and pending preview changes.
226
-
227
- ## Decisions and the project model
228
-
229
- Completed annotation threads leave a decision history in the project. Popmelt uses that evidence to identify reusable design patterns rather than treating every edit as an isolated instruction.
230
-
231
- When Popmelt finds a model opportunity, it places the proposal in the relevant annotation thread. Expand the proposal to inspect the exact changes, select only the entries you agree with, and apply or dismiss them. Applied changes contribute to the local project model.
232
-
233
- Use the Model panel to inspect captured patterns and components or to synthesize model guidance from accumulated project history.
173
+ Popmelt is designed for local development. As with any AI-assisted coding, your agent may edit files or run commands, so review its work, use version control, and run your project tests before you ship.
234
174
 
235
175
  ## Useful shortcuts
236
176
 
237
- | Shortcut | Action |
238
- | ------------------------- | --------------------------------------------------------------- |
239
- | Double-tap Cmd/Ctrl | Open or collapse Popmelt |
240
- | Cmd/Ctrl+Enter | Hand off pending work |
241
- | Cmd/Ctrl+C | Copy an annotated screenshot, or copy an element in Handle mode |
242
- | Cmd/Ctrl+V | Paste a copied element in Handle mode |
243
- | Cmd/Ctrl+Z | Undo a pending change |
244
- | Cmd/Ctrl+Shift+Z | Redo a pending change |
245
- | Backspace/Delete | Delete the selected annotation |
246
- | Cmd/Ctrl+Backspace/Delete | Clear all annotations and pending changes |
247
- | Escape | Cancel the active edit or deselect the current annotation |
177
+ | Shortcut | Action |
178
+ | -------------------------------- | --------------------------------------------------------- |
179
+ | Double-tap Command or Control | Open or collapse Popmelt |
180
+ | `C` | Enter Comment mode |
181
+ | `I` | Enter Imprint mode |
182
+ | Command/Control+Enter | Send pending work |
183
+ | Command/Control+Z | Undo a pending change |
184
+ | Command/Control+Shift+Z | Redo a pending change |
185
+ | Backspace/Delete | Delete the selected annotation |
186
+ | Command/Control+Backspace/Delete | Clear all annotations and pending changes |
187
+ | Escape | Cancel the active edit or deselect the current annotation |
248
188
 
249
- ## Advanced setup
189
+ ## Bridge commands
250
190
 
251
191
  Run a bridge without wrapping another command:
252
192
 
@@ -254,38 +194,16 @@ Run a bridge without wrapping another command:
254
194
  npx @popmelt.com/core bridge
255
195
  ```
256
196
 
257
- Stop a detached bridge for the current project:
197
+ Stop the bridge for the current project:
258
198
 
259
199
  ```bash
260
200
  npx @popmelt.com/core stop
261
201
  ```
262
202
 
263
- Start a configured bridge in server code:
264
-
265
- ```ts
266
- await startPopmelt({
267
- port: 1111,
268
- projectRoot: '.',
269
- devOrigin: 'http://localhost:3000',
270
- provider: 'codex',
271
- timeoutMs: undefined,
272
- });
273
- ```
274
-
275
- `startPopmelt()` returns the selected port, the stable project ID, and a `close()` function.
276
-
277
- ## Local project data
278
-
279
- Popmelt writes project history under `.popmelt/`. Keep this directory when you want decisions, threads, and the local model to survive across sessions. The browser also uses local storage for unsent annotations and preview edits.
280
-
281
203
  ## License
282
204
 
283
205
  [PolyForm Shield 1.0.0](./LICENSE)
284
206
 
285
207
  You may use and extend Popmelt for yourself and your team. You may not sell it, offer it as a managed service, or use the code to create a competing product or service. The software is provided as-is.
286
208
 
287
- For custom licensing, contact [reb@popmelt.com](mailto:reb@popmelt.com).
288
-
289
- <p align="center">
290
- <img src="src/assets/popmelt-logo.svg" alt="Popmelt" width="64" />
291
- </p>
209
+ For custom licensing, contact **reb@popmelt.com**.