@mevdragon/vidfarm-devcli 0.2.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 +2 -2
- package/PLATFORM_SPEC.md +1 -0
- package/SKILL.developer.md +128 -447
- package/SKILL.director.md +599 -0
- package/dist/src/account-pages.js +57 -5
- package/dist/src/app.js +32 -22
- package/dist/src/config.js +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/services/storage.js +22 -0
- package/dist/templates/template_0000/src/template.js +1 -1
- package/package.json +2 -1
- package/templates/template_0000/package-lock.json +368 -0
- package/templates/template_0000/package.json +1 -0
- package/templates/template_0000/src/lib/images.js +242 -0
- package/templates/template_0000/src/remotion/index.js +3 -0
- package/templates/template_0000/src/sdk.js +3 -0
- package/templates/template_0000/src/template.js +1117 -0
- package/templates/template_0000/src/template.ts +1 -1
package/SKILL.developer.md
CHANGED
|
@@ -1,150 +1,102 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vidfarm-developer
|
|
3
|
-
description: Build and extend Vidfarm
|
|
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
4
|
---
|
|
5
5
|
|
|
6
|
-
# Vidfarm Developer
|
|
6
|
+
# Vidfarm Third-Party Developer
|
|
7
7
|
|
|
8
|
-
This skill is for
|
|
8
|
+
This skill is for third-party template developers authoring Vidfarm templates locally.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Scope this skill to:
|
|
11
11
|
|
|
12
|
-
|
|
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
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
- GitHub repo: `OfficeXApp/vidfarm-devcli` as a private repo
|
|
19
|
+
Do not use this skill for:
|
|
16
20
|
|
|
17
|
-
|
|
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
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
For third-party developers, Remotion is local. Do not require cloud Remotion credentials or shared AWS details in this skill.
|
|
20
28
|
|
|
21
|
-
|
|
22
|
-
- extend an existing template with new operations or workflows
|
|
23
|
-
- wire AI generation through customer-owned provider keys
|
|
24
|
-
- add billing, artifacts, workspace, or webhook behavior
|
|
25
|
-
- integrate Remotion render steps
|
|
26
|
-
- modify the developer console at `/dev`
|
|
27
|
-
- change the Docker/AWS-hosted platform runtime
|
|
29
|
+
## Required Developer Env
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Third-party developers should only need their own API credentials and Vidfarm API auth.
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
- SQLite job and lease state
|
|
33
|
-
- in-process worker loop
|
|
34
|
-
- local or S3-backed artifact storage
|
|
35
|
-
- async-first job model
|
|
33
|
+
Typical `.env`:
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- admin-only production Docker promotion
|
|
43
|
-
- pinned commit-SHA releases
|
|
44
|
-
- mandatory certification before activation
|
|
45
|
-
|
|
46
|
-
Start from the current implementation, not just the original spec.
|
|
47
|
-
|
|
48
|
-
## First Read
|
|
35
|
+
```env
|
|
36
|
+
GEMINI_API_KEY=""
|
|
37
|
+
OPENAI_API_KEY=""
|
|
38
|
+
OPENROUTER_API_KEY=""
|
|
39
|
+
PERPLEXITY_API_KEY=""
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
VIDFARM_USER_ID=""
|
|
42
|
+
VIDFARM_API_KEY=""
|
|
43
|
+
```
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
2. [video-pipeline-architecture-draft.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/video-pipeline-architecture-draft.md)
|
|
54
|
-
3. [AWS_REMOTION_HANDOFF.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/AWS_REMOTION_HANDOFF.md) if the task touches Remotion or cloud render setup
|
|
55
|
-
4. [src/app.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/app.ts)
|
|
56
|
-
5. [src/db.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/db.ts)
|
|
57
|
-
6. [src/worker.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/worker.ts)
|
|
58
|
-
7. [src/template-sdk.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/template-sdk.ts)
|
|
59
|
-
8. [templates/template_0000/src/template.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/template_0000/src/template.ts)
|
|
60
|
-
9. [src/dev-app.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/dev-app.ts)
|
|
61
|
-
10. [src/cli.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/cli.ts) if the task touches local template developer workflow
|
|
45
|
+
Notes:
|
|
62
46
|
|
|
63
|
-
|
|
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`
|
|
64
51
|
|
|
65
|
-
##
|
|
52
|
+
## First Read
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
Read these files first when working on a template:
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- storage lives in `src/services/storage.ts`
|
|
75
|
-
- jobs live in `src/services/jobs.ts`
|
|
76
|
-
- webhooks live in `src/services/webhooks.ts`
|
|
77
|
-
- Remotion integration seam lives in `src/services/remotion.ts`
|
|
78
|
-
- templates are registered in `src/registry.ts`
|
|
79
|
-
- template implementation code lives in `templates/*`, not `src/*`
|
|
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)
|
|
80
61
|
|
|
81
|
-
|
|
62
|
+
If the task is narrow, read only the template files and CLI slice relevant to that task.
|
|
82
63
|
|
|
83
|
-
##
|
|
64
|
+
## Mental Model
|
|
84
65
|
|
|
85
|
-
|
|
66
|
+
A template is an internal module loaded by Vidfarm, but third-party developers should work at the template layer, not the platform layer.
|
|
86
67
|
|
|
87
|
-
The normal
|
|
68
|
+
The normal workflow is:
|
|
88
69
|
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
92
|
-
4.
|
|
93
|
-
5.
|
|
94
|
-
6. workflow emits logs, artifacts, billing events, and optional webhook deliveries
|
|
95
|
-
7. client polls `GET /templates/:templateId/jobs/:jobId`
|
|
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
|
|
96
75
|
|
|
97
|
-
|
|
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.
|
|
98
77
|
|
|
99
78
|
## When Adding A New Template
|
|
100
79
|
|
|
101
|
-
Follow this checklist
|
|
80
|
+
Follow this checklist:
|
|
102
81
|
|
|
103
|
-
1.
|
|
104
|
-
2.
|
|
105
|
-
3.
|
|
106
|
-
4.
|
|
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:
|
|
107
86
|
- `id`
|
|
87
|
+
- `slugId`
|
|
108
88
|
- `version`
|
|
109
|
-
- `about
|
|
110
|
-
- `about.viral_dna`
|
|
111
|
-
- `about.visual_dna`
|
|
112
|
-
- `about.preview_media`
|
|
113
|
-
- `about.link_to_original`
|
|
114
|
-
- `skillPath`
|
|
89
|
+
- `about`
|
|
115
90
|
- `configSchema`
|
|
116
91
|
- `operations`
|
|
117
92
|
- `jobs`
|
|
118
|
-
5.
|
|
119
|
-
6.
|
|
120
|
-
7.
|
|
121
|
-
8.
|
|
122
|
-
9.
|
|
123
|
-
10. If useful, add default payload/config examples to `src/dev-app.ts`
|
|
124
|
-
11. Verify end to end with the local developer console and/or curl
|
|
125
|
-
|
|
126
|
-
Use the existing `template_0000` starter template as the baseline example.
|
|
127
|
-
|
|
128
|
-
The starter scaffold now standardizes template DNA authoring:
|
|
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
|
|
129
98
|
|
|
130
|
-
|
|
131
|
-
- `research/preview/` holds the screenshots or video the analyzers inspect
|
|
132
|
-
- `src/template-dna.ts` is the checked-in generated module that feeds `about.viral_dna`, `about.visual_dna`, and `about.link_to_original`
|
|
133
|
-
- `vidfarm generate-template` stages those files automatically, and if preview media is already present it will run both DNA analyzers during scaffold creation
|
|
134
|
-
|
|
135
|
-
`template_0000` is intentionally opinionated and should be treated as the default starter pattern:
|
|
136
|
-
|
|
137
|
-
- operation 1: `create_slideshow`
|
|
138
|
-
- operation 2: `render_video`
|
|
139
|
-
- stage 1 outputs finished 9:16 slide images with the text already composited
|
|
140
|
-
- stage 2 only sequences those finished slide images into video
|
|
141
|
-
- reserve TikTok UI safe zones at the top, right edge, and bottom
|
|
142
|
-
- avoid subject cut-off during portrait normalization
|
|
143
|
-
- use checked-in TikTok Sans for starter caption typography
|
|
144
|
-
- prefer readable text with shadow/fade over caption boxes
|
|
145
|
-
- if a new template does not need video, it can stop after stage 1
|
|
146
|
-
|
|
147
|
-
Not every template uses Remotion. That is fine. Certification only expects Remotion behavior if the template actually calls `ctx.remotion`.
|
|
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.
|
|
148
100
|
|
|
149
101
|
## Template Contract
|
|
150
102
|
|
|
@@ -193,245 +145,16 @@ export const myTemplate = defineTemplate({
|
|
|
193
145
|
});
|
|
194
146
|
```
|
|
195
147
|
|
|
196
|
-
Keep
|
|
197
|
-
|
|
198
|
-
- `id` is the self-issued UUIDv4 `template_id`
|
|
199
|
-
- `slugId` is the human-readable stable `slug_id`
|
|
200
|
-
- `operations` define the public API surface
|
|
201
|
-
- `jobs` define internal execution workflows
|
|
202
|
-
- `smokeTestPayload` defines the minimum certification input
|
|
203
|
-
|
|
204
|
-
## GitHub Source Flow
|
|
205
|
-
|
|
206
|
-
For GitHub-backed template distribution, treat the platform as importing approved source code, not live-tracking a repo.
|
|
207
|
-
|
|
208
|
-
Rules:
|
|
148
|
+
Keep these roles clear:
|
|
209
149
|
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
-
|
|
214
|
-
- import resolves to a pinned commit SHA
|
|
215
|
-
- certification runs before activation
|
|
216
|
-
- activation flips one certified release live
|
|
217
|
-
- Remotion site publish is part of admin release promotion, not template authoring
|
|
218
|
-
- production Docker rebuild/redeploy happens only after admin approval
|
|
219
|
-
|
|
220
|
-
Do not implement floating branch-head production state. Live template state must always be tied to a specific commit.
|
|
221
|
-
|
|
222
|
-
For the current demo standalone template repo, use:
|
|
223
|
-
|
|
224
|
-
- project/package name: `vidfarm_template_0000`
|
|
225
|
-
- GitHub repo target: `mevdragon/vidfarm_template_0000`
|
|
226
|
-
- checked-in production config file: `template.config.json`
|
|
227
|
-
- `slug_id`: `template_0000`
|
|
228
|
-
- sample `template_id`: `4c7a7e1a-7f35-4f30-9f86-9c8a63c7f2db`
|
|
229
|
-
|
|
230
|
-
When registering a template source with the platform:
|
|
231
|
-
|
|
232
|
-
- `template_id` must be a self-issued UUIDv4
|
|
233
|
-
- `slug_id` must be the human-readable stable identifier
|
|
234
|
-
- registration must fail if another source already uses the same `template_id`
|
|
235
|
-
- the conflict error should tell the developer to generate a different UUIDv4
|
|
236
|
-
|
|
237
|
-
Template repos should prefer checked-in config for production topology over scattered env vars. In particular:
|
|
238
|
-
|
|
239
|
-
- Remotion region/function/bucket/site/composition settings should live in `template.config.json`
|
|
240
|
-
- release control metadata should also live in `template.config.json`
|
|
241
|
-
- AI agents should read `template.config.json` as the source of truth
|
|
242
|
-
- only secrets and credentials should come from the execution environment
|
|
243
|
-
|
|
244
|
-
## Workflow Rules
|
|
245
|
-
|
|
246
|
-
Inside a template workflow:
|
|
247
|
-
|
|
248
|
-
- log meaningful progress
|
|
249
|
-
- store large outputs as artifacts
|
|
250
|
-
- record billing when you consume external or compute-heavy resources
|
|
251
|
-
- route provider calls through `ctx.providers`
|
|
252
|
-
- use `ctx.remotion` for render submission
|
|
253
|
-
- use `ctx.jobs.enqueueChild(...)` only when a child-job boundary is truly useful
|
|
254
|
-
|
|
255
|
-
Do not bypass framework-owned services with raw provider calls unless the user explicitly wants to break out of the shared routing and billing model.
|
|
256
|
-
|
|
257
|
-
## Provider Usage
|
|
258
|
-
|
|
259
|
-
For customer-billed AI calls, always go through:
|
|
260
|
-
|
|
261
|
-
```ts
|
|
262
|
-
await ctx.providers.generateText({
|
|
263
|
-
provider: "openai",
|
|
264
|
-
model: "gpt-4.1-mini",
|
|
265
|
-
prompt: "...",
|
|
266
|
-
temperature: 0.7
|
|
267
|
-
});
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Why:
|
|
271
|
-
|
|
272
|
-
- it leases a compatible customer key
|
|
273
|
-
- it respects cooldown and invalidation behavior
|
|
274
|
-
- it records usage events
|
|
275
|
-
- it fits the retry model in the worker
|
|
276
|
-
|
|
277
|
-
Relevant files:
|
|
278
|
-
|
|
279
|
-
- [src/services/providers.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/services/providers.ts)
|
|
280
|
-
- [src/db.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/db.ts)
|
|
281
|
-
|
|
282
|
-
## Billing Rules
|
|
283
|
-
|
|
284
|
-
Templates should emit billable events through the framework context, not invent a separate ledger.
|
|
285
|
-
|
|
286
|
-
Use:
|
|
287
|
-
|
|
288
|
-
```ts
|
|
289
|
-
await ctx.billing.record({
|
|
290
|
-
type: "ai_generation",
|
|
291
|
-
costUsd: 0.02,
|
|
292
|
-
metadata: { provider: "openai" }
|
|
293
|
-
});
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
Current default behavior charges roughly `costUsd * 2` if `chargeUsd` is omitted.
|
|
297
|
-
|
|
298
|
-
If you add a new billable resource type, update both:
|
|
299
|
-
|
|
300
|
-
1. the domain types in `src/domain.ts`
|
|
301
|
-
2. any services or reporting code that assumes the existing event kinds
|
|
302
|
-
|
|
303
|
-
## Storage And Artifacts
|
|
304
|
-
|
|
305
|
-
Use `ctx.storage.putJson(...)` for structured intermediate outputs.
|
|
306
|
-
|
|
307
|
-
The current storage adapter supports:
|
|
308
|
-
|
|
309
|
-
- local disk for development
|
|
310
|
-
- S3-compatible object storage for hosted environments
|
|
311
|
-
|
|
312
|
-
Store large stage outputs as artifacts rather than only embedding them inside `job.result`.
|
|
313
|
-
Template-generated artifacts should be written under the logical prefix:
|
|
314
|
-
|
|
315
|
-
```txt
|
|
316
|
-
templates/:templateId/users/:userId/jobs/:jobId/...
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
Relevant files:
|
|
320
|
-
|
|
321
|
-
- [src/services/storage.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/services/storage.ts)
|
|
322
|
-
- [src/context.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/context.ts)
|
|
323
|
-
|
|
324
|
-
## Remotion Pattern
|
|
325
|
-
|
|
326
|
-
Remotion is treated as a downstream adapter, not the platform center.
|
|
327
|
-
|
|
328
|
-
Use:
|
|
329
|
-
|
|
330
|
-
```ts
|
|
331
|
-
const render = await ctx.remotion.render({
|
|
332
|
-
compositionId: "storyboard-main",
|
|
333
|
-
inputProps: {...}
|
|
334
|
-
});
|
|
335
|
-
```
|
|
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
|
|
336
154
|
|
|
337
|
-
|
|
155
|
+
## Local Workflow
|
|
338
156
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
- use [AWS_REMOTION_HANDOFF.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/AWS_REMOTION_HANDOFF.md) as source of truth
|
|
342
|
-
- target the shared `us-east-1` Remotion infra described there
|
|
343
|
-
- pin Remotion packages to `4.0.355` unless the task is explicitly shared-infra upgrade work
|
|
344
|
-
- publish a repo-specific site bundle instead of deploying a new render Lambda by default
|
|
345
|
-
- treat shared AWS site publish and cloud render validation as release-admin work, not normal developer authoring work
|
|
346
|
-
|
|
347
|
-
Important credential note:
|
|
348
|
-
|
|
349
|
-
- this repo has separate Remotion AWS credentials available in local production env config as `REMOTION_AWS_ACCESS_KEY_ID` and `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
350
|
-
- use those for Remotion site publish/render operations
|
|
351
|
-
- do not assume generic `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are the correct identity for Remotion work
|
|
352
|
-
|
|
353
|
-
Preferred env/config values for real Remotion integration:
|
|
354
|
-
|
|
355
|
-
```env
|
|
356
|
-
REMOTION_REGION=us-east-1
|
|
357
|
-
REMOTION_FUNCTION_NAME=remotion-render-4-0-355-mem2048mb-disk2048mb-180sec
|
|
358
|
-
REMOTION_BUCKET_NAME=remotionlambda-useast1-ujg7c0h43q
|
|
359
|
-
REMOTION_SITE_NAME=your-site-name
|
|
360
|
-
REMOTION_SERVE_URL=https://remotionlambda-useast1-ujg7c0h43q.s3.us-east-1.amazonaws.com/sites/your-site-name/index.html
|
|
361
|
-
REMOTION_COMPOSITION_ID=YourComposition
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
If implementing real rendering, prefer one of these patterns:
|
|
365
|
-
|
|
366
|
-
1. publish a site bundle with the shared bucket and site-name pattern from the handoff
|
|
367
|
-
2. render against the shared function name and the repo-specific `REMOTION_SERVE_URL`
|
|
368
|
-
|
|
369
|
-
Do not deploy a new Lambda function for every template unless the task explicitly requires shared infra changes.
|
|
370
|
-
|
|
371
|
-
Release sequence for Remotion-backed templates:
|
|
372
|
-
|
|
373
|
-
1. developer merges approved code into the template repo `production` branch
|
|
374
|
-
2. release admin reviews and pins a commit SHA
|
|
375
|
-
3. release admin publishes the site bundle to shared AWS
|
|
376
|
-
4. release admin verifies a cloud render against that site
|
|
377
|
-
5. release admin activates the pinned template release in the platform
|
|
378
|
-
6. release admin rebuilds and redeploys the production Docker image
|
|
379
|
-
|
|
380
|
-
## API Rules
|
|
381
|
-
|
|
382
|
-
If you need new API surface area, prefer these patterns:
|
|
383
|
-
|
|
384
|
-
- customer-facing template actions under `/templates/:templateId/*`
|
|
385
|
-
- developer or customer profile actions under `/me/*`
|
|
386
|
-
- auth under `/auth/*`
|
|
387
|
-
- documentation or debug surfaces only when justified
|
|
388
|
-
|
|
389
|
-
Do not create a separate route per stage if an operation-based route can cover it cleanly. The platform already normalizes work through:
|
|
390
|
-
|
|
391
|
-
`POST /templates/:templateId/operations/:operationName`
|
|
392
|
-
|
|
393
|
-
## Database Rules
|
|
394
|
-
|
|
395
|
-
When changing persistence:
|
|
396
|
-
|
|
397
|
-
- update schema in `src/db.ts`
|
|
398
|
-
- add mapping helpers there too
|
|
399
|
-
- keep writes idempotent where possible
|
|
400
|
-
- preserve the worker’s retry safety
|
|
401
|
-
- avoid introducing a second state store unless the user explicitly wants it
|
|
402
|
-
|
|
403
|
-
For provider-key coordination, preserve the SQLite lease model unless the task is explicitly about moving to Postgres, Redis, or SQS.
|
|
404
|
-
|
|
405
|
-
## Developer Console
|
|
406
|
-
|
|
407
|
-
The browser console lives at `/dev`.
|
|
408
|
-
|
|
409
|
-
If you add a new template or operation, consider whether `src/dev-app.ts` should also gain:
|
|
410
|
-
|
|
411
|
-
- default config JSON
|
|
412
|
-
- default payload JSON
|
|
413
|
-
- extra developer affordances for that workflow
|
|
414
|
-
|
|
415
|
-
Keep the console practical. It is for internal developers to test the platform quickly, not for polished end-user UX.
|
|
416
|
-
|
|
417
|
-
## Local Runbook
|
|
418
|
-
|
|
419
|
-
Typical local run:
|
|
420
|
-
|
|
421
|
-
```bash
|
|
422
|
-
npm install
|
|
423
|
-
PORT=3100 ENCRYPTION_SECRET=test-secret API_KEY_SALT=test-salt MOCK_PROVIDER_RESPONSES=true npm run dev
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
Open:
|
|
427
|
-
|
|
428
|
-
```txt
|
|
429
|
-
http://127.0.0.1:3100/dev
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
Use mocked provider responses by default during local development unless the task specifically requires real provider traffic.
|
|
433
|
-
|
|
434
|
-
Preferred local template developer workflow:
|
|
157
|
+
Preferred local third-party developer workflow:
|
|
435
158
|
|
|
436
159
|
```bash
|
|
437
160
|
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
@@ -439,139 +162,97 @@ npx @mevdragon/vidfarm-devcli session
|
|
|
439
162
|
npx @mevdragon/vidfarm-devcli validate-template --template-id template_0000
|
|
440
163
|
```
|
|
441
164
|
|
|
442
|
-
That CLI should be the default path
|
|
165
|
+
That CLI should be the default path because it:
|
|
443
166
|
|
|
444
|
-
- boots the
|
|
445
|
-
- provisions local
|
|
446
|
-
-
|
|
167
|
+
- boots the local API and worker
|
|
168
|
+
- provisions local state automatically
|
|
169
|
+
- creates a local developer session
|
|
447
170
|
- seeds provider keys from local env vars when present
|
|
448
|
-
-
|
|
449
|
-
- renders Remotion locally
|
|
171
|
+
- uses local Remotion rendering
|
|
450
172
|
|
|
451
|
-
|
|
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:
|
|
452
176
|
|
|
453
177
|
```bash
|
|
454
178
|
rm -rf .vidfarm/local
|
|
455
179
|
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
456
180
|
```
|
|
457
181
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
- `slides/*.png` are background images only
|
|
461
|
-
- text overlay appears in `renders/final.mp4`
|
|
462
|
-
- if text seems missing, inspect the final MP4 before assuming generation failed
|
|
463
|
-
|
|
464
|
-
If the task requires real Remotion cloud rendering, confirm these before coding:
|
|
465
|
-
|
|
466
|
-
1. the repo is using the shared function and bucket from `AWS_REMOTION_HANDOFF.md`
|
|
467
|
-
2. the Remotion package version matches `4.0.355`
|
|
468
|
-
3. the runner is using `REMOTION_AWS_ACCESS_KEY_ID` and `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
469
|
-
4. the site name is repo-specific and not reusing another repo’s published bundle unintentionally
|
|
470
|
-
|
|
471
|
-
## Validation Checklist
|
|
472
|
-
|
|
473
|
-
After changes, validate with as many of these as apply:
|
|
474
|
-
|
|
475
|
-
1. `npm run check`
|
|
476
|
-
2. `npm run build`
|
|
477
|
-
3. `npx @mevdragon/vidfarm-devcli validate-template --template-id <templateIdOrSlug>`
|
|
478
|
-
4. hit `/health`
|
|
479
|
-
5. use `/dev`
|
|
480
|
-
6. request OTP and verify login
|
|
481
|
-
7. add a provider key
|
|
482
|
-
8. save template config
|
|
483
|
-
9. launch a job
|
|
484
|
-
10. poll job status and logs
|
|
485
|
-
11. inspect produced artifacts
|
|
486
|
-
|
|
487
|
-
If the task touches GitHub-backed template releases, also validate:
|
|
488
|
-
|
|
489
|
-
1. source branch is `production`
|
|
490
|
-
2. module path points to the built template export
|
|
491
|
-
3. `SKILL.md` path is correct
|
|
492
|
-
4. import creates a release pinned to a commit SHA
|
|
493
|
-
5. only certified releases are activatable
|
|
494
|
-
|
|
495
|
-
For new template scaffolds, use the CLI instead of copy-pasting the starter repo by hand:
|
|
182
|
+
## Provider Usage
|
|
496
183
|
|
|
497
|
-
|
|
498
|
-
npx @mevdragon/vidfarm-devcli generate-template --slug-id hooks_v1 --template-dir templates/template_0007
|
|
499
|
-
```
|
|
184
|
+
Templates should prefer the Vidfarm provider abstractions already available in context.
|
|
500
185
|
|
|
501
|
-
|
|
186
|
+
Rules:
|
|
502
187
|
|
|
503
|
-
|
|
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
|
|
504
192
|
|
|
505
|
-
If
|
|
193
|
+
If a task only needs image generation, do not force extra model providers for text or research.
|
|
506
194
|
|
|
507
|
-
|
|
195
|
+
## Storage Namespaces
|
|
508
196
|
|
|
509
|
-
|
|
510
|
-
2. serve URL shape
|
|
511
|
-
3. function name
|
|
512
|
-
4. composition ID
|
|
513
|
-
5. render submission path
|
|
197
|
+
Use the built-in storage namespace conventions instead of inventing one-off key layouts.
|
|
514
198
|
|
|
515
|
-
|
|
199
|
+
Current namespaces:
|
|
516
200
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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
|
|
521
205
|
|
|
522
|
-
|
|
206
|
+
Rules:
|
|
523
207
|
|
|
524
|
-
|
|
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
|
|
525
213
|
|
|
526
|
-
|
|
527
|
-
2. add the workflow implementation under `jobs`
|
|
528
|
-
3. add sample payload defaults in `src/dev-app.ts` if useful
|
|
529
|
-
4. verify through `/dev`
|
|
214
|
+
## API Usage
|
|
530
215
|
|
|
531
|
-
|
|
216
|
+
When testing through the API, use:
|
|
532
217
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
3. test save/load through `/templates/:templateId/config`
|
|
218
|
+
- `vidfarm-user-id`
|
|
219
|
+
- `vidfarm-api-key`
|
|
536
220
|
|
|
537
|
-
|
|
221
|
+
The template-local `SKILL.md` should show the concrete routes and example payloads for that template.
|
|
538
222
|
|
|
539
|
-
|
|
540
|
-
2. record billing
|
|
541
|
-
3. log progress and persist the artifact
|
|
223
|
+
## Validation Checklist
|
|
542
224
|
|
|
543
|
-
|
|
225
|
+
After changes, validate with as many of these as apply:
|
|
544
226
|
|
|
545
|
-
1.
|
|
546
|
-
2.
|
|
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
|
|
547
235
|
|
|
548
|
-
|
|
236
|
+
If you changed slideshow or text-overlay behavior, also validate:
|
|
549
237
|
|
|
550
|
-
1.
|
|
551
|
-
2.
|
|
552
|
-
3.
|
|
553
|
-
4. point `skill_path` at the template-local `SKILL.md`
|
|
554
|
-
5. import the source to create a pinned release
|
|
555
|
-
6. activate only after certification passes
|
|
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
|
|
556
241
|
|
|
557
242
|
## What To Avoid
|
|
558
243
|
|
|
559
|
-
-
|
|
560
|
-
-
|
|
561
|
-
-
|
|
562
|
-
-
|
|
563
|
-
-
|
|
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
|
|
564
249
|
- omitting `SKILL.md` or `smokeTestPayload`
|
|
565
|
-
- coupling the platform too tightly to one render engine
|
|
566
|
-
- returning giant generated outputs only inline when they should be artifacts
|
|
567
250
|
|
|
568
251
|
## Output Style For Vidfarm Work
|
|
569
252
|
|
|
570
|
-
When reporting back after Vidfarm changes:
|
|
571
|
-
|
|
572
|
-
- name the main platform area changed
|
|
573
|
-
- mention the template or route affected
|
|
574
|
-
- state how you verified it
|
|
575
|
-
- call out any remaining gap such as `Remotion path still mocked` or `real provider calls not exercised`
|
|
253
|
+
When reporting back after Vidfarm template changes:
|
|
576
254
|
|
|
577
|
-
|
|
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
|