@myop/cli 0.1.45 → 0.1.47
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/dist/myop-cli.js +1461 -1207
- package/dist/skills/myop-angular-host/SKILL.md +437 -0
- package/dist/skills/myop-cli/SKILL.md +147 -0
- package/dist/skills/myop-component/SKILL.md +112 -42
- package/dist/skills/myop-component/references/dev-workflow.md +74 -8
- package/dist/skills/myop-react-host/SKILL.md +407 -0
- package/dist/skills/myop-react-host/references/auto-generated-packages.md +70 -0
- package/dist/skills/myop-react-native-host/SKILL.md +438 -0
- package/dist/skills/myop-vue-host/SKILL.md +374 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: myop-component
|
|
3
|
-
description: "Myop is a platform for
|
|
3
|
+
description: "Myop is a platform for building isolated, independently deployable UI components that integrate into any host application. Components can be built with any framework or architecture — vanilla JS, React, Vue, Svelte, or any toolchain — and are deployed as a single entry point. This skill covers the component public API (myop_init_interface, myop_cta_handler), type definitions, sizing, layout, development workflow, and CLI commands. When building or modifying a Myop component, you must learn this skill."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Myop Component Developer
|
|
7
7
|
|
|
8
|
-
Build
|
|
8
|
+
Build isolated, independently deployable UI components for the Myop platform.
|
|
9
9
|
|
|
10
10
|
## Immediate Action Required - Read This First
|
|
11
11
|
|
|
12
|
-
This skill activates when a `myop.config.json` file exists in the project, or when the user mentions "myop", "myop component", or asks to create/edit
|
|
12
|
+
This skill activates when a `myop.config.json` file exists in the project, or when the user mentions "myop", "myop component", or asks to create/edit a component for Myop.
|
|
13
13
|
|
|
14
14
|
**Your first action MUST be:**
|
|
15
15
|
1. Check if `myop.config.json` exists in the current directory
|
|
@@ -18,24 +18,30 @@ This skill activates when a `myop.config.json` file exists in the project, or wh
|
|
|
18
18
|
- Read `index.html` to understand the current component implementation
|
|
19
19
|
- Implement the requested changes following the patterns in this skill
|
|
20
20
|
3. If **NO** (new component):
|
|
21
|
-
- Guide the user to run `myop create` to scaffold a new component
|
|
21
|
+
- Guide the user to run `npx myop create` to scaffold a new component
|
|
22
22
|
- Or create the files manually following the structure below
|
|
23
23
|
|
|
24
24
|
## Component Architecture
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
A Myop component is an **isolated, independently deployable UI module** that runs within any host application (React, Vue, Angular, React Native, or any web framework). Components can be as complex as needed — built with any internal architecture, framework, or toolchain (vanilla JS, React, Vue, Svelte, Web Components, etc.).
|
|
27
|
+
|
|
28
|
+
The platform communicates with every component through exactly **2 global functions**:
|
|
27
29
|
|
|
28
30
|
| Function | Direction | Purpose | Reference |
|
|
29
31
|
|----------|-----------|---------|-----------|
|
|
30
32
|
| `myop_init_interface(data)` | Host -> Component | Receive data, render UI | [component-api.md](references/component-api.md) |
|
|
31
33
|
| `myop_cta_handler(action, payload)` | Component -> Host | Send user actions back | [component-api.md](references/component-api.md) |
|
|
32
34
|
|
|
35
|
+
### Deployment Format
|
|
36
|
+
|
|
37
|
+
The deployed artifact is a **single entry point** — currently an HTML file (`index.html` or `dist/index.html`) with all code, styles, and markup bundled. For multi-file projects, a build step (`npm run build`) compiles your source into this entry point. The internal complexity is unlimited: use modules, state management, third-party libraries, or any architecture you need.
|
|
38
|
+
|
|
33
39
|
## CRITICAL: Rules You Must Follow
|
|
34
40
|
|
|
35
41
|
1. **Both functions MUST be defined at top-level script execution** - never inside `setTimeout`, `Promise.then`, `async`, `DOMContentLoaded`, or any deferred code
|
|
36
42
|
2. **Rendering MUST be synchronous** - no `fetch`, no `await`, no `setTimeout` inside `myop_init_interface`
|
|
37
43
|
3. **All state is private** - use an IIFE to encapsulate; only expose the 2 global functions
|
|
38
|
-
4. **Single
|
|
44
|
+
4. **Single entry point** - the deployed artifact is one HTML file with all CSS/JS inlined (a build step compiles multi-file projects into this)
|
|
39
45
|
5. **No external network requests** - components cannot fetch external resources at runtime
|
|
40
46
|
|
|
41
47
|
## Quick Start - Minimal Component
|
|
@@ -132,29 +138,29 @@ Every Myop component is a **single HTML file** (`index.html` or `dist/index.html
|
|
|
132
138
|
|
|
133
139
|
## Component File Structure
|
|
134
140
|
|
|
135
|
-
### Single-file mode (simplest)
|
|
141
|
+
### Single-file mode (simplest — good for small components)
|
|
136
142
|
```
|
|
137
143
|
project/
|
|
138
|
-
├── index.html #
|
|
144
|
+
├── index.html # Complete component in one file
|
|
139
145
|
├── myop.config.json # Component metadata
|
|
140
146
|
└── .gitignore
|
|
141
147
|
```
|
|
142
148
|
|
|
143
|
-
### Multi-file mode (with build step)
|
|
149
|
+
### Multi-file mode (with build step — for complex components)
|
|
144
150
|
```
|
|
145
151
|
project/
|
|
146
152
|
├── index.html # HTML template with <link> and <script src>
|
|
147
|
-
├── src/
|
|
153
|
+
├── src/ # Any internal architecture you need
|
|
148
154
|
│ ├── index.js # Entry point
|
|
149
|
-
│ ├── modules/
|
|
150
|
-
│ │ ├── app.js
|
|
155
|
+
│ ├── modules/ # Business logic, state management, etc.
|
|
156
|
+
│ │ ├── app.js
|
|
151
157
|
│ │ └── myop.js # Myop interface setup
|
|
152
158
|
│ └── styles/
|
|
153
|
-
│ ├── index.css
|
|
154
|
-
│ └── main.css
|
|
155
|
-
├── build.js #
|
|
159
|
+
│ ├── index.css
|
|
160
|
+
│ └── main.css
|
|
161
|
+
├── build.js # Bundler (compiles everything into dist/index.html)
|
|
156
162
|
├── dist/
|
|
157
|
-
│ └── index.html # Built
|
|
163
|
+
│ └── index.html # Built entry point (deployed artifact)
|
|
158
164
|
├── myop.config.json
|
|
159
165
|
├── package.json
|
|
160
166
|
└── .gitignore
|
|
@@ -212,43 +218,48 @@ project/
|
|
|
212
218
|
| Mutating data passed to `myop_init_interface` | Storing a copy of the data |
|
|
213
219
|
| Not returning state when called without args | `if (!data) return state;` pattern |
|
|
214
220
|
|
|
221
|
+
## CLI — Package Name is `myop`
|
|
222
|
+
|
|
223
|
+
The npm package is **`myop`**. Always use `npx myop <command>`. **NEVER** `npx @anthropic/myop`, `npx @myop/cli`, or any other scope — the package is simply **`myop`**.
|
|
224
|
+
|
|
215
225
|
## CLI Commands Quick Reference
|
|
216
226
|
|
|
217
227
|
| Command | Description |
|
|
218
228
|
|---------|-------------|
|
|
219
|
-
| `myop create` | Create a new component (scaffolds files + starts dev server) |
|
|
220
|
-
| `myop dev` | Start development server with HMR on port 9292 |
|
|
221
|
-
| `myop push` | Upload component to Myop platform |
|
|
222
|
-
| `myop
|
|
223
|
-
| `myop
|
|
224
|
-
| `myop
|
|
225
|
-
| `myop
|
|
229
|
+
| `npx myop create` | Create a new component (scaffolds files + starts dev server) |
|
|
230
|
+
| `npx myop dev` | Start development server with HMR on port 9292 |
|
|
231
|
+
| `npx myop push [componentId]` | Upload component to Myop platform (optional ID overrides config) |
|
|
232
|
+
| `npx myop pull [componentId]` | Download component HTML from Myop platform |
|
|
233
|
+
| `npx myop list [--org <orgId>]` | Browse, search, and batch pull/push remote components |
|
|
234
|
+
| `npx myop sync` | Build and upload component to Myop platform |
|
|
235
|
+
| `npx myop login` | Authenticate with Myop (opens browser) |
|
|
236
|
+
| `npx myop logout` | Clear stored credentials |
|
|
237
|
+
| `npx myop whoami` | Show current authenticated user |
|
|
226
238
|
|
|
227
239
|
## Deploying with `myop push`
|
|
228
240
|
|
|
229
|
-
`myop push` uploads the
|
|
241
|
+
`myop push` uploads the component to the Myop platform. After a successful push, the component is live — including all CTA wiring (e.g., `myop_cta_handler('button-clicked', …)`). No rebuild or redeploy of the host application is needed.
|
|
230
242
|
|
|
231
243
|
### What push does
|
|
232
244
|
|
|
233
245
|
1. Reads `myop.config.json` to identify the component
|
|
234
|
-
2.
|
|
235
|
-
3.
|
|
236
|
-
4.
|
|
237
|
-
5.
|
|
238
|
-
6. On
|
|
246
|
+
2. If a `componentId` argument is passed, it overrides the one in config
|
|
247
|
+
3. Locates the entry point (`index.html` for single-file mode, `dist/index.html` for multi-file)
|
|
248
|
+
4. Authenticates with Myop (prompts login if needed)
|
|
249
|
+
5. Uploads the component via a presigned URL
|
|
250
|
+
6. On first push: assigns a real `componentId` (UUID) and `organization` to `myop.config.json`
|
|
251
|
+
7. On subsequent pushes: adds a new version to the existing component
|
|
239
252
|
|
|
240
253
|
### Running push
|
|
241
254
|
|
|
242
255
|
From the component's project directory:
|
|
243
256
|
|
|
244
257
|
```bash
|
|
245
|
-
myop
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
Or using npx (no global install needed):
|
|
258
|
+
# Push using componentId from myop.config.json
|
|
259
|
+
npx myop push
|
|
249
260
|
|
|
250
|
-
|
|
251
|
-
npx
|
|
261
|
+
# Push to a specific remote component (overrides config)
|
|
262
|
+
npx myop push <componentId>
|
|
252
263
|
```
|
|
253
264
|
|
|
254
265
|
### When the user asks to push
|
|
@@ -256,7 +267,7 @@ npx @myop/cli push
|
|
|
256
267
|
When the user says **"push to myop"**, **"deploy"**, **"upload"**, or **"run the push"**, you should:
|
|
257
268
|
|
|
258
269
|
1. `cd` into the component's project directory (where `myop.config.json` lives)
|
|
259
|
-
2. Run `npx
|
|
270
|
+
2. Run `npx myop push`
|
|
260
271
|
3. If push succeeds, report the dashboard URL: `https://dashboard.myop.dev/dashboard/2.0/component/<componentId>`
|
|
261
272
|
4. If push fails, show the error output and suggest the user run the command manually
|
|
262
273
|
|
|
@@ -264,13 +275,72 @@ When the user says **"push to myop"**, **"deploy"**, **"upload"**, or **"run the
|
|
|
264
275
|
|
|
265
276
|
- **First push** — `componentId` in `myop.config.json` changes from `"DEV"` to a real UUID. The `organization` field is also added. The component now exists on the Myop platform.
|
|
266
277
|
- **Subsequent pushes** — A new version is added to the existing component. The previous version remains accessible. The latest version becomes the live version immediately.
|
|
267
|
-
- **What goes live** — The
|
|
268
|
-
- **Multi-file projects** — For projects with a build step, run `myop sync` instead (which runs `npm run build` first, then uploads
|
|
278
|
+
- **What goes live** — The complete component entry point is uploaded with all CTA handlers, type definitions, styles, and logic bundled. The host application picks up changes automatically on next load (no host redeploy).
|
|
279
|
+
- **Multi-file projects** — For projects with a build step, run `myop sync` instead (which runs `npm run build` first, then uploads the built entry point).
|
|
280
|
+
|
|
281
|
+
## Downloading with `myop pull`
|
|
282
|
+
|
|
283
|
+
`myop pull` downloads a component's latest version from the Myop platform into your local directory.
|
|
284
|
+
|
|
285
|
+
### Running pull
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Pull using componentId from myop.config.json
|
|
289
|
+
npx myop pull
|
|
290
|
+
|
|
291
|
+
# Pull a specific component by ID (works in empty directories)
|
|
292
|
+
npx myop pull <componentId>
|
|
293
|
+
|
|
294
|
+
# Pull to a custom output path
|
|
295
|
+
npx myop pull <componentId> -o ./components/sidebar/index.html
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### When the user asks to pull
|
|
299
|
+
|
|
300
|
+
When the user says **"pull from myop"**, **"download component"**, or **"get the latest version"**, you should:
|
|
301
|
+
|
|
302
|
+
1. `cd` into the component's project directory (or an empty directory for a new clone)
|
|
303
|
+
2. Run `npx myop pull` (or `npx myop pull <componentId>` if pulling a specific component)
|
|
304
|
+
3. Report the saved file path and size
|
|
305
|
+
|
|
306
|
+
### Pull behavior
|
|
307
|
+
|
|
308
|
+
- **Existing directory** — overwrites the entry point (`index.html` or `dist/index.html`) with the latest remote version
|
|
309
|
+
- **Empty directory** — creates `index.html` + `myop.config.json` with component metadata
|
|
310
|
+
- **Custom output** — use `-o <path>` to write to a specific file; parent directories are created automatically
|
|
311
|
+
|
|
312
|
+
## Browsing with `myop list`
|
|
313
|
+
|
|
314
|
+
`myop list` lets you browse all components in your organization — search, filter, select multiple, and batch pull or push them.
|
|
315
|
+
|
|
316
|
+
### Running list
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Interactive browse (prompts for org if multiple)
|
|
320
|
+
npx myop list
|
|
321
|
+
|
|
322
|
+
# Specify an organization
|
|
323
|
+
npx myop list --org <orgId>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### When the user asks to list or browse
|
|
327
|
+
|
|
328
|
+
When the user says **"show my components"**, **"list components"**, **"browse"**, or **"clone all components"**, you should:
|
|
329
|
+
|
|
330
|
+
1. Run `npx myop list`
|
|
331
|
+
2. The interactive UI handles org selection, search, and batch operations
|
|
332
|
+
|
|
333
|
+
### List behavior
|
|
334
|
+
|
|
335
|
+
- **Organization memory** — the selected org is saved to `~/.myop/preferences.json` and reused next time
|
|
336
|
+
- **Search** — type to filter components by name, select with enter, repeat across searches
|
|
337
|
+
- **Batch pull** — downloads all selected components in parallel, each into its own subdirectory with `index.html` + `myop.config.json`
|
|
338
|
+
- **Batch push** — scans local directories for matching `componentId`s and uploads them in parallel
|
|
269
339
|
|
|
270
340
|
## Workflow Summary
|
|
271
341
|
|
|
272
|
-
1. `myop create`
|
|
273
|
-
2.
|
|
274
|
-
3. `myop dev`
|
|
275
|
-
4. `myop push`
|
|
342
|
+
1. `npx myop create` — Scaffold a new component
|
|
343
|
+
2. Build your component — edit source files (single-file or multi-file with any framework)
|
|
344
|
+
3. `npx myop dev` — Preview with hot reload at http://localhost:9292
|
|
345
|
+
4. `npx myop push` — Deploy to Myop platform (live immediately)
|
|
276
346
|
5. View on dashboard: `https://dashboard.myop.dev/dashboard/2.0/component/<componentId>`
|
|
@@ -14,10 +14,11 @@ The Myop CLI provides commands for creating, developing, and deploying component
|
|
|
14
14
|
## CLI Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install -g
|
|
17
|
+
npm install -g myop
|
|
18
|
+
# Or use without installing: npx myop <command>
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
The npm package name is `myop`.
|
|
21
22
|
|
|
22
23
|
## Commands Reference
|
|
23
24
|
|
|
@@ -25,7 +26,9 @@ After installation, the `myop` command is available globally.
|
|
|
25
26
|
|---------|-------------|
|
|
26
27
|
| `myop create` | Create a new component (interactive, starts dev server after) |
|
|
27
28
|
| `myop dev` | Start dev server with file watching and HMR |
|
|
28
|
-
| `myop push` | Upload component to Myop platform |
|
|
29
|
+
| `myop push [componentId]` | Upload component to Myop platform |
|
|
30
|
+
| `myop pull [componentId]` | Download component HTML from Myop platform |
|
|
31
|
+
| `myop list [--org <orgId>]` | Browse, search, and batch pull/push remote components |
|
|
29
32
|
| `myop sync` | Build and upload component to Myop platform |
|
|
30
33
|
| `myop login` | Authenticate with Myop (opens browser for OAuth) |
|
|
31
34
|
| `myop logout` | Clear stored credentials |
|
|
@@ -110,16 +113,21 @@ The dev server detects changes and triggers builds automatically:
|
|
|
110
113
|
Uploads the component directly to the Myop platform (no build step).
|
|
111
114
|
|
|
112
115
|
```bash
|
|
116
|
+
# Push using componentId from myop.config.json
|
|
113
117
|
myop push
|
|
118
|
+
|
|
119
|
+
# Push to a specific remote component (overrides myop.config.json)
|
|
120
|
+
myop push <componentId>
|
|
114
121
|
```
|
|
115
122
|
|
|
116
123
|
**What it does:**
|
|
117
124
|
1. Reads `myop.config.json`
|
|
118
|
-
2.
|
|
119
|
-
3.
|
|
120
|
-
4.
|
|
121
|
-
5.
|
|
122
|
-
6.
|
|
125
|
+
2. If a `componentId` argument is passed, it overrides the one in config
|
|
126
|
+
3. Finds the HTML file to upload (`index.html` in root for single-file mode, or `dist/index.html`)
|
|
127
|
+
4. Authenticates (prompts for login if needed)
|
|
128
|
+
5. Uploads HTML to Myop via presigned URL
|
|
129
|
+
6. Confirms upload
|
|
130
|
+
7. Updates `myop.config.json` with `componentId` (first push only)
|
|
123
131
|
|
|
124
132
|
**After first push:**
|
|
125
133
|
- `myop.config.json` gets a real `componentId` (UUID)
|
|
@@ -131,6 +139,64 @@ myop push
|
|
|
131
139
|
https://dashboard.myop.dev/dashboard/2.0/component/<componentId>
|
|
132
140
|
```
|
|
133
141
|
|
|
142
|
+
## Pull Command
|
|
143
|
+
|
|
144
|
+
Downloads a component's HTML from the Myop platform.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Pull using componentId from myop.config.json
|
|
148
|
+
myop pull
|
|
149
|
+
|
|
150
|
+
# Pull a specific component by ID
|
|
151
|
+
myop pull <componentId>
|
|
152
|
+
|
|
153
|
+
# Pull to a specific output path
|
|
154
|
+
myop pull <componentId> -o ./my-component/index.html
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**What it does:**
|
|
158
|
+
1. Determines `componentId` from the argument or `myop.config.json`
|
|
159
|
+
2. Authenticates (prompts for login if needed)
|
|
160
|
+
3. Fetches the component HTML from Myop
|
|
161
|
+
4. Writes the HTML to `index.html` (or `dist/index.html` if it exists, or `-o` path)
|
|
162
|
+
5. Creates or updates `myop.config.json` with the component metadata
|
|
163
|
+
|
|
164
|
+
**Use cases:**
|
|
165
|
+
- **Clone a remote component locally** — `myop pull <componentId>` in an empty directory creates `index.html` + `myop.config.json`
|
|
166
|
+
- **Sync latest version** — run `myop pull` in an existing component directory to get the latest remote version
|
|
167
|
+
- **Download to custom path** — use `-o` flag to specify where the HTML file should be saved
|
|
168
|
+
|
|
169
|
+
## List Command
|
|
170
|
+
|
|
171
|
+
Browse all components in your organization, search and filter, select multiple, then batch pull or push.
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Interactive browse (prompts for org if needed)
|
|
175
|
+
myop list
|
|
176
|
+
|
|
177
|
+
# Use a specific organization
|
|
178
|
+
myop list --org <orgId>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**What it does:**
|
|
182
|
+
1. Authenticates and loads your organizations
|
|
183
|
+
2. Resolves which org to use (saved default, `--org` flag, or prompts)
|
|
184
|
+
3. Fetches all components in the organization
|
|
185
|
+
4. Shows a searchable list — type to filter, enter to select, repeat
|
|
186
|
+
5. When done selecting, choose Pull or Push
|
|
187
|
+
6. **Pull** — downloads all selected components in parallel, each into its own subdirectory with `index.html` + `myop.config.json`
|
|
188
|
+
7. **Push** — scans local directories for matching `componentId`s and uploads them in parallel
|
|
189
|
+
|
|
190
|
+
**Batch pull example** (great for cloning an environment):
|
|
191
|
+
```bash
|
|
192
|
+
mkdir my-components && cd my-components
|
|
193
|
+
myop list
|
|
194
|
+
# Select components, choose Pull
|
|
195
|
+
# Each component gets its own subdirectory
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Organization memory** — the selected org is saved to `~/.myop/preferences.json` so you don't have to pick it every time.
|
|
199
|
+
|
|
134
200
|
## Sync Command
|
|
135
201
|
|
|
136
202
|
Builds and uploads the component to the Myop platform (for multi-file projects with a build step).
|