@myop/cli 0.1.53 → 0.1.55

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.
@@ -127,6 +127,71 @@ npx myop dev # Start dev server at localhost:9292
127
127
  # Edit index.html → changes reflect instantly
128
128
  ```
129
129
 
130
+ ## AI Local Development Workflow
131
+
132
+ When developing or refactoring components with an AI assistant, use the **local dev loop** — not MCP uploads. This gives you instant feedback without cloud round-trips, extensions, or publishing.
133
+
134
+ ### The loop
135
+
136
+ ```
137
+ Edit index.html → myop dev serves it (HMR) → Host app loads from localhost:9292 → Test in browser
138
+ ```
139
+
140
+ ### How to set it up
141
+
142
+ 1. **Start the dev server** in the component directory:
143
+ ```bash
144
+ npx myop dev # Single component
145
+ npx myop dev -m # Multiple components (monorepo)
146
+ ```
147
+
148
+ 2. **Point the host app to localhost** (one line in the app's init code):
149
+ ```tsx
150
+ import { enableLocalDev } from "@myop/react"; // or @myop/vue, @myop/angular
151
+ enableLocalDev();
152
+ ```
153
+ This redirects all component fetches from `cloud.myop.dev` to `localhost:9292`. Components registered on the dev server are served locally; everything else is proxied to cloud.
154
+
155
+ 3. **Edit the component HTML file directly** — `myop dev` picks up changes via file watching and HMR. The host app reflects updates instantly. No upload needed.
156
+
157
+ 4. **If Chrome MCP is available**, navigate to the host app on localhost to visually test the component. Take screenshots to verify layout, then iterate.
158
+
159
+ 5. **Push only when done**:
160
+ ```bash
161
+ npx myop push
162
+ ```
163
+
164
+ ### Adding a new component to local dev (monorepo)
165
+
166
+ When you need to use a component locally that isn't already in the dev directory (e.g. after pulling a new component, or when integrating a remote component into a host app), you must register it so `myop dev -m` can serve it:
167
+
168
+ 1. **Pull into its own subdirectory** — never pull to the root of the components directory:
169
+ ```bash
170
+ mkdir <component-name>
171
+ cd <component-name>
172
+ npx myop pull <componentId>
173
+ ```
174
+ This creates `index.html` and `myop.config.json` inside the subdirectory.
175
+
176
+ 2. **Add to `.myop-monorepo.json`** — the monorepo config at the root of the components directory lists which components the dev server should serve. Add the new component's directory name to `selectedComponents`:
177
+ ```json
178
+ {
179
+ "selectedComponents": [
180
+ "existingComponent",
181
+ "<component-name>"
182
+ ]
183
+ }
184
+ ```
185
+ The directory name must match the subdirectory you created. If `.myop-monorepo.json` doesn't exist yet, create it.
186
+
187
+ 3. **Restart `myop dev -m`** if it's already running — the dev server picks up the new component on startup.
188
+
189
+ **Important:** The components directory path varies per project — there is no fixed location. Look for the directory that contains `.myop-monorepo.json` or multiple subdirectories with `myop.config.json` files.
190
+
191
+ ### Key rule
192
+
193
+ **Do NOT use MCP `upload_component` during local development.** Edit the HTML file on disk and let `myop dev` serve it. MCP upload is for deploying the finished component — not for the edit/test loop.
194
+
130
195
  ## Myop MCP Tools (Fallback)
131
196
 
132
197
  If the Myop MCP server is configured in your IDE, you also have access to MCP tools:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myop/cli",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "description": "Myop cli",
5
5
  "type": "module",
6
6
  "repository": {