@scenerok/cli 1.0.0 → 1.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.
@@ -0,0 +1,355 @@
1
+ # VidScript Language Reference (v2)
2
+
3
+ VidScript is a declarative DSL for composing short-form videos. Write a script, render an MP4.
4
+
5
+ ## Program Structure
6
+
7
+ A VidScript program is a sequence of statements separated by newlines.
8
+
9
+ ```vidscript
10
+ # Single-line comment
11
+ /* Multi-line
12
+ comment */
13
+ ```
14
+
15
+ ## Statements
16
+
17
+ ### Input Declaration
18
+
19
+ ```vidscript
20
+ input hero = "https://cdn.example.com/hero.mp4"
21
+ input logo = "./assets/logo.png"
22
+ ```
23
+
24
+ Supports HTTP(S) URLs, `/uploads/` paths, and local paths.
25
+
26
+ ### Output Declaration
27
+
28
+ ```vidscript
29
+ output to "video.mp4", resolution: "1080x1920", fps: 30
30
+ output to "reel.mp4", resolution: "720x1280", format: "mp4", codec: "h264", bitrate: "5M", background: "#0D0D0D"
31
+ ```
32
+
33
+ | Option | Type | Default | Description |
34
+ |--------|------|---------|-------------|
35
+ | `resolution` | string | `"1080x1920"` | Width×Height or single number |
36
+ | `fps` | number | `30` | Frames per second |
37
+ | `format` | string | `"mp4"` | Container format |
38
+ | `codec` | string | `"h264"` | Video codec |
39
+ | `bitrate` | string | `"5M"` | Encoding bitrate |
40
+ | `background` | string | `"#000000"` | Background color hex |
41
+
42
+ ### Variable Assignment
43
+
44
+ ```vidscript
45
+ let brandColor = "#6366F1"
46
+ let fadeTime = 0.5s
47
+ let titleSize = 72
48
+ let clipName = "hero"
49
+ ```
50
+
51
+ Variables can hold strings, numbers, time literals, and object expressions. Variables are evaluated at compile time.
52
+
53
+ ### Import / Export (Module System)
54
+
55
+ ```vidscript
56
+ # Export a constant
57
+ export const BRAND_COLOR = "#FF5733"
58
+
59
+ # Export a timeline
60
+ export timeline intro(clip: string, title_text: string) {
61
+ [-] = clip
62
+ [- 2s] = text title_text, size: 72
63
+ }
64
+
65
+ # Import from another file
66
+ import { intro, BRAND_COLOR } from "./timelines.vid"
67
+
68
+ # Import namespace
69
+ import * as transitions from "@scenerok/transitions"
70
+
71
+ # Use a timeline
72
+ use intro at 0s .. 5s with { clip: hero, title_text: "Hello" }
73
+ ```
74
+
75
+ ## Time Blocks
76
+
77
+ Time blocks are the core of VidScript. They define when instructions execute on the timeline.
78
+
79
+ ### Dynamic Playhead (recommended)
80
+
81
+ ```vidscript
82
+ [-] = hero # auto-append: starts after previous block
83
+ [- 3s] = text "Title", size: 72 # auto-start, last 3 seconds
84
+ [- 2.5s] = filter "glow", intensity: 0.8
85
+ ```
86
+
87
+ The playhead cursor (`prev`) tracks where the timeline is. Each `[-]` block advances the cursor by the block's content duration. `[- duration]` advances by an explicit duration.
88
+
89
+ ### Explicit Range
90
+
91
+ ```vidscript
92
+ [0s .. 5s] = hero # absolute range
93
+ [0.5s .. 3s] = text "Hello" # explicit times
94
+ [prev + 1s .. prev + 4s] = filter "glow" # expression-based
95
+ ```
96
+
97
+ Use `..` (not `-`) as the range separator to avoid ambiguity with subtraction.
98
+
99
+ ### Time Formats
100
+
101
+ ```vidscript
102
+ 5s # 5 seconds
103
+ 300ms # 300 milliseconds
104
+ frame 90 # 90 frames at 30fps = 3 seconds
105
+ 0:30 # 30 seconds
106
+ 1:30:00 # 1 hour 30 minutes
107
+ ```
108
+
109
+ ### The `prev` Keyword
110
+
111
+ `prev` refers to the current playhead position — the end time of the previous block.
112
+
113
+ ```vidscript
114
+ [- 2s] = text "Hello" # plays from cursor to cursor+2s
115
+ [prev + 1s .. prev + 3s] = filter "glow" # 1s after text ends, for 2s
116
+ ```
117
+
118
+ ## Instructions (inside time blocks)
119
+
120
+ Multiple instructions in the same time block go on separate lines:
121
+
122
+ ```vidscript
123
+ [0s .. 5s] = hero
124
+ hero.Trim(start: 0s, end: 5s)
125
+ hero.Speed(factor: 1.5)
126
+ ```
127
+
128
+ ### Clip Reference
129
+
130
+ ```vidscript
131
+ [-] = hero # just play the input clip
132
+ ```
133
+
134
+ ### Text Overlay
135
+
136
+ ```vidscript
137
+ [- 3s] = text "Hello World", font: "Bebas Neue", x: "50%", y: "45%", align: center, color: "#FFFFFF", size: 72, stroke: "#000000", stroke_width: 3, letter_spacing: 4, shadow_color: "#FF0055", shadow_blur: 8
138
+ ```
139
+
140
+ | Param | Type | Description |
141
+ |-------|------|-------------|
142
+ | `style` | string | `title` (64px), `subtitle` (54px), `caption` (36px), or `default` (48px) |
143
+ | `position` | string | `center`, `top`, `bottom`, `top-left`, `top-right`, `bottom-left`, `bottom-right` |
144
+ | `x` | number \| string | Horizontal position. Number = px from left. `"50%"` = percent of width. Overrides `position`. |
145
+ | `y` | number \| string | Vertical position. Number = px from top. `"50%"` = percent of height. Overrides `position`. |
146
+ | `color` | string | Hex color |
147
+ | `size` | number | Font size in pixels |
148
+ | `font` | string | Font family. System fonts or Google Fonts: `"Inter"`, `"Bebas Neue"`, `"Space Grotesk"`, `"Outfit"`, etc. |
149
+ | `align` | string | `left`, `center`, `right`. Default: `center` |
150
+ | `line_height` | number | Line height multiplier for multi-line text. Default: 1.2 |
151
+ | `letter_spacing` | number | Extra letter spacing in pixels. Default: 0 |
152
+ | `rotation` | number | Rotation in degrees. Positive = clockwise. Default: 0 |
153
+ | `opacity` | number | Opacity 0–1. Default: 1 |
154
+ | `stroke` | string | Outline color |
155
+ | `stroke_width` | number | Outline thickness |
156
+ | `shadow_color` | string | Drop shadow color |
157
+ | `shadow_blur` | number | Shadow blur radius |
158
+ | `shadow_offset_x` | number | Shadow horizontal offset |
159
+ | `shadow_offset_y` | number | Shadow vertical offset |
160
+ | `animation` | string | Parsed but not yet rendered |
161
+
162
+ Params are optional and comma-separated. Params can be on the same line as the content.
163
+
164
+ ### Video Methods
165
+
166
+ ```vidscript
167
+ hero.Trim(start: 0s, end: 5s) # trim clip (positional: hero.Trim(0s, 5s))
168
+ hero.Resize(width: 720, height: 1280) # resize (positional: hero.Resize(720, 1280))
169
+ hero.Speed(factor: 1.5) # playback rate
170
+ hero.Loop(count: 3) # loop count
171
+ hero.Opacity(value: 0.5, duration: 2s) # opacity with duration
172
+ ```
173
+
174
+ Arguments can be positional or named using `:`.
175
+
176
+ ### Compositing
177
+
178
+ ```vidscript
179
+ hero.Overlay(logo, x: 50, y: 100, opacity: 0.8)
180
+ hero.Composite(overlay, x: 0, y: 0, opacity: 0.5, mode: "screen")
181
+ ```
182
+
183
+ | Param | Type | Description |
184
+ |-------|------|-------------|
185
+ | `x` | number | Horizontal offset |
186
+ | `y` | number | Vertical offset |
187
+ | `opacity` | number | 0–1 transparency |
188
+ | `mode` | string | Blend mode for Composite |
189
+
190
+ ### Filters
191
+
192
+ ```vidscript
193
+ [- 2s] = filter "glow", intensity: 0.8
194
+ [0s .. 5s] = filter "vignette", intensity: 0.3
195
+ ```
196
+
197
+ Built-in filters: `monochrome`, `sepia`, `blur`, `chromatic`, `glitch`, `vignette`, `contrast`, `saturation`, `brightness`.
198
+
199
+ ### Shaders
200
+
201
+ ```vidscript
202
+ import shader glow from "shader-pack/glow.glsl"
203
+
204
+ [0s .. 5s] = shader glow, intensity: 0.8
205
+ ```
206
+
207
+ ### Audio
208
+
209
+ ```vidscript
210
+ audio music, volume: 0.5, fade_in: 1s, fade_out: 2s
211
+ ```
212
+
213
+ Audio sources can be MP3 inputs, audio plugin results, or the embedded audio stream from an input video. Video clips are visually silent unless you explicitly add `audio clip`.
214
+
215
+ | Param | Type | Description |
216
+ |-------|------|-------------|
217
+ | `volume` | number | 0–1 |
218
+ | `fade_in` | number | Fade-in duration (seconds) |
219
+ | `fade_out` | number | Fade-out duration (seconds) |
220
+
221
+ ### Plugin Calls
222
+
223
+ ```vidscript
224
+ import eleven from "@elevenlabs/tts" # future scoped package
225
+ import music from "@elevenlabs/music"
226
+
227
+ [-] = audio tts("Welcome to SceneRok", voice: "Rachel")
228
+ [-] = video xai.imagine("Cinematic product shot", aspect_ratio: "9:16")
229
+ [-] = audio music("upbeat launch soundtrack", duration: 12, instrumental: true)
230
+ [-] = audio xai.tts("Next line", voice: "eve")
231
+ [-] = tts("Next line")
232
+ ```
233
+
234
+ Plugins are npm packages that add new function names. The built-in server registration includes xAI media/TTS and ElevenLabs music when the matching API keys are configured. They run at compile time and their outputs are baked into the final video. Package-style calls such as `video xai.imagine(...)` and qualified calls such as `audio xai.tts(...)` are supported inside time blocks.
235
+
236
+ ## Animations, Effects & Plugins (v2 Extensibility)
237
+
238
+ VidScript v2 uses a **minimal-grammar, plugin-first** architecture for animations and effects.
239
+
240
+ Instead of adding dozens of animation keywords to the language, we use two powerful parameters:
241
+
242
+ - `animate:`
243
+ - `effects:`
244
+
245
+ These accept either plugin function calls or plain object descriptors.
246
+
247
+ ### animate: parameter
248
+
249
+ Attach animations to **any** text or video surface.
250
+
251
+ ```vidscript
252
+ text "Hello", animate: fadeIn(0.8s)
253
+
254
+ video hero, animate: [fadeIn(0.5s), slideY(-40, 0, 1.2s)]
255
+
256
+ text "Title", animate: {
257
+ type: "fade",
258
+ from: { opacity: 0 },
259
+ to: { opacity: 1 },
260
+ start: 0,
261
+ end: 1.5
262
+ }
263
+ ```
264
+
265
+ ### effects: parameter
266
+
267
+ Attach post-processing effects, with support for animated parameters.
268
+
269
+ ```vidscript
270
+ text "Dramatic", effects: [grayscale(intensity: 0.8)]
271
+
272
+ video hero, effects: [{
273
+ name: "glitch",
274
+ strength: animate: { type: "fade", from: { strength: 0 }, to: { strength: 1 } }
275
+ }]
276
+ ```
277
+
278
+ ### Currently Available Animation Functions (`basic-animations` plugin)
279
+
280
+ | Function | Description |
281
+ |---------------------------|------------------------------|
282
+ | `fadeIn(duration?)` | Opacity 0 → 1 |
283
+ | `fadeOut(duration?)` | Opacity 1 → 0 |
284
+ | `slideX(from, to, dur?)` | Horizontal slide |
285
+ | `slideY(from, to, dur?)` | Vertical slide |
286
+ | `popIn(duration?)` | Scale + fade entrance |
287
+ | `riseIn(duration?, dist?)` | Upward fade entrance |
288
+ | `swingIn(duration?)` | Rotating slide/fade |
289
+ | `glitchIn(duration?)` | Jitter + flash entrance |
290
+ | `float(duration?, amp?)` | Gentle vertical bob |
291
+ | `typewriter(duration?)` | Character reveal |
292
+
293
+ More plugins (advanced text animations, pixel effects, 3D, etc.) are planned.
294
+
295
+ The full architecture and IR details live in `plan-v1/29-surface-animation-effect-plugin-architecture.md`.
296
+
297
+ ## Expressions
298
+
299
+ Used in time specs, `let` values, and function arguments:
300
+
301
+ ```vidscript
302
+ let x = 5s # Time literals
303
+ let y = x * 2 # Arithmetic
304
+ let prompt = "Scene: " + title_text # String concatenation
305
+ let z = prev + 0.5s # Playhead reference
306
+ let a = { primary: "#FF5733" } # Objects
307
+ ```
308
+
309
+ Operators: `+`, `-`, `*`, `/` with standard precedence.
310
+
311
+ ## Template Placeholders
312
+
313
+ ```vidscript
314
+ [- 3s] = text "{{headline | Default Text}}", color: "{{color | #FFFFFF}}"
315
+ ```
316
+
317
+ Placeholders are filled before parsing via `fillPlaceholders()`.
318
+
319
+ ## CLI Commands
320
+
321
+ ```bash
322
+ # Authenticate
323
+ scenerok auth login
324
+
325
+ # Validate a script
326
+ scenerok validate my-video.vid
327
+
328
+ # Render a video
329
+ scenerok project upload my-video.vid --assets ./assets --render --watch --download ./renders
330
+ scenerok project render <project-id> --watch --download ./renders
331
+ scenerok render my-video.vid --project-id <project-id> --watch
332
+ scenerok cache pull
333
+
334
+ # Check render status
335
+ scenerok status <render-id>
336
+
337
+ # Install agent skills
338
+ scenerok skills install <platform>
339
+
340
+ # Set API secrets for plugins
341
+ scenerok secrets set ELEVENLABS_API_KEY=your-key
342
+ ```
343
+
344
+ ## Best Practices
345
+
346
+ 1. **Use dynamic timeblocks** — `[-]` auto-advances the cursor, reducing calculation errors
347
+ 2. **Use `prev` for offsets** — `[prev + 0.5s .. prev + 2s]` for gaps after previous content
348
+ 3. **1080×1920 for vertical** (TikTok, Reels, Shorts), **1920×1080 for horizontal** (YouTube)
349
+ 4. **Hook viewers in the first 3 seconds** — place the most compelling content early
350
+ 5. **High-contrast text** — use `stroke` and `stroke_width` on text overlays over video
351
+ 6. **Test with `scenerok validate` first** — catch syntax errors before spending render credits
352
+ 7. **Keep text content short** — text disappears when the time block ends
353
+ 8. **One instruction per line** — each instruction inside a timeblock goes on its own line
354
+ 9. **Text-only auto blocks** — `[-] = text ...` lasts 2 seconds by default; use `[- 3s]` for custom timing
355
+ 10. **Named arguments are clearer** — `hero.Trim(start: 0s, end: 5s)` over `hero.Trim(0s, 5s)`
@@ -0,0 +1,21 @@
1
+ # VidScript v2 Sample — Product Launch Promo
2
+ # A 6-second vertical video for TikTok / Instagram Reels
3
+ # Demonstrates dynamic timeblocks, video shorthand, named args, expressions, and filters
4
+
5
+ input hero = "{{hero_clip}}"
6
+
7
+ # Auto-append: cursor starts at 0, each [-] advances automatically
8
+ [-] = video hero
9
+ hero.Trim(start: 0s, end: 6s)
10
+
11
+ # Text overlays with comma-separated named params
12
+ [0.3s .. 2.3s] = text "NEW DROP", style: title, position: top, color: "#FFFFFF", size: 64, stroke: "#000000", stroke_width: 3
13
+
14
+ [2.5s .. 4.5s] = text "The most anticipated release of the season", style: caption, position: center, color: "#F3F4F6", size: 36, stroke: "#000000", stroke_width: 2
15
+
16
+ [4.5s .. 5.8s] = text "SHOP NOW", style: title, position: bottom, color: "#F59E0B", size: 52, stroke: "#000000", stroke_width: 3
17
+
18
+ # Filter applied from start to end of the clip
19
+ [0s .. 6s] = filter "vignette", intensity: 0.35
20
+
21
+ output to "product-launch.mp4", resolution: "1080x1920", fps: 30