videowright 0.1.0
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 +91 -0
- package/dist/cli/argv.d.ts +28 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +115 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/bin.d.ts +7 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +10 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/dev.d.ts +19 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/dev.js +104 -0
- package/dist/cli/dev.js.map +1 -0
- package/dist/cli/discover.d.ts +29 -0
- package/dist/cli/discover.d.ts.map +1 -0
- package/dist/cli/discover.js +104 -0
- package/dist/cli/discover.js.map +1 -0
- package/dist/cli/discover_project.d.ts +29 -0
- package/dist/cli/discover_project.d.ts.map +1 -0
- package/dist/cli/discover_project.js +108 -0
- package/dist/cli/discover_project.js.map +1 -0
- package/dist/cli/errors.d.ts +10 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +13 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/ffmpeg.d.ts +57 -0
- package/dist/cli/ffmpeg.d.ts.map +1 -0
- package/dist/cli/ffmpeg.js +122 -0
- package/dist/cli/ffmpeg.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +152 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/playwright_check.d.ts +44 -0
- package/dist/cli/playwright_check.d.ts.map +1 -0
- package/dist/cli/playwright_check.js +20 -0
- package/dist/cli/playwright_check.js.map +1 -0
- package/dist/cli/prompt.d.ts +13 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +47 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/render.d.ts +60 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +471 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/script_cmd.d.ts +26 -0
- package/dist/cli/script_cmd.d.ts.map +1 -0
- package/dist/cli/script_cmd.js +88 -0
- package/dist/cli/script_cmd.js.map +1 -0
- package/dist/cli/time_shim.d.ts +44 -0
- package/dist/cli/time_shim.d.ts.map +1 -0
- package/dist/cli/time_shim.js +390 -0
- package/dist/cli/time_shim.js.map +1 -0
- package/dist/cli/ts_loader.d.ts +28 -0
- package/dist/cli/ts_loader.d.ts.map +1 -0
- package/dist/cli/ts_loader.js +95 -0
- package/dist/cli/ts_loader.js.map +1 -0
- package/dist/cli/vite_helpers.d.ts +62 -0
- package/dist/cli/vite_helpers.d.ts.map +1 -0
- package/dist/cli/vite_helpers.js +273 -0
- package/dist/cli/vite_helpers.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/player/hash_router.d.ts +23 -0
- package/dist/player/hash_router.d.ts.map +1 -0
- package/dist/player/hash_router.js +49 -0
- package/dist/player/hash_router.js.map +1 -0
- package/dist/player/hud.d.ts +33 -0
- package/dist/player/hud.d.ts.map +1 -0
- package/dist/player/hud.js +357 -0
- package/dist/player/hud.js.map +1 -0
- package/dist/player/index.d.ts +123 -0
- package/dist/player/index.d.ts.map +1 -0
- package/dist/player/index.js +848 -0
- package/dist/player/index.js.map +1 -0
- package/dist/player/input.d.ts +14 -0
- package/dist/player/input.d.ts.map +1 -0
- package/dist/player/input.js +90 -0
- package/dist/player/input.js.map +1 -0
- package/dist/player/slot.d.ts +22 -0
- package/dist/player/slot.d.ts.map +1 -0
- package/dist/player/slot.js +43 -0
- package/dist/player/slot.js.map +1 -0
- package/dist/player/transitions/cut.d.ts +7 -0
- package/dist/player/transitions/cut.d.ts.map +1 -0
- package/dist/player/transitions/cut.js +9 -0
- package/dist/player/transitions/cut.js.map +1 -0
- package/dist/player/transitions/fade.d.ts +7 -0
- package/dist/player/transitions/fade.d.ts.map +1 -0
- package/dist/player/transitions/fade.js +18 -0
- package/dist/player/transitions/fade.js.map +1 -0
- package/dist/player/transitions/index.d.ts +4 -0
- package/dist/player/transitions/index.d.ts.map +1 -0
- package/dist/player/transitions/index.js +4 -0
- package/dist/player/transitions/index.js.map +1 -0
- package/dist/player/transitions/slide.d.ts +6 -0
- package/dist/player/transitions/slide.d.ts.map +1 -0
- package/dist/player/transitions/slide.js +35 -0
- package/dist/player/transitions/slide.js.map +1 -0
- package/dist/script/index.d.ts +2 -0
- package/dist/script/index.d.ts.map +1 -0
- package/dist/script/index.js +2 -0
- package/dist/script/index.js.map +1 -0
- package/dist/script/script.d.ts +10 -0
- package/dist/script/script.d.ts.map +1 -0
- package/dist/script/script.js +41 -0
- package/dist/script/script.js.map +1 -0
- package/dist/segment/SegmentRunner.d.ts +52 -0
- package/dist/segment/SegmentRunner.d.ts.map +1 -0
- package/dist/segment/SegmentRunner.js +187 -0
- package/dist/segment/SegmentRunner.js.map +1 -0
- package/dist/segment/defineConfig.d.ts +6 -0
- package/dist/segment/defineConfig.d.ts.map +1 -0
- package/dist/segment/defineConfig.js +7 -0
- package/dist/segment/defineConfig.js.map +1 -0
- package/dist/segment/defineSegment.d.ts +7 -0
- package/dist/segment/defineSegment.d.ts.map +1 -0
- package/dist/segment/defineSegment.js +25 -0
- package/dist/segment/defineSegment.js.map +1 -0
- package/dist/segment/index.d.ts +5 -0
- package/dist/segment/index.d.ts.map +1 -0
- package/dist/segment/index.js +4 -0
- package/dist/segment/index.js.map +1 -0
- package/dist/timeline/index.d.ts +73 -0
- package/dist/timeline/index.d.ts.map +1 -0
- package/dist/timeline/index.js +142 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/loadAudioTrack.d.ts +18 -0
- package/dist/timeline/loadAudioTrack.d.ts.map +1 -0
- package/dist/timeline/loadAudioTrack.js +44 -0
- package/dist/timeline/loadAudioTrack.js.map +1 -0
- package/dist/timeline/loadVoiceover.d.ts +18 -0
- package/dist/timeline/loadVoiceover.d.ts.map +1 -0
- package/dist/timeline/loadVoiceover.js +38 -0
- package/dist/timeline/loadVoiceover.js.map +1 -0
- package/dist/timeline/resolveTiming.d.ts +28 -0
- package/dist/timeline/resolveTiming.d.ts.map +1 -0
- package/dist/timeline/resolveTiming.js +63 -0
- package/dist/timeline/resolveTiming.js.map +1 -0
- package/dist/timeline/validateTiming.d.ts +29 -0
- package/dist/timeline/validateTiming.d.ts.map +1 -0
- package/dist/timeline/validateTiming.js +62 -0
- package/dist/timeline/validateTiming.js.map +1 -0
- package/dist/types.d.ts +216 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
- package/skill/SKILL.md +64 -0
- package/skill/assets/hello_world/PLAN.md +31 -0
- package/skill/assets/hello_world/README.md +27 -0
- package/skill/assets/hello_world/audio/audio_plan.md +14 -0
- package/skill/assets/hello_world/segments/hello_intro.ts +69 -0
- package/skill/assets/hello_world/segments/hello_outro.ts +71 -0
- package/skill/assets/hello_world/timeline.ts +15 -0
- package/skill/assets/hello_world/voiceover_script/script.md +10 -0
- package/skill/assets/install/package.json +10 -0
- package/skill/assets/install/tsconfig.json +23 -0
- package/skill/assets/styles/editorial-mono/STYLE.md +124 -0
- package/skill/assets/styles/editorial-mono/brand.md +85 -0
- package/skill/assets/styles/editorial-mono/reference/animations.jsx +752 -0
- package/skill/assets/styles/editorial-mono/reference/scenes.html +563 -0
- package/skill/assets/styles/editorial-mono/sample/bullet.ts +101 -0
- package/skill/assets/styles/editorial-mono/sample/content.ts +104 -0
- package/skill/assets/styles/editorial-mono/sample/cta.ts +113 -0
- package/skill/assets/styles/editorial-mono/sample/feature.ts +111 -0
- package/skill/assets/styles/editorial-mono/sample/grid.ts +97 -0
- package/skill/assets/styles/editorial-mono/sample/kinetic.ts +96 -0
- package/skill/assets/styles/editorial-mono/sample/section.ts +101 -0
- package/skill/assets/styles/editorial-mono/sample/stat.ts +128 -0
- package/skill/assets/styles/editorial-mono/sample/title.ts +97 -0
- package/skill/assets/styles/editorial-mono/sample/ui-showcase.ts +159 -0
- package/skill/assets/styles/editorial-mono/tokens.css +44 -0
- package/skill/assets/styles/iso-diagram/STYLE.md +109 -0
- package/skill/assets/styles/iso-diagram/brand.md +32 -0
- package/skill/assets/styles/iso-diagram/reference/animations.jsx +673 -0
- package/skill/assets/styles/iso-diagram/reference/scenes.html +427 -0
- package/skill/assets/styles/iso-diagram/sample/bullet.ts +144 -0
- package/skill/assets/styles/iso-diagram/sample/content.ts +192 -0
- package/skill/assets/styles/iso-diagram/sample/cta.ts +162 -0
- package/skill/assets/styles/iso-diagram/sample/feature.ts +205 -0
- package/skill/assets/styles/iso-diagram/sample/grid.ts +181 -0
- package/skill/assets/styles/iso-diagram/sample/kinetic.ts +102 -0
- package/skill/assets/styles/iso-diagram/sample/section.ts +149 -0
- package/skill/assets/styles/iso-diagram/sample/stat.ts +164 -0
- package/skill/assets/styles/iso-diagram/sample/title.ts +173 -0
- package/skill/assets/styles/iso-diagram/sample/ui-showcase.ts +162 -0
- package/skill/assets/styles/iso-diagram/tokens.css +40 -0
- package/skill/assets/styles/motion-engineering/STYLE.md +106 -0
- package/skill/assets/styles/motion-engineering/brand.md +29 -0
- package/skill/assets/styles/motion-engineering/reference/animations.jsx +673 -0
- package/skill/assets/styles/motion-engineering/reference/scenes.html +513 -0
- package/skill/assets/styles/motion-engineering/sample/bullet.ts +176 -0
- package/skill/assets/styles/motion-engineering/sample/content.ts +228 -0
- package/skill/assets/styles/motion-engineering/sample/cta.ts +209 -0
- package/skill/assets/styles/motion-engineering/sample/feature.ts +299 -0
- package/skill/assets/styles/motion-engineering/sample/grid.ts +190 -0
- package/skill/assets/styles/motion-engineering/sample/kinetic.ts +159 -0
- package/skill/assets/styles/motion-engineering/sample/section.ts +196 -0
- package/skill/assets/styles/motion-engineering/sample/stat.ts +230 -0
- package/skill/assets/styles/motion-engineering/sample/title.ts +219 -0
- package/skill/assets/styles/motion-engineering/sample/ui-showcase.ts +267 -0
- package/skill/assets/styles/motion-engineering/tokens.css +40 -0
- package/skill/assets/styles/neon-terminal/STYLE.md +105 -0
- package/skill/assets/styles/neon-terminal/brand.md +27 -0
- package/skill/assets/styles/neon-terminal/reference/animations.jsx +673 -0
- package/skill/assets/styles/neon-terminal/reference/scenes.html +387 -0
- package/skill/assets/styles/neon-terminal/sample/bullet.ts +113 -0
- package/skill/assets/styles/neon-terminal/sample/content.ts +117 -0
- package/skill/assets/styles/neon-terminal/sample/cta.ts +131 -0
- package/skill/assets/styles/neon-terminal/sample/feature.ts +112 -0
- package/skill/assets/styles/neon-terminal/sample/grid.ts +128 -0
- package/skill/assets/styles/neon-terminal/sample/kinetic.ts +105 -0
- package/skill/assets/styles/neon-terminal/sample/section.ts +96 -0
- package/skill/assets/styles/neon-terminal/sample/stat.ts +123 -0
- package/skill/assets/styles/neon-terminal/sample/title.ts +122 -0
- package/skill/assets/styles/neon-terminal/sample/ui-showcase.ts +127 -0
- package/skill/assets/styles/neon-terminal/tokens.css +39 -0
- package/skill/assets/styles/risograph/STYLE.md +110 -0
- package/skill/assets/styles/risograph/brand.md +26 -0
- package/skill/assets/styles/risograph/reference/animations.jsx +673 -0
- package/skill/assets/styles/risograph/reference/scenes.html +403 -0
- package/skill/assets/styles/risograph/sample/bullet.ts +124 -0
- package/skill/assets/styles/risograph/sample/content.ts +135 -0
- package/skill/assets/styles/risograph/sample/cta.ts +149 -0
- package/skill/assets/styles/risograph/sample/feature.ts +152 -0
- package/skill/assets/styles/risograph/sample/grid.ts +123 -0
- package/skill/assets/styles/risograph/sample/kinetic.ts +125 -0
- package/skill/assets/styles/risograph/sample/section.ts +130 -0
- package/skill/assets/styles/risograph/sample/stat.ts +145 -0
- package/skill/assets/styles/risograph/sample/title.ts +132 -0
- package/skill/assets/styles/risograph/sample/ui-showcase.ts +147 -0
- package/skill/assets/styles/risograph/tokens.css +39 -0
- package/skill/assets/styles/swiss-console/STYLE.md +107 -0
- package/skill/assets/styles/swiss-console/brand.md +37 -0
- package/skill/assets/styles/swiss-console/reference/animations.jsx +673 -0
- package/skill/assets/styles/swiss-console/reference/scenes.html +420 -0
- package/skill/assets/styles/swiss-console/sample/bullet.ts +122 -0
- package/skill/assets/styles/swiss-console/sample/content.ts +137 -0
- package/skill/assets/styles/swiss-console/sample/cta.ts +109 -0
- package/skill/assets/styles/swiss-console/sample/feature.ts +163 -0
- package/skill/assets/styles/swiss-console/sample/grid.ts +145 -0
- package/skill/assets/styles/swiss-console/sample/kinetic.ts +117 -0
- package/skill/assets/styles/swiss-console/sample/section.ts +127 -0
- package/skill/assets/styles/swiss-console/sample/stat.ts +148 -0
- package/skill/assets/styles/swiss-console/sample/title.ts +148 -0
- package/skill/assets/styles/swiss-console/sample/ui-showcase.ts +198 -0
- package/skill/assets/styles/swiss-console/tokens.css +39 -0
- package/skill/install/INSTALL.md +400 -0
- package/skill/references/audio/audio_plan.md +199 -0
- package/skill/references/audio/build.md +208 -0
- package/skill/references/audio/cue_template.md +219 -0
- package/skill/references/audio/ffmpeg_cookbook.md +267 -0
- package/skill/references/audio/music/music.md +171 -0
- package/skill/references/audio/music/providers/elevenlabs.md +170 -0
- package/skill/references/audio/music/providers/manual.md +140 -0
- package/skill/references/audio/music/providers/openverse.md +265 -0
- package/skill/references/audio/sfx/providers/elevenlabs.md +152 -0
- package/skill/references/audio/sfx/providers/manual.md +117 -0
- package/skill/references/audio/sfx/providers/openverse.md +243 -0
- package/skill/references/audio/sfx/sfx.md +149 -0
- package/skill/references/audio/styles.md +102 -0
- package/skill/references/audio/sync.md +237 -0
- package/skill/references/audio/voiceover/animation_sync.md +142 -0
- package/skill/references/audio/voiceover/provider_script.md +153 -0
- package/skill/references/audio/voiceover/providers/elevenlabs.md +288 -0
- package/skill/references/audio/voiceover/providers/manual.md +100 -0
- package/skill/references/audio/voiceover/script_writing.md +100 -0
- package/skill/references/audio/voiceover/style_intake.md +56 -0
- package/skill/references/audio/voiceover/sync_algorithm.md +167 -0
- package/skill/references/audio/voiceover.md +296 -0
- package/skill/references/audio.md +135 -0
- package/skill/references/authoring_segment.md +446 -0
- package/skill/references/create_or_edit_video.md +232 -0
- package/skill/references/dev_server.md +157 -0
- package/skill/references/export.md +145 -0
- package/skill/references/new_video.md +117 -0
- package/skill/references/project_structure.md +144 -0
- package/skill/references/setup.md +109 -0
- package/skill/references/setup_new_style.md +158 -0
- package/skill/references/styles.md +154 -0
- package/skill/references/testing.md +115 -0
- package/skill/references/types.md +240 -0
- package/src/cli/entry/components/copy_button.ts +42 -0
- package/src/cli/entry/components/download_modal.ts +204 -0
- package/src/cli/entry/components/empty_state.ts +55 -0
- package/src/cli/entry/components/hide_hud_tab.ts +37 -0
- package/src/cli/entry/components/icons.ts +31 -0
- package/src/cli/entry/components/top_bar.ts +69 -0
- package/src/cli/entry/components/video_card.ts +57 -0
- package/src/cli/entry/dev_frame.ts +189 -0
- package/src/cli/entry/entry_index.ts +16 -0
- package/src/cli/entry/entry_video.ts +24 -0
- package/src/cli/entry/index.html +12 -0
- package/src/cli/entry/parse_slug.ts +14 -0
- package/src/cli/entry/render.html +17 -0
- package/src/cli/entry/render_entry.ts +121 -0
- package/src/cli/entry/styles/base.css +45 -0
- package/src/cli/entry/styles/components.css +605 -0
- package/src/cli/entry/styles/tokens.css +44 -0
- package/src/cli/entry/video.html +22 -0
- package/src/cli/entry/views/homepage.ts +66 -0
- package/src/cli/entry/views/video_view.ts +286 -0
- package/src/cli/entry/virtual.d.ts +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Videowright
|
|
2
|
+
|
|
3
|
+
**Compose animated explainer videos using any web technology.**
|
|
4
|
+
|
|
5
|
+
Videowright is a small library and agent skill for vibe-coding animated videos in HTML/CSS/JS. Inside each segment, use whatever the browser supports -- Three.js, Lottie, animated SVG, GSAP, React, CSS keyframes, ECharts, raw canvas. Videowright handles sequencing, transitions, and playback.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install videowright
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
Videowright is designed to work with a coding agent. Add the skill reference to your `.claude/CLAUDE.md`:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Read `node_modules/videowright/skill/SKILL.md` for the Videowright agent skill.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then ask Claude to create a video. The skill scaffolds a project, writes segments, and guides iteration.
|
|
22
|
+
|
|
23
|
+
### Manual usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { defineSegment } from 'videowright';
|
|
27
|
+
|
|
28
|
+
let host: HTMLElement | null = null;
|
|
29
|
+
|
|
30
|
+
export default defineSegment({
|
|
31
|
+
id: 'intro',
|
|
32
|
+
voiceover: 'Welcome to our product.',
|
|
33
|
+
|
|
34
|
+
mount(el, ctx) {
|
|
35
|
+
host = el;
|
|
36
|
+
el.innerHTML = '<h1 style="opacity:0">Hello</h1>';
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async play(ctx) {
|
|
40
|
+
host!.querySelector('h1')!.animate(
|
|
41
|
+
[{ opacity: 0 }, { opacity: 1 }],
|
|
42
|
+
{ duration: 500, fill: 'forwards' }
|
|
43
|
+
);
|
|
44
|
+
await ctx.hold(600);
|
|
45
|
+
await ctx.waitForNext();
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
unmount() {
|
|
49
|
+
host = null;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Preview with hot reload:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx videowright dev
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
| Export | Purpose |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `defineSegment(spec)` | Author a segment with beat tracking and abort signal |
|
|
65
|
+
| `defineConfig(config)` | Type-safe `videowright.config.ts` |
|
|
66
|
+
| `script(timeline, segmentLoaders)` | Concatenate voiceover text into a Markdown document (async) |
|
|
67
|
+
| `Player` | The player runtime |
|
|
68
|
+
| `fade`, `slideLeft`, `slideRight`, `slideUp`, `slideDown`, `cut` | Built-in transitions |
|
|
69
|
+
|
|
70
|
+
### Types
|
|
71
|
+
|
|
72
|
+
`Segment`, `SegmentSpec`, `PlayerContext`, `Timeline`, `TimelineEntry`, `TimelineMeta`, `Transition`, `TransitionContext`, `Config`
|
|
73
|
+
|
|
74
|
+
## CLI
|
|
75
|
+
|
|
76
|
+
| Command | Description |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `videowright dev [path]` | Open the player with hot reload |
|
|
79
|
+
| `videowright script [path]` | Print the concatenated voiceover script (`--write` to save) |
|
|
80
|
+
|
|
81
|
+
## Agent skill
|
|
82
|
+
|
|
83
|
+
The npm package includes a Claude Code skill at `skill/SKILL.md`. It teaches the agent to scaffold projects, author segments, maintain style guides, and iterate on videos conversationally.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
[MIT](../../LICENSE). All runtime dependencies are MIT, ISC, or BSD-3-Clause.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
Full documentation, architecture, and a 7-segment demo: [github.com/scosman/video_forge](https://github.com/scosman/video_forge)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal argv parser wrapping node:util parseArgs.
|
|
3
|
+
* Extracts the subcommand from argv[2], then parses remaining flags.
|
|
4
|
+
*/
|
|
5
|
+
export type Command = "dev" | "script" | "render" | "help" | "version";
|
|
6
|
+
export interface ParsedArgs {
|
|
7
|
+
command: Command;
|
|
8
|
+
positional?: string;
|
|
9
|
+
flags: {
|
|
10
|
+
port?: number;
|
|
11
|
+
write?: boolean;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
fps?: number;
|
|
16
|
+
output?: string;
|
|
17
|
+
audioTrack?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare class ArgvError extends Error {
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse process.argv (or a supplied argv array).
|
|
25
|
+
* Throws ArgvError on invalid input.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseArgv(argv?: string[]): ParsedArgs;
|
|
28
|
+
//# sourceMappingURL=argv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../../src/cli/argv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACF;AAWD,qBAAa,SAAU,SAAQ,KAAK;IAC1B,IAAI,SAAe;CAC5B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAgHrD"}
|
package/dist/cli/argv.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal argv parser wrapping node:util parseArgs.
|
|
3
|
+
* Extracts the subcommand from argv[2], then parses remaining flags.
|
|
4
|
+
*/
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
6
|
+
const KNOWN_COMMANDS = new Set(["dev", "script", "render"]);
|
|
7
|
+
/** Flags that only apply to the `render` command. Rejected on all other commands. */
|
|
8
|
+
const RENDER_ONLY_FLAGS = ["width", "height", "fps", "output"];
|
|
9
|
+
const RENDER_ONLY_COMMANDS = new Set(["render"]);
|
|
10
|
+
/** Flags that apply to render. */
|
|
11
|
+
const AUDIO_TRACK_COMMANDS = new Set(["render"]);
|
|
12
|
+
export class ArgvError extends Error {
|
|
13
|
+
name = "ArgvError";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse process.argv (or a supplied argv array).
|
|
17
|
+
* Throws ArgvError on invalid input.
|
|
18
|
+
*/
|
|
19
|
+
export function parseArgv(argv) {
|
|
20
|
+
const raw = argv ?? process.argv.slice(2);
|
|
21
|
+
// Handle --help and --version anywhere
|
|
22
|
+
if (raw.includes("--help")) {
|
|
23
|
+
return { command: "help", flags: {} };
|
|
24
|
+
}
|
|
25
|
+
if (raw.includes("--version")) {
|
|
26
|
+
return { command: "version", flags: {} };
|
|
27
|
+
}
|
|
28
|
+
const subcommand = raw[0];
|
|
29
|
+
if (!subcommand) {
|
|
30
|
+
return { command: "help", flags: {} };
|
|
31
|
+
}
|
|
32
|
+
if (!KNOWN_COMMANDS.has(subcommand)) {
|
|
33
|
+
throw new ArgvError(`Unknown command: ${subcommand}`);
|
|
34
|
+
}
|
|
35
|
+
const remaining = raw.slice(1);
|
|
36
|
+
const { values, positionals } = parseArgs({
|
|
37
|
+
args: remaining,
|
|
38
|
+
options: {
|
|
39
|
+
port: { type: "string" },
|
|
40
|
+
write: { type: "boolean", default: false },
|
|
41
|
+
verbose: { type: "boolean", default: false },
|
|
42
|
+
width: { type: "string" },
|
|
43
|
+
height: { type: "string" },
|
|
44
|
+
fps: { type: "string" },
|
|
45
|
+
output: { type: "string" },
|
|
46
|
+
"audio-track": { type: "string" },
|
|
47
|
+
},
|
|
48
|
+
allowPositionals: true,
|
|
49
|
+
strict: true,
|
|
50
|
+
});
|
|
51
|
+
if (positionals.length > 1) {
|
|
52
|
+
throw new ArgvError(`Too many positional arguments for "${subcommand}": expected at most 1, got ${positionals.length}`);
|
|
53
|
+
}
|
|
54
|
+
const portStr = values.port;
|
|
55
|
+
let port;
|
|
56
|
+
if (portStr !== undefined) {
|
|
57
|
+
port = Number.parseInt(portStr, 10);
|
|
58
|
+
if (Number.isNaN(port) || port < 1 || port > 65535) {
|
|
59
|
+
throw new ArgvError(`Invalid port: ${portStr}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const widthStr = values.width;
|
|
63
|
+
let width;
|
|
64
|
+
if (widthStr !== undefined) {
|
|
65
|
+
width = Number.parseInt(widthStr, 10);
|
|
66
|
+
if (Number.isNaN(width) || width < 1 || width !== Number(widthStr)) {
|
|
67
|
+
throw new ArgvError(`Invalid width: ${widthStr} (must be a positive integer)`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const heightStr = values.height;
|
|
71
|
+
let height;
|
|
72
|
+
if (heightStr !== undefined) {
|
|
73
|
+
height = Number.parseInt(heightStr, 10);
|
|
74
|
+
if (Number.isNaN(height) || height < 1 || height !== Number(heightStr)) {
|
|
75
|
+
throw new ArgvError(`Invalid height: ${heightStr} (must be a positive integer)`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const fpsStr = values.fps;
|
|
79
|
+
let fps;
|
|
80
|
+
if (fpsStr !== undefined) {
|
|
81
|
+
fps = Number.parseInt(fpsStr, 10);
|
|
82
|
+
if (Number.isNaN(fps) || fps < 1 || fps > 120) {
|
|
83
|
+
throw new ArgvError(`Invalid fps: ${fpsStr}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const command = subcommand;
|
|
87
|
+
// Reject render-only flags on commands that don't support them
|
|
88
|
+
if (!RENDER_ONLY_COMMANDS.has(command)) {
|
|
89
|
+
for (const flag of RENDER_ONLY_FLAGS) {
|
|
90
|
+
if (values[flag] !== undefined) {
|
|
91
|
+
throw new ArgvError(`--${flag} is only valid for the "render" command`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Reject --audio-track on commands that don't support it
|
|
96
|
+
const audioTrack = values["audio-track"];
|
|
97
|
+
if (audioTrack !== undefined && !AUDIO_TRACK_COMMANDS.has(command)) {
|
|
98
|
+
throw new ArgvError(`--audio-track is only valid for the "render" command`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
command,
|
|
102
|
+
positional: positionals[0],
|
|
103
|
+
flags: {
|
|
104
|
+
port,
|
|
105
|
+
write: values.write,
|
|
106
|
+
verbose: values.verbose,
|
|
107
|
+
width,
|
|
108
|
+
height,
|
|
109
|
+
fps,
|
|
110
|
+
output: values.output,
|
|
111
|
+
audioTrack,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=argv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../../src/cli/argv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAmBtC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpE,qFAAqF;AACrF,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AACxE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE1D,kCAAkC;AAClC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE1D,MAAM,OAAO,SAAU,SAAQ,KAAK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AC,OAAO,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,SAAS,CAAC,sDAAsD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO;QACN,OAAO;QACP,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;QAC1B,KAAK,EAAE;YACN,IAAI;YACJ,KAAK,EAAE,MAAM,CAAC,KAAgB;YAC9B,OAAO,EAAE,MAAM,CAAC,OAAkB;YAClC,KAAK;YACL,MAAM;YACN,GAAG;YACH,MAAM,EAAE,MAAM,CAAC,MAA4B;YAC3C,UAAU;SACV;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Binary entry point for the `videowright` CLI.
|
|
4
|
+
* Separated from index.ts so the module can be imported without auto-running.
|
|
5
|
+
*/
|
|
6
|
+
import { main } from "./index.js";
|
|
7
|
+
main().then((code) => {
|
|
8
|
+
process.exitCode = code;
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;IACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `videowright dev` — boot a Vite dev server for the whole project.
|
|
3
|
+
* Discovers all videos at boot and exposes them via a virtual module.
|
|
4
|
+
*/
|
|
5
|
+
export interface DevOptions {
|
|
6
|
+
cwd: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
verbose?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DevResult {
|
|
11
|
+
url: string;
|
|
12
|
+
close: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Run the dev server flow. Returns the running server info.
|
|
16
|
+
* Throws UserError on missing config.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runDev(opts: DevOptions): Promise<DevResult>;
|
|
19
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,WAAW,UAAU;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAiHjE"}
|
package/dist/cli/dev.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `videowright dev` — boot a Vite dev server for the whole project.
|
|
3
|
+
* Discovers all videos at boot and exposes them via a virtual module.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
import { findConfig } from "./discover.js";
|
|
8
|
+
import { discoverAllVideos } from "./discover_project.js";
|
|
9
|
+
import { UserError } from "./errors.js";
|
|
10
|
+
import { findPackageRoot, fullReloadPlugin, globalsVirtualModulePlugin, projectVirtualModulePlugin, segmentDiscoveryPlugin, videoRouteMiddlewarePlugin, } from "./vite_helpers.js";
|
|
11
|
+
/**
|
|
12
|
+
* Run the dev server flow. Returns the running server info.
|
|
13
|
+
* Throws UserError on missing config.
|
|
14
|
+
*/
|
|
15
|
+
export async function runDev(opts) {
|
|
16
|
+
const { cwd, port, verbose } = opts;
|
|
17
|
+
// Validate config exists (fast error before Vite boot)
|
|
18
|
+
const configPath = findConfig(cwd);
|
|
19
|
+
if (!configPath) {
|
|
20
|
+
throw new UserError(`No videowright.config.ts found at ${cwd}`, "The Videowright skill can scaffold one. Run setup first.");
|
|
21
|
+
}
|
|
22
|
+
if (verbose) {
|
|
23
|
+
console.log(`config: ${configPath}`);
|
|
24
|
+
}
|
|
25
|
+
const pkgRoot = findPackageRoot();
|
|
26
|
+
const entryDir = resolve(pkgRoot, "src/cli/entry");
|
|
27
|
+
if (!existsSync(resolve(entryDir, "index.html"))) {
|
|
28
|
+
throw new UserError("Internal entry HTML not found", "Reinstall videowright; this is a packaging bug.");
|
|
29
|
+
}
|
|
30
|
+
const serverPort = port ?? 5173;
|
|
31
|
+
// Discover all videos. Initial discovery uses plain import() since
|
|
32
|
+
// the Vite server isn't started yet. Reloads (triggered by file
|
|
33
|
+
// changes) use ssrLoadModule for reliable Vite-aware loading.
|
|
34
|
+
const projectInfo = await discoverAllVideos(cwd);
|
|
35
|
+
if (verbose) {
|
|
36
|
+
console.log(`videos discovered: ${projectInfo.videos.length}`);
|
|
37
|
+
for (const v of projectInfo.videos) {
|
|
38
|
+
console.log(` ${v.slug}: "${v.title}" (${v.style})${v.loadError ? ` [error: ${v.loadError}]` : ""}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Globals for the entry files. In multi-video mode, timelinePath is unused
|
|
42
|
+
// (video_view.ts reads per-video paths from ProjectInfo). It's still required
|
|
43
|
+
// by the VwGlobals interface because render_entry.ts uses it.
|
|
44
|
+
const globals = {
|
|
45
|
+
timelinePath: "",
|
|
46
|
+
consumerRoot: cwd,
|
|
47
|
+
};
|
|
48
|
+
// Mutable project info reference — the middleware reads the latest slugs
|
|
49
|
+
// each request so newly-added videos are immediately routable.
|
|
50
|
+
let currentProjectInfo = projectInfo;
|
|
51
|
+
const getKnownSlugs = () => currentProjectInfo.videos.map((v) => v.slug);
|
|
52
|
+
// We need a mutable reference to the server for the reload callback.
|
|
53
|
+
// The variable is assigned right after createServer returns, before any
|
|
54
|
+
// reload can fire.
|
|
55
|
+
let serverRef = null;
|
|
56
|
+
const { createServer } = await import("vite");
|
|
57
|
+
const server = await createServer({
|
|
58
|
+
configFile: false,
|
|
59
|
+
root: entryDir,
|
|
60
|
+
plugins: [
|
|
61
|
+
fullReloadPlugin(),
|
|
62
|
+
segmentDiscoveryPlugin(cwd),
|
|
63
|
+
globalsVirtualModulePlugin(globals),
|
|
64
|
+
videoRouteMiddlewarePlugin(getKnownSlugs),
|
|
65
|
+
projectVirtualModulePlugin(projectInfo, {
|
|
66
|
+
consumerRoot: cwd,
|
|
67
|
+
onReload: async () => {
|
|
68
|
+
const info = await discoverAllVideos(cwd, serverRef ?? undefined);
|
|
69
|
+
currentProjectInfo = info;
|
|
70
|
+
return info;
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
build: {
|
|
75
|
+
rollupOptions: {
|
|
76
|
+
input: {
|
|
77
|
+
index: join(entryDir, "index.html"),
|
|
78
|
+
video: join(entryDir, "video.html"),
|
|
79
|
+
render: join(entryDir, "render.html"),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
server: {
|
|
84
|
+
port: serverPort,
|
|
85
|
+
strictPort: false,
|
|
86
|
+
fs: {
|
|
87
|
+
allow: [cwd, pkgRoot],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
resolve: {
|
|
91
|
+
alias: {
|
|
92
|
+
"@consumer": cwd,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
serverRef = server;
|
|
97
|
+
await server.listen();
|
|
98
|
+
const address = server.resolvedUrls?.local?.[0] ?? `http://localhost:${serverPort}/`;
|
|
99
|
+
return {
|
|
100
|
+
url: address,
|
|
101
|
+
close: () => server.close(),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,GAC1B,MAAM,mBAAmB,CAAC;AAa3B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAgB;IAC5C,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEpC,uDAAuD;IACvD,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,IAAI,SAAS,CAClB,qCAAqC,GAAG,EAAE,EAC1C,0DAA0D,CAC1D,CAAC;IACH,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,WAAW,UAAU,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAEnD,IAAI,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,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config and timeline discovery for the CLI.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Look for videowright.config.ts at the given cwd.
|
|
6
|
+
* Returns the absolute path if found, null otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export declare function findConfig(cwd: string): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Discover all videos under <root>/videos/. Returns absolute timeline.ts paths.
|
|
11
|
+
* No sorting at this layer -- caller sorts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findAllTimelines(root: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a positional arg to a timeline path.
|
|
16
|
+
* - First tries it as a slug (videos/<arg>/timeline.ts exists).
|
|
17
|
+
* - Then tries it as a literal path (resolved relative to root).
|
|
18
|
+
* - Returns the absolute path if resolved, null if neither works.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveSlugOrPath(arg: string, root: string): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Find a timeline file.
|
|
23
|
+
* - If hint is provided, resolve relative to cwd. Returns absolute path if found.
|
|
24
|
+
* Throws UserError if the explicit path does not exist.
|
|
25
|
+
* - If no hint, scan cwd/videos/.../timeline.ts, sort by mtime desc, return the most recent.
|
|
26
|
+
* Returns null if no videos found (caller decides how to surface this).
|
|
27
|
+
*/
|
|
28
|
+
export declare function findTimeline(cwd: string, hint?: string): string | null;
|
|
29
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/cli/discover.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGrD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAyBvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc1E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoCtE"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config and timeline discovery for the CLI.
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
import { UserError } from "./errors.js";
|
|
7
|
+
/**
|
|
8
|
+
* Look for videowright.config.ts at the given cwd.
|
|
9
|
+
* Returns the absolute path if found, null otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export function findConfig(cwd) {
|
|
12
|
+
const configPath = join(cwd, "videowright.config.ts");
|
|
13
|
+
return existsSync(configPath) ? resolve(configPath) : null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Discover all videos under <root>/videos/. Returns absolute timeline.ts paths.
|
|
17
|
+
* No sorting at this layer -- caller sorts.
|
|
18
|
+
*/
|
|
19
|
+
export function findAllTimelines(root) {
|
|
20
|
+
const videosDir = join(root, "videos");
|
|
21
|
+
if (!existsSync(videosDir))
|
|
22
|
+
return [];
|
|
23
|
+
let entries;
|
|
24
|
+
try {
|
|
25
|
+
entries = readdirSync(videosDir);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const paths = [];
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
const entryPath = join(videosDir, entry);
|
|
33
|
+
try {
|
|
34
|
+
if (!statSync(entryPath).isDirectory())
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const timelinePath = join(entryPath, "timeline.ts");
|
|
41
|
+
if (existsSync(timelinePath)) {
|
|
42
|
+
paths.push(resolve(timelinePath));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return paths;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a positional arg to a timeline path.
|
|
49
|
+
* - First tries it as a slug (videos/<arg>/timeline.ts exists).
|
|
50
|
+
* - Then tries it as a literal path (resolved relative to root).
|
|
51
|
+
* - Returns the absolute path if resolved, null if neither works.
|
|
52
|
+
*/
|
|
53
|
+
export function resolveSlugOrPath(arg, root) {
|
|
54
|
+
// Try as slug first
|
|
55
|
+
const slugPath = join(root, "videos", arg, "timeline.ts");
|
|
56
|
+
if (existsSync(slugPath)) {
|
|
57
|
+
return resolve(slugPath);
|
|
58
|
+
}
|
|
59
|
+
// Try as literal path
|
|
60
|
+
const literalPath = resolve(root, arg);
|
|
61
|
+
if (existsSync(literalPath)) {
|
|
62
|
+
return resolve(literalPath);
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Find a timeline file.
|
|
68
|
+
* - If hint is provided, resolve relative to cwd. Returns absolute path if found.
|
|
69
|
+
* Throws UserError if the explicit path does not exist.
|
|
70
|
+
* - If no hint, scan cwd/videos/.../timeline.ts, sort by mtime desc, return the most recent.
|
|
71
|
+
* Returns null if no videos found (caller decides how to surface this).
|
|
72
|
+
*/
|
|
73
|
+
export function findTimeline(cwd, hint) {
|
|
74
|
+
if (hint) {
|
|
75
|
+
const resolved = resolve(cwd, hint);
|
|
76
|
+
if (!existsSync(resolved)) {
|
|
77
|
+
throw new UserError(`Timeline not found: ${resolved}`, `Check that the file exists. Expected at: ${resolved}`);
|
|
78
|
+
}
|
|
79
|
+
return resolved;
|
|
80
|
+
}
|
|
81
|
+
const videosDir = join(cwd, "videos");
|
|
82
|
+
if (!existsSync(videosDir))
|
|
83
|
+
return null;
|
|
84
|
+
let entries;
|
|
85
|
+
try {
|
|
86
|
+
entries = readdirSync(videosDir);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const candidates = [];
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
const timelinePath = join(videosDir, entry, "timeline.ts");
|
|
94
|
+
if (existsSync(timelinePath)) {
|
|
95
|
+
const stat = statSync(timelinePath);
|
|
96
|
+
candidates.push({ path: resolve(timelinePath), mtime: stat.mtimeMs });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (candidates.length === 0)
|
|
100
|
+
return null;
|
|
101
|
+
candidates.sort((a, b) => b.mtime - a.mtime);
|
|
102
|
+
return candidates[0].path;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=discover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../../src/cli/discover.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;IACtD,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;IAE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,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared project discovery: finds config and timeline, throws UserError on missing.
|
|
3
|
+
* Used by dev, script, and render commands.
|
|
4
|
+
*/
|
|
5
|
+
import type { ViteDevServer } from "vite";
|
|
6
|
+
import type { ProjectInfo } from "../types.js";
|
|
7
|
+
export interface DiscoveredProject {
|
|
8
|
+
configPath: string;
|
|
9
|
+
timelinePath: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find config and timeline for a consumer project.
|
|
13
|
+
* Throws UserError with actionable hints on missing config or timeline.
|
|
14
|
+
*
|
|
15
|
+
* @param cwd - Consumer repo root
|
|
16
|
+
* @param positional - Optional explicit timeline path
|
|
17
|
+
* @param commandName - Command name for error messages (e.g. "dev", "render")
|
|
18
|
+
*/
|
|
19
|
+
export declare function discoverProject(cwd: string, positional: string | undefined, commandName: string): DiscoveredProject;
|
|
20
|
+
/**
|
|
21
|
+
* Discover the project and load summaries for every video under videos/.
|
|
22
|
+
* Used by `dev` (whole project) and `render` (when prompting / auto-picking).
|
|
23
|
+
*
|
|
24
|
+
* When a Vite server is provided, timelines are loaded via `ssrLoadModule`
|
|
25
|
+
* which handles Vite-specific imports (CSS, virtual modules). Without a
|
|
26
|
+
* server, uses dynamic `import()` which may fail for files with Vite imports.
|
|
27
|
+
*/
|
|
28
|
+
export declare function discoverAllVideos(root: string, viteServer?: ViteDevServer): Promise<ProjectInfo>;
|
|
29
|
+
//# sourceMappingURL=discover_project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover_project.d.ts","sourceRoot":"","sources":["../../src/cli/discover_project.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAU,WAAW,EAA0B,MAAM,aAAa,CAAC;AAI/E,MAAM,WAAW,iBAAiB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,GACjB,iBAAiB,CAkBnB;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,WAAW,CAAC,CA2EtB"}
|