@mevdragon/vidfarm-devcli 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +12 -5
- package/PLATFORM_SPEC.md +143 -2
- package/README.md +165 -16
- package/SKILL.developer.md +258 -0
- package/SKILL.director.md +599 -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 +630 -0
- package/dist/src/app.js +897 -66
- package/dist/src/cli.js +284 -5
- package/dist/src/config.js +25 -5
- package/dist/src/context.js +1 -1
- 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 +74 -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 +10 -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 +5505 -0
- package/templates/template_0000/package.json +31 -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.js +242 -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.js +3 -0
- package/templates/template_0000/src/remotion/index.tsx +4 -0
- package/templates/template_0000/src/sdk.js +3 -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.js +1117 -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
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vidfarm-developer
|
|
3
|
+
description: Build and extend Vidfarm templates as a third-party developer. Use this when the task is to create or modify a template, add or adjust template operations, improve local template testing, wire AI generation through the developer's own provider keys, or document the external developer workflow. Do not use this skill for platform internals, shared AWS infrastructure, admin release flow, or production runtime changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vidfarm Third-Party Developer
|
|
7
|
+
|
|
8
|
+
This skill is for third-party template developers authoring Vidfarm templates locally.
|
|
9
|
+
|
|
10
|
+
Scope this skill to:
|
|
11
|
+
|
|
12
|
+
- creating a new template
|
|
13
|
+
- extending an existing template under `templates/*`
|
|
14
|
+
- adding or refining template operations and jobs
|
|
15
|
+
- improving local template authoring workflow
|
|
16
|
+
- wiring template behavior to the developer's own AI provider keys
|
|
17
|
+
- validating template behavior through the local CLI and API
|
|
18
|
+
|
|
19
|
+
Do not use this skill for:
|
|
20
|
+
|
|
21
|
+
- platform auth, billing, storage, webhook, or database internals
|
|
22
|
+
- developer console work under `/dev`
|
|
23
|
+
- production Docker or deployment changes
|
|
24
|
+
- shared AWS or release-admin workflows
|
|
25
|
+
- cloud Remotion publishing or cloud render setup
|
|
26
|
+
|
|
27
|
+
For third-party developers, Remotion is local. Do not require cloud Remotion credentials or shared AWS details in this skill.
|
|
28
|
+
|
|
29
|
+
## Required Developer Env
|
|
30
|
+
|
|
31
|
+
Third-party developers should only need their own API credentials and Vidfarm API auth.
|
|
32
|
+
|
|
33
|
+
Typical `.env`:
|
|
34
|
+
|
|
35
|
+
```env
|
|
36
|
+
GEMINI_API_KEY=""
|
|
37
|
+
OPENAI_API_KEY=""
|
|
38
|
+
OPENROUTER_API_KEY=""
|
|
39
|
+
PERPLEXITY_API_KEY=""
|
|
40
|
+
|
|
41
|
+
VIDFARM_USER_ID=""
|
|
42
|
+
VIDFARM_API_KEY=""
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Notes:
|
|
46
|
+
|
|
47
|
+
- at least one AI provider key is usually enough
|
|
48
|
+
- `VIDFARM_USER_ID` and `VIDFARM_API_KEY` are needed when calling the Vidfarm API directly
|
|
49
|
+
- do not ask third-party developers for platform secrets like `ENCRYPTION_SECRET`, `API_KEY_SALT`, `WEBHOOK_SECRET`, admin emails, S3 config, or generic AWS credentials
|
|
50
|
+
- do not ask third-party developers for `REMOTION_AWS_ACCESS_KEY_ID` or `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
51
|
+
|
|
52
|
+
## First Read
|
|
53
|
+
|
|
54
|
+
Read these files first when working on a template:
|
|
55
|
+
|
|
56
|
+
1. [GETTING_STARTED.developers.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/GETTING_STARTED.developers.md)
|
|
57
|
+
2. [templates/template_0000/SKILL.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/template_0000/SKILL.md)
|
|
58
|
+
3. [templates/template_0000/src/template.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/template_0000/src/template.ts)
|
|
59
|
+
4. [src/template-sdk.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/template-sdk.ts)
|
|
60
|
+
5. [src/cli.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/cli.ts)
|
|
61
|
+
|
|
62
|
+
If the task is narrow, read only the template files and CLI slice relevant to that task.
|
|
63
|
+
|
|
64
|
+
## Mental Model
|
|
65
|
+
|
|
66
|
+
A template is an internal module loaded by Vidfarm, but third-party developers should work at the template layer, not the platform layer.
|
|
67
|
+
|
|
68
|
+
The normal workflow is:
|
|
69
|
+
|
|
70
|
+
1. define template metadata and schemas
|
|
71
|
+
2. expose one or more operations
|
|
72
|
+
3. implement the job workflows behind those operations
|
|
73
|
+
4. test locally through the Vidfarm CLI and REST API
|
|
74
|
+
5. iterate until the template can be rerun reliably
|
|
75
|
+
|
|
76
|
+
Every public template action should remain async and job-based. Prefer fitting new behavior into the existing operation and job pattern instead of inventing one-off synchronous endpoints.
|
|
77
|
+
|
|
78
|
+
## When Adding A New Template
|
|
79
|
+
|
|
80
|
+
Follow this checklist:
|
|
81
|
+
|
|
82
|
+
1. create a new folder under `templates/template_<nnnn>/`
|
|
83
|
+
2. put template code in that folder, not under `src/*`
|
|
84
|
+
3. export `defineTemplate({...})`
|
|
85
|
+
4. define:
|
|
86
|
+
- `id`
|
|
87
|
+
- `slugId`
|
|
88
|
+
- `version`
|
|
89
|
+
- `about`
|
|
90
|
+
- `configSchema`
|
|
91
|
+
- `operations`
|
|
92
|
+
- `jobs`
|
|
93
|
+
5. add a template-local `SKILL.md`
|
|
94
|
+
6. put source research in `research/source_notes.md`
|
|
95
|
+
7. put source screenshots or videos in `research/preview/`
|
|
96
|
+
8. add `smokeTestPayload` for every operation
|
|
97
|
+
9. verify the template locally end to end
|
|
98
|
+
|
|
99
|
+
Use [templates/template_0000/src/template.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/template_0000/src/template.ts) as the baseline pattern.
|
|
100
|
+
|
|
101
|
+
## Template Contract
|
|
102
|
+
|
|
103
|
+
Each template should expose operations, not ad hoc endpoints.
|
|
104
|
+
|
|
105
|
+
Use this shape:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
export const myTemplate = defineTemplate({
|
|
109
|
+
id: "123e4567-e89b-42d3-a456-426614174000",
|
|
110
|
+
slugId: "ugc_hooks_v1",
|
|
111
|
+
version: "1.0.0",
|
|
112
|
+
about: {
|
|
113
|
+
title: "UGC Hooks V1",
|
|
114
|
+
description: "Generate hooks, previews, and final render inputs.",
|
|
115
|
+
viral_dna: "Fast creator-style hooks with simple repeatable structure.",
|
|
116
|
+
visual_dna: "Presentation-led mobile layouts with recognizable creator-native framing.",
|
|
117
|
+
preview_media: ["https://cdn.example.com/templates/ugc_hooks_v1/about/preview-01.jpg"],
|
|
118
|
+
link_to_original: "https://www.tiktok.com/@example/video/1234567890"
|
|
119
|
+
},
|
|
120
|
+
configSchema: z.object({
|
|
121
|
+
defaultProvider: z.enum(["openai", "openrouter", "gemini", "perplexity"]).default("openai")
|
|
122
|
+
}),
|
|
123
|
+
operations: {
|
|
124
|
+
scaffold: {
|
|
125
|
+
description: "Generate a script scaffold.",
|
|
126
|
+
inputSchema: z.object({
|
|
127
|
+
topic: z.string()
|
|
128
|
+
}),
|
|
129
|
+
workflow: "scaffoldWorkflow",
|
|
130
|
+
providerHint: "openai",
|
|
131
|
+
webhookSupport: true,
|
|
132
|
+
smokeTestPayload: {
|
|
133
|
+
topic: "creator hooks"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
jobs: {
|
|
138
|
+
async scaffoldWorkflow(ctx, input) {
|
|
139
|
+
return {
|
|
140
|
+
progress: 1,
|
|
141
|
+
output: {}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Keep these roles clear:
|
|
149
|
+
|
|
150
|
+
- `id` is the UUID-style template identifier
|
|
151
|
+
- `slugId` is the human-readable stable identifier
|
|
152
|
+
- `operations` define the public API
|
|
153
|
+
- `jobs` implement the actual work
|
|
154
|
+
|
|
155
|
+
## Local Workflow
|
|
156
|
+
|
|
157
|
+
Preferred local third-party developer workflow:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
161
|
+
npx @mevdragon/vidfarm-devcli session
|
|
162
|
+
npx @mevdragon/vidfarm-devcli validate-template --template-id template_0000
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
That CLI should be the default path because it:
|
|
166
|
+
|
|
167
|
+
- boots the local API and worker
|
|
168
|
+
- provisions local state automatically
|
|
169
|
+
- creates a local developer session
|
|
170
|
+
- seeds provider keys from local env vars when present
|
|
171
|
+
- uses local Remotion rendering
|
|
172
|
+
|
|
173
|
+
For third-party developers, local rendering is the default and expected path. Do not document or require cloud Remotion setup here.
|
|
174
|
+
|
|
175
|
+
Reset local state when needed:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
rm -rf .vidfarm/local
|
|
179
|
+
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Provider Usage
|
|
183
|
+
|
|
184
|
+
Templates should prefer the Vidfarm provider abstractions already available in context.
|
|
185
|
+
|
|
186
|
+
Rules:
|
|
187
|
+
|
|
188
|
+
- use the configured provider path instead of hardcoding one provider everywhere
|
|
189
|
+
- let templates work with whichever supported provider key the developer actually has
|
|
190
|
+
- keep prompts and model choices configurable when useful
|
|
191
|
+
- avoid requiring multiple provider accounts unless the template genuinely needs them
|
|
192
|
+
|
|
193
|
+
If a task only needs image generation, do not force extra model providers for text or research.
|
|
194
|
+
|
|
195
|
+
## Storage Namespaces
|
|
196
|
+
|
|
197
|
+
Use the built-in storage namespace conventions instead of inventing one-off key layouts.
|
|
198
|
+
|
|
199
|
+
Current namespaces:
|
|
200
|
+
|
|
201
|
+
- `user/:user_id/*` for user-owned uploaded assets
|
|
202
|
+
- `developer/:user_id/*` for developer-scoped authoring assets or scratch files
|
|
203
|
+
- `templates/:template_id/users/:user_id/jobs/:job_id/*` for template job artifacts
|
|
204
|
+
- `templates/:template_id/about/*` for template about-page media
|
|
205
|
+
|
|
206
|
+
Rules:
|
|
207
|
+
|
|
208
|
+
- keep user uploads under the `user/` namespace
|
|
209
|
+
- keep developer-only working files under the `developer/` namespace
|
|
210
|
+
- keep generated job outputs under the template job namespace
|
|
211
|
+
- do not scatter files across arbitrary top-level prefixes
|
|
212
|
+
- prefer the shared storage helpers over handwritten string concatenation for new paths
|
|
213
|
+
|
|
214
|
+
## API Usage
|
|
215
|
+
|
|
216
|
+
When testing through the API, use:
|
|
217
|
+
|
|
218
|
+
- `vidfarm-user-id`
|
|
219
|
+
- `vidfarm-api-key`
|
|
220
|
+
|
|
221
|
+
The template-local `SKILL.md` should show the concrete routes and example payloads for that template.
|
|
222
|
+
|
|
223
|
+
## Validation Checklist
|
|
224
|
+
|
|
225
|
+
After changes, validate with as many of these as apply:
|
|
226
|
+
|
|
227
|
+
1. `npm run check`
|
|
228
|
+
2. `npm run build`
|
|
229
|
+
3. `npx @mevdragon/vidfarm-devcli validate-template --template-id <templateIdOrSlug>`
|
|
230
|
+
4. run the template locally through the CLI session
|
|
231
|
+
5. save template config if the template exposes config
|
|
232
|
+
6. launch a real job
|
|
233
|
+
7. poll job status and logs
|
|
234
|
+
8. inspect produced artifacts
|
|
235
|
+
|
|
236
|
+
If you changed slideshow or text-overlay behavior, also validate:
|
|
237
|
+
|
|
238
|
+
1. output images are the expected aspect ratio
|
|
239
|
+
2. captions remain readable and do not clip
|
|
240
|
+
3. final local video output matches expected pacing and framing
|
|
241
|
+
|
|
242
|
+
## What To Avoid
|
|
243
|
+
|
|
244
|
+
- asking third-party developers for platform secrets
|
|
245
|
+
- mixing admin release instructions into template authoring guidance
|
|
246
|
+
- requiring cloud Remotion setup for normal template work
|
|
247
|
+
- adding one-off custom endpoints when an operation already fits the job
|
|
248
|
+
- hardcoding a developer's personal provider choice into template logic
|
|
249
|
+
- omitting `SKILL.md` or `smokeTestPayload`
|
|
250
|
+
|
|
251
|
+
## Output Style For Vidfarm Work
|
|
252
|
+
|
|
253
|
+
When reporting back after Vidfarm template changes:
|
|
254
|
+
|
|
255
|
+
- name the template changed
|
|
256
|
+
- mention the operation or workflow affected
|
|
257
|
+
- state how you verified it locally
|
|
258
|
+
- call out any remaining gap such as mocked provider responses or unexercised optional paths
|