@devmotion/cli 0.0.1
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 +195 -0
- package/dist/index.js +1002 -0
- package/package.json +59 -0
- package/scripts/postinstall.mjs +60 -0
- package/templates/bare.html +9 -0
- package/templates/default.html +27 -0
- package/templates/gsap.html +24 -0
- package/templates/lottie.html +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# @devmotion/cli
|
|
2
|
+
|
|
3
|
+
HTML-first, agent-friendly video tooling. **Write HTML. Render video.**
|
|
4
|
+
|
|
5
|
+
DevMotion turns a directory of HTML files into an animated MP4. Every element
|
|
6
|
+
with `data-dm-*` attributes becomes a layer on the timeline. The Studio
|
|
7
|
+
(visual editor) and the CLI render share the exact same engine — what you see
|
|
8
|
+
in preview is what you get in the MP4.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx @devmotion/cli init my-video
|
|
12
|
+
cd my-video
|
|
13
|
+
devmotion preview # open the editor in your browser
|
|
14
|
+
devmotion render # produce ./output.mp4
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm i -g @devmotion/cli
|
|
23
|
+
# or use it without installing
|
|
24
|
+
npx @devmotion/cli <command>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Requirements
|
|
28
|
+
|
|
29
|
+
Only **Node.js ≥ 20**. Everything else (ffmpeg, Playwright Chromium) is
|
|
30
|
+
installed automatically:
|
|
31
|
+
|
|
32
|
+
- `@ffmpeg-installer/ffmpeg` ships a platform-specific ffmpeg binary as a
|
|
33
|
+
regular dependency — no `brew`, `apt`, or `winget` needed.
|
|
34
|
+
- A `postinstall` script downloads Playwright Chromium (~150 MB, one-time).
|
|
35
|
+
Skip it with `DEVMOTION_SKIP_POSTINSTALL=1` if you don't intend to render
|
|
36
|
+
(preview still works).
|
|
37
|
+
|
|
38
|
+
Run `devmotion doctor` to verify both are wired up.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
| Command | Purpose |
|
|
45
|
+
| ----------------------------------- | ---------------------------------------------------------- |
|
|
46
|
+
| `devmotion init <name>` | Scaffold a new project (`devmotion.json` + `scenes/`) |
|
|
47
|
+
| `devmotion preview [--port 5173]` | Open the Studio in the browser, hot-reloads on file change |
|
|
48
|
+
| `devmotion render [--output X.mp4]` | Render to MP4 (auto-spawns Studio if not running) |
|
|
49
|
+
| `devmotion add-scene <name>` | Append a new scene, `--with gsap`/`lottie`/`bare` |
|
|
50
|
+
| `devmotion mcp [--port 5173]` | Print MCP server URL for Claude / Cursor / Windsurf |
|
|
51
|
+
| `devmotion doctor` | Check ffmpeg & Playwright are installed |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Project shape
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
my-video/
|
|
59
|
+
├── devmotion.json # project config (size, fps, scenes)
|
|
60
|
+
├── scenes/
|
|
61
|
+
│ ├── intro.html # one HTML file per scene
|
|
62
|
+
│ └── outro.html
|
|
63
|
+
└── assets/ # images, videos, fonts, lottie JSON
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `devmotion.json`
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"version": 1,
|
|
71
|
+
"name": "my-video",
|
|
72
|
+
"width": 1920,
|
|
73
|
+
"height": 1080,
|
|
74
|
+
"fps": 30,
|
|
75
|
+
"duration": 10,
|
|
76
|
+
"background": { "type": "solid", "color": "#0a0a0a" },
|
|
77
|
+
"scenes": [{ "id": "intro", "file": "scenes/intro.html", "start": 0, "duration": 10 }]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Scene HTML — `data-dm-*` protocol
|
|
82
|
+
|
|
83
|
+
Every element annotated with `data-dm-*` becomes a layer:
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<div
|
|
87
|
+
data-dm-id="title"
|
|
88
|
+
data-dm-enter="fade-in"
|
|
89
|
+
data-dm-enter-time="0.5"
|
|
90
|
+
data-dm-duration="0.8"
|
|
91
|
+
data-dm-easing="ease-out"
|
|
92
|
+
data-dm-keyframe-opacity="0:0; 0.5:1; 9:1; 10:0"
|
|
93
|
+
style="color: white; font-size: 48px"
|
|
94
|
+
>
|
|
95
|
+
Hello DevMotion
|
|
96
|
+
</div>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
| Attribute | Description |
|
|
100
|
+
| -------------------- | -------------------------------------------- |
|
|
101
|
+
| `data-dm-id` | Unique layer id (referenced by mutations) |
|
|
102
|
+
| `data-dm-enter` | Entry preset (`fade-in`, `slide-in-left`…) |
|
|
103
|
+
| `data-dm-exit` | Exit preset |
|
|
104
|
+
| `data-dm-enter-time` | Start time (seconds) |
|
|
105
|
+
| `data-dm-exit-time` | End time (seconds) |
|
|
106
|
+
| `data-dm-duration` | Preset duration |
|
|
107
|
+
| `data-dm-easing` | Easing function |
|
|
108
|
+
| `data-dm-keyframe-*` | Per-property keyframes: `"t:value; t:value"` |
|
|
109
|
+
| `data-dm-track` | Timeline track (z-order) |
|
|
110
|
+
| `data-dm-locked` | Lock layer from edits |
|
|
111
|
+
| `data-dm-hidden` | Hide layer |
|
|
112
|
+
|
|
113
|
+
### Premium `<dm-*>` elements
|
|
114
|
+
|
|
115
|
+
For richer visuals, use the built-in custom elements:
|
|
116
|
+
`dm-phone`, `dm-laptop`, `dm-browser`, `dm-terminal`, `dm-captions`,
|
|
117
|
+
`dm-code`, `dm-video`, `dm-audio`, `dm-text`, `dm-image`, `dm-button`,
|
|
118
|
+
`dm-icon`, `dm-shape`, `dm-html`, `dm-mouse`, `dm-group`.
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<dm-phone
|
|
122
|
+
data-dm-id="demo"
|
|
123
|
+
data-dm-enter="slide-in-right"
|
|
124
|
+
data-dm-enter-time="1.5"
|
|
125
|
+
src="./assets/screen.mp4"
|
|
126
|
+
></dm-phone>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Animation framework support
|
|
132
|
+
|
|
133
|
+
Scenes can include `<script>` blocks driving GSAP, Lottie, or any custom
|
|
134
|
+
animation library. DevMotion auto-detects the library, pauses its internal
|
|
135
|
+
clock, and drives it frame-by-frame from the timeline.
|
|
136
|
+
|
|
137
|
+
| Framework | Detected via | How it's driven |
|
|
138
|
+
| ------------------ | ---------------------------- | -------------------------------------------- |
|
|
139
|
+
| GSAP | `window.gsap.globalTimeline` | `globalTimeline.seek(t, false)` |
|
|
140
|
+
| Lottie / bodymovin | `window.lottie` | `goToAndStop(t * 1000, false)` per animation |
|
|
141
|
+
|
|
142
|
+
Detection is automatic — your scene HTML stays idiomatic, no DevMotion hooks
|
|
143
|
+
or boilerplate. Multiple frameworks coexist on the same scene (e.g. GSAP for
|
|
144
|
+
layout + Lottie for a logo).
|
|
145
|
+
|
|
146
|
+
Scaffold a scene with a framework template:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
devmotion add-scene intro --with gsap # GSAP CDN + sample tween
|
|
150
|
+
devmotion add-scene logo --with lottie # bodymovin player + sample load
|
|
151
|
+
devmotion add-scene blank --with bare # empty body
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Need support for another framework? Adapters live in
|
|
155
|
+
[`src/lib/layers/components/HtmlLayer.svelte`](../../src/lib/layers/components/HtmlLayer.svelte)
|
|
156
|
+
(`FRAMEWORK_ADAPTERS`) — a new adapter is ~10 lines and applies to every
|
|
157
|
+
project automatically once shipped.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## MCP — let an agent edit your project
|
|
162
|
+
|
|
163
|
+
`devmotion preview` exposes an MCP server at `/mcp`. Agents (Claude Code,
|
|
164
|
+
Cursor, Windsurf, …) can connect to it to create/edit/remove layers,
|
|
165
|
+
configure the project, group layers, and apply animation presets — every
|
|
166
|
+
mutation writes back to your HTML files surgically (preserving formatting,
|
|
167
|
+
comments, and `<script>` blocks).
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
devmotion mcp # prints the JSON config snippet to paste into your agent
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The CLI MCP and the SaaS MCP share the same `mutations.ts` code path, so an
|
|
174
|
+
agent that knows how to drive one knows how to drive the other.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Two ways to use DevMotion
|
|
179
|
+
|
|
180
|
+
| | **CLI / OSS** (this package) | **SaaS** (devmotion.com) |
|
|
181
|
+
| ----------- | ------------------------------------------ | ------------------------ |
|
|
182
|
+
| Source | Local filesystem (`devmotion.json` + HTML) | Cloud database |
|
|
183
|
+
| Editor | `devmotion preview` (browser) | Hosted Studio |
|
|
184
|
+
| Render | Local ffmpeg + Playwright | Hosted GPU farm |
|
|
185
|
+
| Auth | None — all local | Account + plans |
|
|
186
|
+
| Agent (MCP) | Local HTTP at `:5173/mcp` | Remote HTTP |
|
|
187
|
+
|
|
188
|
+
The OSS path is meant for **agents, devs, CI pipelines, and offline work**.
|
|
189
|
+
The SaaS path is the same engine with managed infrastructure.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
Apache-2.0. See [`LICENSE`](../../LICENSE).
|