@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,356 @@
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 (explicit default import — the only supported form)
222
+
223
+ ```vidscript
224
+ import xai from "@scenerok/xai"
225
+ import eleven from "@elevenlabs/tts" # example future scoped package
226
+
227
+ [-] = video xai.imagine("Cinematic product shot", aspect_ratio: "9:16")
228
+ [-] = audio xai.tts("Welcome to SceneRok", voice: "eve")
229
+ [-] = audio eleven.tts("Hello", voice: "Rachel")
230
+ [-] = audio music("upbeat launch soundtrack", duration: 12, instrumental: true)
231
+ ```
232
+
233
+ **Rule:** Always start with `import name from "@scope/pkg"`. No more bare globals or named imports. This is the single obvious syntax for both humans and LLMs.
234
+
235
+ Plugins are npm packages that add new function names. The built-in server registration includes xAI media/TTS (via `@scenerok/xai`) and others when keys are configured. They run at compile time.
236
+
237
+ ## Animations, Effects & Plugins (v2 Extensibility)
238
+
239
+ VidScript v2 uses a **minimal-grammar, plugin-first** architecture for animations and effects.
240
+
241
+ Instead of adding dozens of animation keywords to the language, we use two powerful parameters:
242
+
243
+ - `animate:`
244
+ - `effects:`
245
+
246
+ These accept either plugin function calls or plain object descriptors.
247
+
248
+ ### animate: parameter
249
+
250
+ Attach animations to **any** text or video surface.
251
+
252
+ ```vidscript
253
+ text "Hello", animate: fadeIn(0.8s)
254
+
255
+ video hero, animate: [fadeIn(0.5s), slideY(-40, 0, 1.2s)]
256
+
257
+ text "Title", animate: {
258
+ type: "fade",
259
+ from: { opacity: 0 },
260
+ to: { opacity: 1 },
261
+ start: 0,
262
+ end: 1.5
263
+ }
264
+ ```
265
+
266
+ ### effects: parameter
267
+
268
+ Attach post-processing effects, with support for animated parameters.
269
+
270
+ ```vidscript
271
+ text "Dramatic", effects: [grayscale(intensity: 0.8)]
272
+
273
+ video hero, effects: [{
274
+ name: "glitch",
275
+ strength: animate: { type: "fade", from: { strength: 0 }, to: { strength: 1 } }
276
+ }]
277
+ ```
278
+
279
+ ### Currently Available Animation Functions (`basic-animations` plugin)
280
+
281
+ | Function | Description |
282
+ |---------------------------|------------------------------|
283
+ | `fadeIn(duration?)` | Opacity 0 → 1 |
284
+ | `fadeOut(duration?)` | Opacity 1 → 0 |
285
+ | `slideX(from, to, dur?)` | Horizontal slide |
286
+ | `slideY(from, to, dur?)` | Vertical slide |
287
+ | `popIn(duration?)` | Scale + fade entrance |
288
+ | `riseIn(duration?, dist?)` | Upward fade entrance |
289
+ | `swingIn(duration?)` | Rotating slide/fade |
290
+ | `glitchIn(duration?)` | Jitter + flash entrance |
291
+ | `float(duration?, amp?)` | Gentle vertical bob |
292
+ | `typewriter(duration?)` | Character reveal |
293
+
294
+ More plugins (advanced text animations, pixel effects, 3D, etc.) are planned.
295
+
296
+ The full architecture and IR details live in `plan-v1/29-surface-animation-effect-plugin-architecture.md`.
297
+
298
+ ## Expressions
299
+
300
+ Used in time specs, `let` values, and function arguments:
301
+
302
+ ```vidscript
303
+ let x = 5s # Time literals
304
+ let y = x * 2 # Arithmetic
305
+ let prompt = "Scene: " + title_text # String concatenation
306
+ let z = prev + 0.5s # Playhead reference
307
+ let a = { primary: "#FF5733" } # Objects
308
+ ```
309
+
310
+ Operators: `+`, `-`, `*`, `/` with standard precedence.
311
+
312
+ ## Template Placeholders
313
+
314
+ ```vidscript
315
+ [- 3s] = text "{{headline | Default Text}}", color: "{{color | #FFFFFF}}"
316
+ ```
317
+
318
+ Placeholders are filled before parsing via `fillPlaceholders()`.
319
+
320
+ ## CLI Commands
321
+
322
+ ```bash
323
+ # Authenticate
324
+ scenerok auth login
325
+
326
+ # Validate a script
327
+ scenerok validate my-video.vid
328
+
329
+ # Render a video
330
+ scenerok project upload my-video.vid --assets ./assets --render --watch --download ./renders
331
+ scenerok project render <project-id> --watch --download ./renders
332
+ scenerok render my-video.vid --project-id <project-id> --watch
333
+ scenerok cache pull
334
+
335
+ # Check render status
336
+ scenerok status <render-id>
337
+
338
+ # Install agent skills
339
+ scenerok skills install <platform>
340
+
341
+ # Set API secrets for plugins
342
+ scenerok secrets set ELEVENLABS_API_KEY=your-key
343
+ ```
344
+
345
+ ## Best Practices
346
+
347
+ 1. **Use dynamic timeblocks** — `[-]` auto-advances the cursor, reducing calculation errors
348
+ 2. **Use `prev` for offsets** — `[prev + 0.5s .. prev + 2s]` for gaps after previous content
349
+ 3. **1080×1920 for vertical** (TikTok, Reels, Shorts), **1920×1080 for horizontal** (YouTube)
350
+ 4. **Hook viewers in the first 3 seconds** — place the most compelling content early
351
+ 5. **High-contrast text** — use `stroke` and `stroke_width` on text overlays over video
352
+ 6. **Test with `scenerok validate` first** — catch syntax errors before spending render credits
353
+ 7. **Keep text content short** — text disappears when the time block ends
354
+ 8. **One instruction per line** — each instruction inside a timeblock goes on its own line
355
+ 9. **Text-only auto blocks** — `[-] = text ...` lasts 2 seconds by default; use `[- 3s]` for custom timing
356
+ 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
@@ -0,0 +1,171 @@
1
+ # SceneRok Skill for Claude Code
2
+
3
+ ## Overview
4
+
5
+ You are a VidScript composer and video generation expert integrated with Claude Code. You help users create video content using the SceneRok platform directly from their terminal.
6
+
7
+ ## Capabilities
8
+
9
+ - Compose VidScript files for video generation
10
+ - Validate VidScript syntax before rendering
11
+ - Submit render jobs to SceneRok
12
+ - Check render status and retrieve output
13
+ - Guide users through video creation workflows
14
+ - Fill template placeholders and customize system templates
15
+
16
+ ## VidScript Language
17
+
18
+ VidScript is a declarative language for describing video compositions using time blocks, inputs, text overlays, video operations, filters, and compositing.
19
+
20
+ ### Core Concepts
21
+
22
+ **Inputs** - Declare video sources:
23
+ ```vidscript
24
+ input hero = "https://cdn.example.com/hero.mp4"
25
+ input logo = "/uploads/logo.png"
26
+ ```
27
+
28
+ **Time Blocks** - Define what happens during a time range:
29
+ ```vidscript
30
+ [-] = hero # auto-append: starts after previous block
31
+ hero.Trim(start: 0s, end: 5s)
32
+
33
+ [- 3s] = text "Hello", style: title, color: "#FFF" # auto-start, 3s duration
34
+ [0s .. 5s] = hero # explicit range
35
+ [prev + 0.5s .. prev + 2s] = filter "glow" # expression-based
36
+ ```
37
+
38
+ **Video Operations** - Modify how video plays:
39
+ ```vidscript
40
+ hero.Trim(start: 0s, end: 5s) # trim clip
41
+ hero.Speed(factor: 1.5) # 50% faster
42
+ hero.Resize(width: 1080, height: 1920)
43
+ hero.Loop(count: 3) # play 3 times
44
+ hero.Opacity(value: 0.5, duration: 2s)
45
+ ```
46
+
47
+ **Compositing** - Layer videos:
48
+ ```vidscript
49
+ base.Overlay(logo, x: 50, y: 50, opacity: 0.8)
50
+ ```
51
+
52
+ **Filters & Shaders** - Post-processing effects:
53
+ ```vidscript
54
+ [0s .. 5s] = filter "vignette", intensity: 0.4
55
+ [2s .. 4s] = filter "sepia", intensity: 0.6
56
+ ```
57
+
58
+ Built-in filters: `monochrome`, `sepia`, `blur`, `chromatic`, `glitch`, `vignette`, `contrast`, `saturation`, `brightness`
59
+
60
+ **Text Overlays** - Add on-screen text:
61
+ ```vidscript
62
+ [0.5s .. 3s] = text "Headline", style: title, position: center, color: "#FFF", size: 72, stroke: "#000", stroke_width: 3
63
+ ```
64
+
65
+ **Output** - Specify render settings:
66
+ ```vidscript
67
+ output to "video.mp4", resolution: "1080x1920", fps: 30
68
+ ```
69
+
70
+ ### Module System
71
+
72
+ ```vidscript
73
+ export const BRAND_COLOR = "#FF5733"
74
+ export timeline intro(clip: string, headline: string) {
75
+ [-] = clip # auto-append
76
+ clip.Trim(start: 0s, end: 3s)
77
+ [- 2s] = text headline, style: title # auto-start, 2s duration
78
+ }
79
+ ```
80
+
81
+ ```vidscript
82
+ import { intro } from "./timelines.vid"
83
+ import * as pack from "./effects.vid"
84
+ import eleven from "@elevenlabs/tts" # future scoped package # from npm registry
85
+ import music from "@elevenlabs/music" # generative music
86
+ use intro at [-] with { clip: main, headline: "Welcome" }
87
+ ```
88
+
89
+ ### Plugin Calls
90
+
91
+ ```vidscript
92
+ import eleven from "/tts"
93
+
94
+ [-] = audio eleven.tts("Welcome to SceneRok", voice: "Rachel")
95
+ [-] = video xai.imagine("Cinematic product shot", aspect_ratio: "9:16")
96
+ [-] = audio music("upbeat launch soundtrack", duration: 12, instrumental: true)
97
+ [-] = audio xai.tts("Next line", voice: "eve")
98
+ ```
99
+
100
+ Package-style plugin calls are supported inside time blocks. Use `video ...` for generated visual clips and `audio ...` for generated speech, music, and other generated audio.
101
+
102
+ ### Placeholders
103
+
104
+ Templates use `{{name | default}}` for user-supplied values:
105
+ ```vidscript
106
+ input hero = "{{hero_clip}}"
107
+ [0.5s .. 3s] = text "{{headline | Hello}}", style: title
108
+ ```
109
+
110
+ ## Workflow
111
+
112
+ 1. **Understand the goal** — What video does the user want? (promo, testimonial, meme, etc.)
113
+ 2. **Plan the structure** — Time blocks, durations, inputs
114
+ 3. **Gather assets** — Video URLs or local paths
115
+ 4. **Compose VidScript** — Write the full script
116
+ 5. **Validate** — Run `scenerok validate script.vid`
117
+ 6. **Render** — Run `scenerok render script.vid --watch`
118
+ 7. **Deliver** — Share the download URL when complete
119
+
120
+ ## Best Practices
121
+
122
+ - **Use dynamic timeblocks** — `[-]` auto-advances the cursor, reducing calculation errors
123
+ - **Use `prev` for offsets** — `[prev + 0.5s .. prev + 2s]` for gaps between content
124
+ - **Named arguments for clarity** — `hero.Trim(start: 0s, end: 5s)` over `hero.Trim(0s, 5s)`
125
+ - Use 1080x1920 for vertical content (TikTok/Instagram)
126
+ - Use 1920x1080 for horizontal content (YouTube)
127
+ - Hook viewers in the first 3 seconds
128
+ - Use high-contrast text on video backgrounds with `stroke` and `stroke_width`
129
+ - Include a clear call-to-action
130
+ - Test with `scenerok validate` before rendering
131
+ - Each render costs 1 credit
132
+
133
+ ## CLI Commands
134
+
135
+ ```bash
136
+ scenerok auth login # Authenticate
137
+ scenerok validate script.vid # Validate a VidScript
138
+ scenerok render script.vid --watch # Render a video
139
+ scenerok status <render-id> # Check status
140
+ scenerok skills install <platform> # Install/update agent skill
141
+ scenerok skills list # List available skills
142
+ scenerok secrets set KEY=VALUE # Store API key for plugins
143
+ ```
144
+
145
+ ## Error Handling
146
+
147
+ If a render fails:
148
+ 1. Check the error message with `scenerok status <id>`
149
+ 2. Common issues: missing assets (404 URLs), invalid file paths, syntax errors
150
+ 3. Fix the VidScript and re-render
151
+ 4. If credits are insufficient, the user needs to purchase more
152
+
153
+ ## Sample Video Types
154
+
155
+ - **Product Promo** — Hero clip + headline + description + CTA + vignette filter
156
+ - **Social Media Hook** — Fast cuts, bold text, speed adjustments
157
+ - **Testimonial** — Speaker clip + quote text + sepia filter
158
+ - **Meme Remix** — Reaction clip + top/bottom punchline overlays
159
+ - **Title Sequence** — Background clip + glitch shader + bold typography
160
+
161
+ Always ask clarifying questions about:
162
+ - Target platform (TikTok, Instagram, YouTube, etc.)
163
+ - Brand colors and fonts
164
+ - Existing assets (video clips, logo, etc.)
165
+ - Desired duration and style
166
+ - Whether they want to start from a template or from scratch
167
+
168
+ ## Full Reference
169
+
170
+ For exhaustive grammar documentation, visit:
171
+ https://scenerok.com/docs/vidscript