@mevdragon/vidfarm-devcli 0.1.0 → 0.2.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/.env.example +11 -4
- package/PLATFORM_SPEC.md +142 -2
- package/README.md +165 -16
- package/SKILL.developer.md +577 -0
- package/dist/infra/cdk/bin/vidfarm-prod.js +59 -0
- package/dist/infra/cdk/lib/vidfarm-prod-stack.js +212 -0
- package/dist/src/account-pages.js +578 -0
- package/dist/src/app.js +887 -66
- package/dist/src/cli.js +284 -5
- package/dist/src/config.js +24 -4
- package/dist/src/db.js +427 -18
- package/dist/src/dev-app.js +59 -12
- package/dist/src/homepage.js +441 -0
- package/dist/src/index.js +12 -7
- package/dist/src/lib/crypto.js +14 -0
- package/dist/src/lib/template-dna.js +542 -0
- package/dist/src/lib/template-style-options.js +49 -0
- package/dist/src/registry.js +54 -7
- package/dist/src/runtime.js +3 -1
- package/dist/src/services/auth.js +69 -5
- package/dist/src/services/jobs.js +23 -4
- package/dist/src/services/providers.js +74 -12
- package/dist/src/services/storage.js +52 -18
- package/dist/src/services/template-certification.js +160 -0
- package/dist/src/services/template-loader.js +37 -0
- package/dist/src/services/template-sources.js +135 -0
- package/dist/src/worker.js +19 -7
- package/dist/templates/template_0000/src/lib/images.js +242 -0
- package/dist/templates/template_0000/src/remotion/Root.js +33 -0
- package/dist/templates/template_0000/src/sdk.js +3 -0
- package/dist/templates/template_0000/src/style-options.js +51 -0
- package/dist/templates/template_0000/src/template-dna.js +9 -0
- package/dist/templates/template_0000/src/template.js +1217 -0
- package/package.json +9 -1
- package/templates/template_0000/README.md +121 -0
- package/templates/template_0000/SKILL.md +193 -0
- package/templates/template_0000/assets/Abel-Regular.ttf +0 -0
- package/templates/template_0000/assets/DMSerifDisplay-Regular.ttf +0 -0
- package/templates/template_0000/assets/Montserrat[wght].ttf +0 -0
- package/templates/template_0000/assets/SourceCodePro[wght].ttf +0 -0
- package/templates/template_0000/assets/TikTokSans-SemiBold.ttf +0 -0
- package/templates/template_0000/assets/Yesteryear-Regular.ttf +0 -0
- package/templates/template_0000/composition.json +11 -0
- package/templates/template_0000/package-lock.json +5137 -0
- package/templates/template_0000/package.json +30 -0
- package/templates/template_0000/research/preview/.gitkeep +1 -0
- package/templates/template_0000/research/source_notes.md +7 -0
- package/templates/template_0000/scripts/create-site.mjs +27 -0
- package/templates/template_0000/scripts/render-cloud.mjs +72 -0
- package/templates/template_0000/src/lib/images.ts +284 -0
- package/templates/template_0000/src/remotion/Root.js +33 -0
- package/templates/template_0000/src/remotion/Root.tsx +75 -0
- package/templates/template_0000/src/remotion/index.tsx +4 -0
- package/templates/template_0000/src/sdk.ts +122 -0
- package/templates/template_0000/src/style-options.js +51 -0
- package/templates/template_0000/src/style-options.ts +60 -0
- package/templates/template_0000/src/template-dna.ts +15 -0
- package/templates/template_0000/src/template.ts +1747 -0
- package/templates/template_0000/template.config.json +26 -0
- package/templates/template_0000/tsconfig.json +19 -0
- package/dist/templates/template_0000/demo-template.js +0 -196
- package/dist/templates/template_0000/remotion/Root.js +0 -66
- /package/dist/templates/template_0000/{remotion → src/remotion}/index.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mevdragon/vidfarm-devcli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Developer CLI for running the Vidfarm local template platform.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"templates/template_0000",
|
|
12
13
|
"README.md",
|
|
14
|
+
"SKILL.developer.md",
|
|
13
15
|
"PLATFORM_SPEC.md",
|
|
14
16
|
"AWS_REMOTION_HANDOFF.md",
|
|
15
17
|
".env.example"
|
|
@@ -27,9 +29,13 @@
|
|
|
27
29
|
"scripts": {
|
|
28
30
|
"dev": "tsx watch src/index.ts",
|
|
29
31
|
"dev:cli": "tsx src/cli.ts dev",
|
|
32
|
+
"deploy:prod-inplace": "bash scripts/deploy-prod-inplace.sh",
|
|
33
|
+
"rollback:prod-inplace": "bash scripts/rollback-prod-inplace.sh",
|
|
30
34
|
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|
|
31
35
|
"start": "node dist/src/index.js",
|
|
32
36
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
37
|
+
"cdk:synth": "npm run build && npx aws-cdk synth --app 'node dist/infra/cdk/bin/vidfarm-prod.js'",
|
|
38
|
+
"cdk:deploy": "npm run build && npx aws-cdk deploy --app 'node dist/infra/cdk/bin/vidfarm-prod.js'",
|
|
33
39
|
"prepack": "npm run build"
|
|
34
40
|
},
|
|
35
41
|
"dependencies": {
|
|
@@ -53,6 +59,8 @@
|
|
|
53
59
|
"@types/node": "^24.0.1",
|
|
54
60
|
"@types/react": "^18.3.23",
|
|
55
61
|
"@types/react-dom": "^18.3.7",
|
|
62
|
+
"aws-cdk-lib": "^2.196.0",
|
|
63
|
+
"constructs": "^10.4.2",
|
|
56
64
|
"tsx": "^4.19.4",
|
|
57
65
|
"typescript": "^5.8.3"
|
|
58
66
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# vidfarm_template_0000
|
|
2
|
+
|
|
3
|
+
Standalone GitHub-distributable package for the Vidfarm `template_0000` starter template.
|
|
4
|
+
|
|
5
|
+
This package exists for two operational reasons:
|
|
6
|
+
|
|
7
|
+
- keep the template code in its own private GitHub repo for manual admin review/import
|
|
8
|
+
- preserve the exact checked-in config and build shape the release admin will later promote to shared Remotion AWS and the production Docker image
|
|
9
|
+
|
|
10
|
+
Developers should treat this repo as an authoring and review unit, not as an authorized deployment unit.
|
|
11
|
+
|
|
12
|
+
Every new template should keep its source-format research checked in:
|
|
13
|
+
|
|
14
|
+
- `research/source_notes.md` for notes on the original winning format
|
|
15
|
+
- `research/preview/` for the screenshots or source video the DNA analyzers inspect
|
|
16
|
+
- `src/template-dna.ts` for the generated viral and visual DNA that feed the published template metadata
|
|
17
|
+
|
|
18
|
+
The production release flow is:
|
|
19
|
+
|
|
20
|
+
1. developer pushes template code to GitHub
|
|
21
|
+
2. admin reviews the repo and selects a commit from `production`
|
|
22
|
+
3. admin publishes the approved Remotion site bundle to shared AWS
|
|
23
|
+
4. admin imports and activates the approved commit in Vidfarm
|
|
24
|
+
5. admin rebuilds and redeploys the production Docker image
|
|
25
|
+
|
|
26
|
+
Template authors do not publish directly to shared Remotion Lambda and do not directly promote templates into production Docker.
|
|
27
|
+
|
|
28
|
+
Production integration settings are checked into `template.config.json`. AI agents and developers should treat that file as the source of truth for:
|
|
29
|
+
|
|
30
|
+
- project identity
|
|
31
|
+
- `template_id` as the self-issued UUIDv4 platform identifier
|
|
32
|
+
- `slug_id` as the human-readable stable slug
|
|
33
|
+
- GitHub repo target
|
|
34
|
+
- production source branch
|
|
35
|
+
- Remotion region/function/bucket/site/composition settings
|
|
36
|
+
- release control expectations for admin promotion
|
|
37
|
+
|
|
38
|
+
## Included
|
|
39
|
+
|
|
40
|
+
- `SKILL.md` for customer AI-agent usage
|
|
41
|
+
- `src/template.ts` for the Vidfarm platform contract
|
|
42
|
+
- `src/remotion/*` for local and cloud video rendering
|
|
43
|
+
- `src/lib/images.ts` for non-cropping portrait normalization
|
|
44
|
+
- `composition.json` sample props for cloud render smoke tests
|
|
45
|
+
|
|
46
|
+
## Template behavior
|
|
47
|
+
|
|
48
|
+
`template_0000` is intentionally opinionated because later templates will likely start from it.
|
|
49
|
+
|
|
50
|
+
- stage 1 operation: `create_slideshow`
|
|
51
|
+
- stage 2 operation: `render_video`
|
|
52
|
+
- `create_slideshow` accepts either legacy `[imagePrompt, caption]` or `[imagePrompt, caption, durationMs]` slide tuples, or structured slide objects with optional `image_prompt_attachments` and `duration_ms`
|
|
53
|
+
- `create_slideshow` also accepts optional `meta_details_prompt` guidance and returns generated `title`, `description`, `pinned_comment`, `location`, and `song` metadata plus the normalized metadata input args
|
|
54
|
+
- slide generation is strict 9:16 with TikTok-safe reserved UI zones
|
|
55
|
+
- finished slide images already include the text overlay
|
|
56
|
+
- the video stage only accepts explicit `slides` input and sequences those finished slide images using per-slide `durationMs`
|
|
57
|
+
- caption placement is center-biased and image-aware, using provider layout analysis first with a local fallback
|
|
58
|
+
- caption styling is restricted to the checked-in starter option lists in `src/style-options.ts`
|
|
59
|
+
|
|
60
|
+
The starter is optimized to:
|
|
61
|
+
|
|
62
|
+
- avoid subject cut-off during portrait normalization
|
|
63
|
+
- keep the right-side TikTok action rail clear
|
|
64
|
+
- keep the top tabs area clear
|
|
65
|
+
- keep the bottom caption/audio area clear
|
|
66
|
+
- avoid fake full-width caption panels; if a text background is used, it renders as a tight line chip behind the words only
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Validate
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run check
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Analyze Template DNA
|
|
81
|
+
|
|
82
|
+
After you add source notes and preview media, run:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
vidfarm analyze-viral-dna --template-dir .
|
|
86
|
+
vidfarm analyze-visual-dna --template-dir .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If you scaffold a template with `vidfarm generate-template` and provide `--source-preview-dir`, the CLI will run both analyzers automatically unless `--skip-dna-analysis` is set.
|
|
90
|
+
|
|
91
|
+
## Shared Remotion AWS
|
|
92
|
+
|
|
93
|
+
Expected shared infra:
|
|
94
|
+
|
|
95
|
+
- region: stored in `template.config.json`
|
|
96
|
+
- function: stored in `template.config.json`
|
|
97
|
+
- bucket: stored in `template.config.json`
|
|
98
|
+
|
|
99
|
+
The only runtime secrets expected from the execution environment are AWS credentials. The production Remotion topology is intentionally checked into `template.config.json`, not spread across `.env` values.
|
|
100
|
+
|
|
101
|
+
These shared-AWS operations are release-admin tasks. Template developers should not run them against the shared production AWS account.
|
|
102
|
+
|
|
103
|
+
Release admin create-site:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm run admin:create-site
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Release admin cloud render smoke test:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm run admin:render:cloud
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Release admin cloud render from a real stage-1 manifest:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm run admin:render:cloud -- --manifest /abs/path/to/template-0000.json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Use the manifest mode when you want the cloud render verification to include the actual composited slide frames with text overlays, not just the static sample props.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Template 0000 Skill
|
|
2
|
+
|
|
3
|
+
Use this template when the customer wants a fast vertical slideshow for TikTok-style distribution, built from a short list of scene prompts and exact overlay text.
|
|
4
|
+
|
|
5
|
+
Operational rule:
|
|
6
|
+
|
|
7
|
+
- template developers author and test this template locally
|
|
8
|
+
- only the release admin publishes the approved Remotion site bundle to shared AWS
|
|
9
|
+
- only the release admin promotes the approved template into production Docker
|
|
10
|
+
|
|
11
|
+
Inputs:
|
|
12
|
+
|
|
13
|
+
- `slides`: either ordered tuples like `[imagePrompt, overlayText]` or `[imagePrompt, overlayText, durationMs]`, or objects like `{ image_prompt, image_prompt_attachments, caption, duration_ms }`
|
|
14
|
+
- `image_prompt_attachments`: optional public media URLs used as visual reference attachments during image generation
|
|
15
|
+
- `meta_details_prompt`: optional guidance for generated title, description, pinned comment, location, and song metadata
|
|
16
|
+
|
|
17
|
+
Behavior:
|
|
18
|
+
|
|
19
|
+
- `create_slideshow` generates exact 9:16 images, preserves the exact overlay text, and outputs finished slide frames plus a manifest
|
|
20
|
+
- `render_video` turns explicit finished slide frames into an auto-advancing vertical MP4
|
|
21
|
+
- reserves space for TikTok UI chrome at the top, right edge, and bottom caption area
|
|
22
|
+
- keeps subjects away from edge crops and avoids cutting off faces, pets, hands, and products
|
|
23
|
+
- prefers centered native-caption placement using image analysis first, with local fallback scoring
|
|
24
|
+
- never uses a full paragraph wash behind captions; when enabled, text backgrounds render as tight chips around the words
|
|
25
|
+
- restricts caption fonts and text background colors to the checked-in starter option lists in `src/style-options.ts`
|
|
26
|
+
|
|
27
|
+
Allowed caption fonts:
|
|
28
|
+
|
|
29
|
+
- `source_code_pro`
|
|
30
|
+
- `montserrat`
|
|
31
|
+
- `yesteryear`
|
|
32
|
+
- `dm_serif_display`
|
|
33
|
+
- `abel`
|
|
34
|
+
|
|
35
|
+
Allowed text background colors:
|
|
36
|
+
|
|
37
|
+
- `none`
|
|
38
|
+
- `black`
|
|
39
|
+
- `red`
|
|
40
|
+
- `orange`
|
|
41
|
+
- `yellow`
|
|
42
|
+
- `lime_green`
|
|
43
|
+
- `teal`
|
|
44
|
+
- `light_blue`
|
|
45
|
+
- `dark_blue`
|
|
46
|
+
- `violet`
|
|
47
|
+
- `pink`
|
|
48
|
+
- `brown`
|
|
49
|
+
- `dark_green`
|
|
50
|
+
- `blue_gray`
|
|
51
|
+
- `light_gray`
|
|
52
|
+
- `dark_gray`
|
|
53
|
+
|
|
54
|
+
REST API routes for this template:
|
|
55
|
+
|
|
56
|
+
- `GET /templates/template_0000`
|
|
57
|
+
- `GET /templates/template_0000/skill`
|
|
58
|
+
- `POST /templates/template_0000/config`
|
|
59
|
+
- `POST /templates/template_0000/operations/create_slideshow`
|
|
60
|
+
- `POST /templates/template_0000/operations/render_video`
|
|
61
|
+
- `GET /templates/template_0000/jobs`
|
|
62
|
+
- `GET /templates/template_0000/jobs/:jobId`
|
|
63
|
+
- `GET /templates/template_0000/jobs/:jobId/logs`
|
|
64
|
+
- `POST /templates/template_0000/jobs/:jobId/cancel`
|
|
65
|
+
|
|
66
|
+
Shared shell variables:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
BASE_URL="http://localhost:3000"
|
|
70
|
+
VIDFARM_USER_ID="replace-me"
|
|
71
|
+
VIDFARM_API_KEY="replace-me"
|
|
72
|
+
COMMON_HEADERS=(
|
|
73
|
+
-H "vidfarm-user-id: ${VIDFARM_USER_ID}"
|
|
74
|
+
-H "vidfarm-api-key: ${VIDFARM_API_KEY}"
|
|
75
|
+
)
|
|
76
|
+
JSON_HEADERS=(
|
|
77
|
+
"${COMMON_HEADERS[@]}"
|
|
78
|
+
-H "content-type: application/json"
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Get template metadata:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
curl "${BASE_URL}/templates/template_0000" \
|
|
86
|
+
"${COMMON_HEADERS[@]}"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Get the published `SKILL.md` URL contents:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
curl "${BASE_URL}/templates/template_0000/skill" \
|
|
93
|
+
"${COMMON_HEADERS[@]}"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Save template config:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
curl -X POST "${BASE_URL}/templates/template_0000/config" \
|
|
100
|
+
"${JSON_HEADERS[@]}" \
|
|
101
|
+
-d '{
|
|
102
|
+
"config": {
|
|
103
|
+
"defaultProvider": "openrouter",
|
|
104
|
+
"textModel": "openai/gpt-4.1-mini",
|
|
105
|
+
"imageModel": "bytedance-seed/seedream-4.5",
|
|
106
|
+
"captionFont": "montserrat",
|
|
107
|
+
"captionBackgroundColor": "none",
|
|
108
|
+
"renderCompositionId": "template-0000"
|
|
109
|
+
}
|
|
110
|
+
}'
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Create a slideshow:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
curl -X POST "${BASE_URL}/templates/template_0000/operations/create_slideshow" \
|
|
117
|
+
"${JSON_HEADERS[@]}" \
|
|
118
|
+
-d '{
|
|
119
|
+
"tracer": "launch-story-001",
|
|
120
|
+
"payload": {
|
|
121
|
+
"slides": [
|
|
122
|
+
["late night founder at laptop", "launching after hours", 2200],
|
|
123
|
+
{
|
|
124
|
+
"image_prompt": "skincare serum bottle on a clean bathroom counter near a window",
|
|
125
|
+
"caption": "the routine was simpler than i thought",
|
|
126
|
+
"duration_ms": 2800
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"meta_details_prompt": "Write native TikTok metadata for a US audience. Keep it curiosity-driven and casual."
|
|
130
|
+
}
|
|
131
|
+
}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Render the final video:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
curl -X POST "${BASE_URL}/templates/template_0000/operations/render_video" \
|
|
138
|
+
"${JSON_HEADERS[@]}" \
|
|
139
|
+
-d '{
|
|
140
|
+
"tracer": "launch-story-001-render",
|
|
141
|
+
"payload": {
|
|
142
|
+
"slides": [
|
|
143
|
+
{
|
|
144
|
+
"imageUrl": "https://example.com/slide-1.png",
|
|
145
|
+
"durationMs": 2200
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"imageUrl": "https://example.com/slide-2.png",
|
|
149
|
+
"durationMs": 2800
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
}'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
List jobs for this template:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
curl "${BASE_URL}/templates/template_0000/jobs" \
|
|
160
|
+
"${COMMON_HEADERS[@]}"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
List jobs filtered by tracer and date range:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
curl "${BASE_URL}/templates/template_0000/jobs?tracer=launch-story-001&start_time=2026-05-17T00:00:00.000Z&end_time=2026-05-18T00:00:00.000Z&limit=20" \
|
|
167
|
+
"${COMMON_HEADERS[@]}"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Get one job:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
JOB_ID="job_replace_me"
|
|
174
|
+
|
|
175
|
+
curl "${BASE_URL}/templates/template_0000/jobs/${JOB_ID}" \
|
|
176
|
+
"${COMMON_HEADERS[@]}"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Get one job's logs:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
curl "${BASE_URL}/templates/template_0000/jobs/${JOB_ID}/logs?start_time=2026-05-17T00:00:00.000Z&end_time=2026-05-18T00:00:00.000Z&limit=200" \
|
|
183
|
+
"${COMMON_HEADERS[@]}"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Cancel one job:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
curl -X POST "${BASE_URL}/templates/template_0000/jobs/${JOB_ID}/cancel" \
|
|
190
|
+
"${COMMON_HEADERS[@]}"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Use this template for short-form product explainers, founder clips, launch teasers, and simple storyboarding workflows where speed matters more than deep custom motion design.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slides": [
|
|
3
|
+
{
|
|
4
|
+
"imageUrl": "https://images.unsplash.com/photo-1519389950473-47ba0277781c?auto=format&fit=crop&w=1080&q=80"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"imageUrl": "https://images.unsplash.com/photo-1520607162513-77705c0f0d4a?auto=format&fit=crop&w=1080&q=80"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"secondsPerSlide": 2
|
|
11
|
+
}
|