@mevdragon/vidfarm-devcli 0.2.12 → 0.2.13
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 +37 -1
- package/README.md +27 -183
- package/SKILL.director.md +293 -0
- package/SKILL.platform.md +312 -0
- package/auto-create-hyperframe-templates/AUTO_CREATE_HYPERFRAME_TEMPLATES.md +275 -0
- package/auto-create-hyperframe-templates/extractor-system-prompt.md +128 -0
- package/auto-create-hyperframe-templates/input-manifest.schema.json +56 -0
- package/auto-create-hyperframe-templates/lambda-memory-estimator.md +118 -0
- package/auto-create-hyperframe-templates/production-graph.schema.json +314 -0
- package/auto-create-hyperframe-templates/runbook.md +198 -0
- package/auto-create-hyperframe-templates/scripts/create-hyperframe-template.mjs +368 -0
- package/auto-create-hyperframe-templates/template-plan.schema.json +311 -0
- package/auto-create-hyperframe-templates/template-planner-prompt.md +144 -0
- package/auto-create-templates/AUTO_CREATE_TEMPLATES.md +116 -0
- package/auto-create-templates/extractor-system-prompt.md +6 -1
- package/auto-create-templates/template-plan.schema.json +73 -2
- package/auto-create-templates/template-planner-prompt.md +62 -1
- package/dist/src/account-pages-legacy.js +361 -89
- package/dist/src/account-pages-legacy.js.map +1 -0
- package/dist/src/account-pages.js +13 -3
- package/dist/src/account-pages.js.map +1 -0
- package/dist/src/app.js +7060 -946
- package/dist/src/app.js.map +1 -0
- package/dist/src/cli.js +110 -29
- package/dist/src/cli.js.map +1 -0
- package/dist/src/composition-runtime.js +581 -0
- package/dist/src/composition-runtime.js.map +1 -0
- package/dist/src/config.js +69 -11
- package/dist/src/config.js.map +1 -0
- package/dist/src/context.js +280 -21
- package/dist/src/context.js.map +1 -0
- package/dist/src/dev-app-legacy.js +18 -17
- package/dist/src/dev-app-legacy.js.map +1 -0
- package/dist/src/dev-app.js +1 -0
- package/dist/src/dev-app.js.map +1 -0
- package/dist/src/domain.js +2 -1
- package/dist/src/domain.js.map +1 -0
- package/dist/src/editor-chat-history.js +10 -0
- package/dist/src/editor-chat-history.js.map +1 -0
- package/dist/src/editor-chat.js +133 -24
- package/dist/src/editor-chat.js.map +1 -0
- package/dist/src/frontend/flockposter-cache-store.js +10 -2
- package/dist/src/frontend/flockposter-cache-store.js.map +1 -0
- package/dist/src/frontend/homepage-client.js +6 -3
- package/dist/src/frontend/homepage-client.js.map +1 -0
- package/dist/src/frontend/homepage-shared.js +1 -0
- package/dist/src/frontend/homepage-shared.js.map +1 -0
- package/dist/src/frontend/homepage-store.js +1 -0
- package/dist/src/frontend/homepage-store.js.map +1 -0
- package/dist/src/frontend/homepage-view.js +131 -18
- package/dist/src/frontend/homepage-view.js.map +1 -0
- package/dist/src/frontend/page-runtime-client.js +5 -2
- package/dist/src/frontend/page-runtime-client.js.map +1 -0
- package/dist/src/frontend/page-runtime-store.js +1 -0
- package/dist/src/frontend/page-runtime-store.js.map +1 -0
- package/dist/src/frontend/sentry.js +42 -0
- package/dist/src/frontend/sentry.js.map +1 -0
- package/dist/src/frontend/template-editor-chat.js +1719 -213
- package/dist/src/frontend/template-editor-chat.js.map +1 -0
- package/dist/src/help-page.js +333 -0
- package/dist/src/help-page.js.map +1 -0
- package/dist/src/homepage.js +169 -47
- package/dist/src/homepage.js.map +1 -0
- package/dist/src/hyperframes/composition.js +180 -0
- package/dist/src/hyperframes/composition.js.map +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/instrument.js +30 -0
- package/dist/src/instrument.js.map +1 -0
- package/dist/src/lib/crypto.js +1 -0
- package/dist/src/lib/crypto.js.map +1 -0
- package/dist/src/lib/dev-log.js +54 -0
- package/dist/src/lib/dev-log.js.map +1 -0
- package/dist/src/lib/display-name.js +11 -0
- package/dist/src/lib/display-name.js.map +1 -0
- package/dist/src/lib/ids.js +21 -1
- package/dist/src/lib/ids.js.map +1 -0
- package/dist/src/lib/images.js +1 -0
- package/dist/src/lib/images.js.map +1 -0
- package/dist/src/lib/json.js +1 -0
- package/dist/src/lib/json.js.map +1 -0
- package/dist/src/lib/template-dna.js +1 -0
- package/dist/src/lib/template-dna.js.map +1 -0
- package/dist/src/lib/template-paths.js +1 -0
- package/dist/src/lib/template-paths.js.map +1 -0
- package/dist/src/lib/template-style-options.js +29 -3
- package/dist/src/lib/template-style-options.js.map +1 -0
- package/dist/src/lib/time.js +1 -0
- package/dist/src/lib/time.js.map +1 -0
- package/dist/src/lib/video-quality-harness.js +60 -0
- package/dist/src/lib/video-quality-harness.js.map +1 -0
- package/dist/src/page-runtime.js +1 -0
- package/dist/src/page-runtime.js.map +1 -0
- package/dist/src/page-shell.js +1501 -49
- package/dist/src/page-shell.js.map +1 -0
- package/dist/src/primitive-context.js +144 -8
- package/dist/src/primitive-context.js.map +1 -0
- package/dist/src/primitive-registry.js +1919 -78
- package/dist/src/primitive-registry.js.map +1 -0
- package/dist/src/primitive-sdk.js +1 -0
- package/dist/src/primitive-sdk.js.map +1 -0
- package/dist/src/primitives/remotion/html-image.js +3 -1
- package/dist/src/primitives/remotion/html-image.js.map +1 -0
- package/dist/src/primitives/remotion/media-slideshow.js +60 -0
- package/dist/src/primitives/remotion/media-slideshow.js.map +1 -0
- package/dist/src/react-page-shell.js +1 -0
- package/dist/src/react-page-shell.js.map +1 -0
- package/dist/src/ready-post-schedule-component.js +1 -0
- package/dist/src/ready-post-schedule-component.js.map +1 -0
- package/dist/src/registry.js +237 -24
- package/dist/src/registry.js.map +1 -0
- package/dist/src/runtime.js +3 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/services/api-call-history.js +4 -0
- package/dist/src/services/api-call-history.js.map +1 -0
- package/dist/src/services/auth.js +40 -50
- package/dist/src/services/auth.js.map +1 -0
- package/dist/src/services/billing.js +20 -44
- package/dist/src/services/billing.js.map +1 -0
- package/dist/src/services/chat-threads.js +10 -6
- package/dist/src/services/chat-threads.js.map +1 -0
- package/dist/src/services/fork-access.js +94 -0
- package/dist/src/services/fork-access.js.map +1 -0
- package/dist/src/services/ghostcut.js +132 -0
- package/dist/src/services/ghostcut.js.map +1 -0
- package/dist/src/services/hyperframes.js +1014 -0
- package/dist/src/services/hyperframes.js.map +1 -0
- package/dist/src/services/job-capacity.js +14 -0
- package/dist/src/services/job-capacity.js.map +1 -0
- package/dist/src/services/job-logs.js +4 -0
- package/dist/src/services/job-logs.js.map +1 -0
- package/dist/src/services/jobs.js +99 -91
- package/dist/src/services/jobs.js.map +1 -0
- package/dist/src/services/media-processing.js +743 -0
- package/dist/src/services/media-processing.js.map +1 -0
- package/dist/src/services/primitive-media-lambda.js +280 -0
- package/dist/src/services/primitive-media-lambda.js.map +1 -0
- package/dist/src/services/providers.js +1560 -178
- package/dist/src/services/providers.js.map +1 -0
- package/dist/src/services/rate-limits.js +3 -2
- package/dist/src/services/rate-limits.js.map +1 -0
- package/dist/src/services/remotion.js +495 -92
- package/dist/src/services/remotion.js.map +1 -0
- package/dist/src/services/serverless-auth.js +374 -0
- package/dist/src/services/serverless-auth.js.map +1 -0
- package/dist/src/services/serverless-jobs.js +1074 -0
- package/dist/src/services/serverless-jobs.js.map +1 -0
- package/dist/src/services/serverless-provider-keys.js +401 -0
- package/dist/src/services/serverless-provider-keys.js.map +1 -0
- package/dist/src/services/serverless-records.js +1086 -0
- package/dist/src/services/serverless-records.js.map +1 -0
- package/dist/src/services/serverless-template-configs.js +67 -0
- package/dist/src/services/serverless-template-configs.js.map +1 -0
- package/dist/src/services/storage.js +170 -35
- package/dist/src/services/storage.js.map +1 -0
- package/dist/src/services/template-certification.js +295 -3
- package/dist/src/services/template-certification.js.map +1 -0
- package/dist/src/services/template-loader.js +45 -1
- package/dist/src/services/template-loader.js.map +1 -0
- package/dist/src/services/template-runtime-bundles.js +217 -0
- package/dist/src/services/template-runtime-bundles.js.map +1 -0
- package/dist/src/services/template-sources.js +452 -87
- package/dist/src/services/template-sources.js.map +1 -0
- package/dist/src/services/video-normalization.js +2 -0
- package/dist/src/services/video-normalization.js.map +1 -0
- package/dist/src/services/webhooks.js +7 -6
- package/dist/src/services/webhooks.js.map +1 -0
- package/dist/src/template-editor-pages.js +5637 -1322
- package/dist/src/template-editor-pages.js.map +1 -0
- package/dist/src/template-editor-shell.js +1376 -170
- package/dist/src/template-editor-shell.js.map +1 -0
- package/dist/src/template-sdk.js +1 -0
- package/dist/src/template-sdk.js.map +1 -0
- package/dist/src/worker.js +11 -226
- package/dist/src/worker.js.map +1 -0
- package/package.json +47 -12
- package/public/assets/homepage-client-app.js +34 -8
- package/public/assets/page-runtime-client-app.js +44 -18
- package/readme.secret.md +89 -0
- package/templates/vidfarm_template_0000/README.md +106 -0
- package/templates/vidfarm_template_0000/SKILL.md +266 -0
- package/templates/vidfarm_template_0000/assets/Abel-Regular.ttf +0 -0
- package/templates/vidfarm_template_0000/assets/DMSerifDisplay-Regular.ttf +0 -0
- package/templates/vidfarm_template_0000/assets/Montserrat[wght].ttf +0 -0
- package/templates/vidfarm_template_0000/assets/SourceCodePro[wght].ttf +0 -0
- package/templates/vidfarm_template_0000/assets/TikTokSans-SemiBold.ttf +0 -0
- package/templates/vidfarm_template_0000/assets/Yesteryear-Regular.ttf +0 -0
- package/templates/vidfarm_template_0000/composition.json +11 -0
- package/templates/vidfarm_template_0000/src/lib/images.js +221 -0
- package/templates/vidfarm_template_0000/src/remotion/Root.js +33 -0
- package/templates/vidfarm_template_0000/src/remotion/index.js +3 -0
- package/templates/vidfarm_template_0000/src/sdk.js +3 -0
- package/templates/vidfarm_template_0000/src/style-options.js +200 -0
- package/templates/vidfarm_template_0000/src/template-dna.js +9 -0
- package/templates/vidfarm_template_0000/src/template.js +1566 -0
- package/templates/vidfarm_template_0000/template.config.json +21 -0
- package/GETTING_STARTED.developers.md +0 -87
- package/SKILL.developer.md +0 -1186
- package/dist/src/db.js +0 -2007
package/SKILL.developer.md
DELETED
|
@@ -1,1186 +0,0 @@
|
|
|
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 AI agents and developers authoring Vidfarm templates locally.
|
|
9
|
-
|
|
10
|
-
Primary goal:
|
|
11
|
-
|
|
12
|
-
- make "here is a media file, turn this into a reusable template" a complete, executable workflow
|
|
13
|
-
|
|
14
|
-
Use this skill for:
|
|
15
|
-
|
|
16
|
-
- creating a new template under `templates/*`
|
|
17
|
-
- extending an existing template under `templates/*`
|
|
18
|
-
- revising a template from natural-language feedback
|
|
19
|
-
- analyzing source media into `viral_dna` and `visual_dna`
|
|
20
|
-
- wiring prompts, operations, jobs, and local Remotion output
|
|
21
|
-
- validating the template through the local CLI and REST API
|
|
22
|
-
|
|
23
|
-
Do not use this skill for:
|
|
24
|
-
|
|
25
|
-
- platform auth, billing, database, or webhook internals
|
|
26
|
-
- production deploys, release admin, or shared cloud infrastructure
|
|
27
|
-
- asking for AWS, S3, Remotion cloud, or other platform secrets
|
|
28
|
-
|
|
29
|
-
## Hosted Remotion Cost Reporting
|
|
30
|
-
|
|
31
|
-
When a template runs a hosted Remotion Lambda render, template code should report the base render cost back to platform billing.
|
|
32
|
-
|
|
33
|
-
Use the template job context billing helper:
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
await ctx.billing.record({
|
|
37
|
-
type: "render",
|
|
38
|
-
costUsd: 0.35,
|
|
39
|
-
costCenterSlug: "remotion_lambda",
|
|
40
|
-
idempotencyKey: `remotion_lambda:${render.renderId}`,
|
|
41
|
-
occurredAtMs: Date.now(),
|
|
42
|
-
metadata: {
|
|
43
|
-
render_id: render.renderId,
|
|
44
|
-
...render.metadata
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Rules:
|
|
50
|
-
|
|
51
|
-
- only report the raw base Remotion cost in `costUsd`
|
|
52
|
-
- always use `costCenterSlug: "remotion_lambda"` for hosted Remotion Lambda usage
|
|
53
|
-
- always provide a stable `idempotencyKey`, typically derived from `render.renderId`
|
|
54
|
-
- include useful diagnostics in `metadata`, such as `render_id`, composition ID, mode, and output details
|
|
55
|
-
- do not compute customer wallet debits in template code
|
|
56
|
-
- do not set platform pricing policy in template code
|
|
57
|
-
|
|
58
|
-
The platform billing service applies wallet mutations and pricing centrally. The default customer charge currently uses an approximately `20%` safety-buffer markup over reported base cost.
|
|
59
|
-
|
|
60
|
-
Job-status billing response fields are also platform-managed. Template developers do not need to shape the API response; they only need to keep reporting real usage through existing helpers where applicable. The customer-facing job response exposes `billing.consumed_usd` and does not expose internal `base_cost_usd`.
|
|
61
|
-
|
|
62
|
-
## Third-Party Publish Rule
|
|
63
|
-
|
|
64
|
-
Third-party template developers publish template code by pushing git commits to GitHub. That is the only code-distribution step they own.
|
|
65
|
-
|
|
66
|
-
Default hosted update rule:
|
|
67
|
-
|
|
68
|
-
- for an already-registered template, the default hosted handoff is `publish-update-hosted --commit-sha <sha>`
|
|
69
|
-
- do not default to prod-side branch-head import for normal template updates
|
|
70
|
-
- if the source repo is private, treat artifact publish as the normal path, not as a fallback
|
|
71
|
-
- if `gh` is available, prefer an authenticated local clone such as `gh repo clone <owner>/<repo>` before publishing a hosted update
|
|
72
|
-
- checked-in `about/preview-*` files only become live hosted preview media after platform import and activation sync them into `templates/:template_id/about/*`
|
|
73
|
-
|
|
74
|
-
Important nuance:
|
|
75
|
-
|
|
76
|
-
- GitHub is relevant for the hosted handoff, not for normal local template authoring
|
|
77
|
-
- do not make GitHub setup or GitHub debugging a blocker for local template creation, testing, iteration, or validation
|
|
78
|
-
- if the user is only building or revising a template locally, they should not need to worry about GitHub at all
|
|
79
|
-
|
|
80
|
-
The third-party developer responsibility is:
|
|
81
|
-
|
|
82
|
-
- build and validate the template locally
|
|
83
|
-
- commit and push the template folder to GitHub
|
|
84
|
-
- register or update the hosted template source metadata with `register-source-hosted` so Vidfarm knows which repo, branch, and template folder to import from
|
|
85
|
-
- for an already-registered template update, publish the exact GitHub commit SHA with `publish-update-hosted`
|
|
86
|
-
- stop there and hand off to the platform team
|
|
87
|
-
|
|
88
|
-
Preferred private-repo publish pattern:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
gh repo clone mevdragon/vidfarm_templates ./vidfarm_templates
|
|
92
|
-
git -C ./vidfarm_templates rev-parse HEAD
|
|
93
|
-
node dist/src/cli.js publish-update-hosted \
|
|
94
|
-
--env-file .env \
|
|
95
|
-
--repo-dir ./vidfarm_templates \
|
|
96
|
-
--template-id <template-id> \
|
|
97
|
-
--slug-id <template-slug> \
|
|
98
|
-
--repo-url https://github.com/mevdragon/vidfarm_templates.git \
|
|
99
|
-
--branch main \
|
|
100
|
-
--template-module-path src/<template-folder>/src/template.ts \
|
|
101
|
-
--skill-path src/<template-folder>/SKILL.md \
|
|
102
|
-
--install-command "npm install --prefix src/<template-folder>" \
|
|
103
|
-
--build-command "npm run build --prefix src/<template-folder>" \
|
|
104
|
-
--commit-sha <exact-github-commit>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
The third-party developer should not:
|
|
108
|
-
|
|
109
|
-
- run `import-source-prod`
|
|
110
|
-
- use AWS CloudFormation, SSM, EC2, or shared prod credentials
|
|
111
|
-
- treat platform import/activation as part of template authoring
|
|
112
|
-
- assume "make this template public/live" is their duty
|
|
113
|
-
|
|
114
|
-
`import-source-prod` and `deploy-template-cycle` are platform-operator commands. They are for internal admin flow, not for external template authors.
|
|
115
|
-
|
|
116
|
-
Private repo rule:
|
|
117
|
-
|
|
118
|
-
- if the registered source repo is private, do not treat prod-side `git ls-remote` or raw GitHub import as the primary publish mechanism
|
|
119
|
-
- for private repos, the reliable default is: authenticated local clone -> `publish-update-hosted --commit-sha ...` -> platform review -> admin approve/activate
|
|
120
|
-
- if the registered source repo is private, assume the intended hosted setup is that Vidfarm has already been granted access to it
|
|
121
|
-
- when repo sharing is needed, the repo should be shared with GitHub username `mevdragon`
|
|
122
|
-
- do not treat a private repo itself as a problem if that access assumption is already stated
|
|
123
|
-
|
|
124
|
-
For third-party developers, Remotion is local and storage should be accessed through Vidfarm helpers. Do not require cloud Remotion setup or hand-written S3 integration for normal template work.
|
|
125
|
-
|
|
126
|
-
## Media Storage Boundary
|
|
127
|
-
|
|
128
|
-
Template job results must keep binary media out of JSON. If a workflow produces, fetches, or accepts image/audio/video bytes, write those bytes through `ctx.storage.putBuffer(...)` and put the returned URL in the job output, manifest, and render inputs.
|
|
129
|
-
|
|
130
|
-
Rules:
|
|
131
|
-
|
|
132
|
-
- use `ctx.storage.putBuffer(...)`, `ctx.storage.putJson(...)`, and `ctx.storage.putText(...)` for artifacts
|
|
133
|
-
- return artifact URLs in fields like `imageUrl`, `thumbnailUrl`, `audioUrl`, `videoUrl`, `files`, `manifest`, and render input objects
|
|
134
|
-
- do not persist `data:image/...;base64,...`, raw base64 strings, Buffers, or large inline SVG/image strings in `result.output`
|
|
135
|
-
- accepting a `data:image/*` input is allowed, but decode it and store it as an artifact before including it in any durable output
|
|
136
|
-
- generated provider media should be stored immediately; never use `Buffer.from(bytes).toString("base64")` as a durable result value
|
|
137
|
-
- Remotion render props may reference artifact URLs; use short-lived inline data only inside a private render helper if it is not returned, logged, or written to a manifest
|
|
138
|
-
- keep manifests lightweight enough to inspect in job history and webhooks; they should describe artifacts by URL, not embed artifact bytes
|
|
139
|
-
|
|
140
|
-
This boundary matters because job results are saved in SQLite, returned by REST APIs, included in webhooks, and surfaced in editor history. Embedding base64 media can turn one small job result into multi-megabyte JSON and break UI history views.
|
|
141
|
-
|
|
142
|
-
## Agent Operating Rule
|
|
143
|
-
|
|
144
|
-
If the user gives you a media file, a screenshot, a folder of source assets, or a link to an original viral post and says some variant of "turn this into a template", you should default to this workflow:
|
|
145
|
-
|
|
146
|
-
1. inspect the source media and extract the repeatable format
|
|
147
|
-
2. start the native harness workflow with `vidfarm-devcli autocreate-template <input_path> <output_path>`
|
|
148
|
-
3. review the generated run folder, manifest, and `agent_prompt.md`
|
|
149
|
-
4. generate the preservation decision, production graph, and template plan
|
|
150
|
-
5. run or consume `analyze-viral-dna` and `analyze-visual-dna`
|
|
151
|
-
6. implement the template operations and jobs
|
|
152
|
-
7. wire prompt logic, provider usage, storage writes, and local Remotion output
|
|
153
|
-
8. expose the template through the standard REST routes
|
|
154
|
-
9. validate the template locally with `validate-template` plus at least one real job run
|
|
155
|
-
10. update the template-local `SKILL.md` so future agents can operate it
|
|
156
|
-
|
|
157
|
-
Use `generate-template` directly only when the developer already knows the template architecture and wants a plain starter scaffold. Use `autocreate-template` when source media needs to be analyzed into a reusable format.
|
|
158
|
-
|
|
159
|
-
Do not stop after scaffolding. The expected outcome is a runnable template, not just a folder.
|
|
160
|
-
|
|
161
|
-
If the user gives revision feedback in natural language, treat that as a normal template-authoring input, not as a vague suggestion. Example revision prompts:
|
|
162
|
-
|
|
163
|
-
- "make the hook feel more curiosity-driven"
|
|
164
|
-
- "the captions are too low and get covered by TikTok UI"
|
|
165
|
-
- "preserve the exact composition from frame 3"
|
|
166
|
-
- "the pacing is too slow"
|
|
167
|
-
- "make this work for product screenshots instead of faces"
|
|
168
|
-
|
|
169
|
-
Your job is to translate that feedback into concrete template changes, rerun validation, and keep iterating until the template is reliable enough to reuse.
|
|
170
|
-
|
|
171
|
-
## Minimum Inputs
|
|
172
|
-
|
|
173
|
-
You can start from any of these:
|
|
174
|
-
|
|
175
|
-
- one image file
|
|
176
|
-
- one video file
|
|
177
|
-
- multiple screenshots or clips in a folder
|
|
178
|
-
- a URL to the original post
|
|
179
|
-
- a short written explanation of the format
|
|
180
|
-
- a natural-language revision request against an existing template
|
|
181
|
-
|
|
182
|
-
When creating a brand-new template, prefer staging raw inspiration material in a repo-local `drafts/` folder first. This gives the developer one obvious place to drag in source media and rough notes before asking an agent to build the template.
|
|
183
|
-
|
|
184
|
-
Recommended intake layout:
|
|
185
|
-
|
|
186
|
-
- `drafts/source_notes.md` for rough notes, links, and adaptation goals
|
|
187
|
-
- `drafts/preview/` for raw screenshots, clips, frames, or other inspiration media
|
|
188
|
-
|
|
189
|
-
If the developer already has files elsewhere in the repo, relative paths are still fine. But when the user says some variant of "use the files in `drafts/` to make a template", treat that as the default starting point.
|
|
190
|
-
|
|
191
|
-
If the source is weak, still scaffold the template and create `research/source_notes.md` with the missing questions called out. Do not block template creation on perfect research.
|
|
192
|
-
|
|
193
|
-
## Required Developer Env
|
|
194
|
-
|
|
195
|
-
Typical `.env`:
|
|
196
|
-
|
|
197
|
-
```env
|
|
198
|
-
GEMINI_API_KEY=""
|
|
199
|
-
OPENAI_API_KEY=""
|
|
200
|
-
OPENROUTER_API_KEY=""
|
|
201
|
-
PERPLEXITY_API_KEY=""
|
|
202
|
-
|
|
203
|
-
VIDFARM_API_KEY=""
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Notes:
|
|
207
|
-
|
|
208
|
-
- at least one runtime AI provider key is usually enough
|
|
209
|
-
- `GEMINI_API_KEY` is the key used by the built-in DNA analysis commands
|
|
210
|
-
- `VIDFARM_API_KEY` is needed when calling a hosted Vidfarm API directly, including when minting presigned preview-media uploads through `vidfarm-devcli presign-preview-media`
|
|
211
|
-
- `VIDFARM_API_KEY` is also what `vidfarm-devcli register-source-hosted` and `vidfarm-devcli publish-update-hosted` use for hosted handoff
|
|
212
|
-
- local `vidfarm-devcli session` already gives you a seeded local API key for the local runtime
|
|
213
|
-
- when calling the hosted API directly, include both `vidfarm-user-id` and `vidfarm-api-key` headers
|
|
214
|
-
- for local `vidfarm-devcli` sessions, you usually do not need to supply `VIDFARM_USER_ID` manually
|
|
215
|
-
- template authoring is TypeScript-first; create and edit template source as `src/template.ts`, not `src/template.js`
|
|
216
|
-
- keep exploratory scripts, one-off test runners, scratch validation files, and temporary job-driving code out of `src/`; place them in a repo-local tmp folder that is a sibling to `src` instead, for example `templates/vidfarm_template_0007/tmp/`
|
|
217
|
-
- when registering a hosted template source, set `template_module_path` to the repo-relative TypeScript entrypoint inside the template folder, for example `templates/vidfarm_template_example/src/template.ts`; the platform build/import flow resolves the compiled `src/template.js` sibling after `npm run build`
|
|
218
|
-
- hosted template registration is git metadata only: repo URL, branch, and template entrypoint path
|
|
219
|
-
- if a template moves folders or switches branches, update the registration metadata; if the template code changed but the location stayed the same, just push a new Git commit
|
|
220
|
-
- for an already-registered template, submit the exact commit you want reviewed with `publish-update-hosted --commit-sha <sha>`; that command packages the commit locally and uploads a review artifact to platform-controlled S3
|
|
221
|
-
- a local shell GitHub auth failure does not prove the hosted Vidfarm platform lacks repo access
|
|
222
|
-
- if `git ls-remote` fails locally, interpret that as local credential state unless the hosted import flow itself reports a GitHub access error
|
|
223
|
-
- do not ask for platform secrets like `ENCRYPTION_SECRET`, `API_KEY_SALT`, `WEBHOOK_SECRET`, admin emails, S3 config, or generic AWS credentials
|
|
224
|
-
- do not ask for `REMOTION_AWS_ACCESS_KEY_ID` or `REMOTION_AWS_SECRET_ACCESS_KEY`
|
|
225
|
-
|
|
226
|
-
Current first-class speech model allowlists in the platform runtime:
|
|
227
|
-
|
|
228
|
-
- text-to-speech
|
|
229
|
-
- `openrouter`: `google/gemini-3.1-flash-tts-preview`
|
|
230
|
-
- `gemini`: `gemini-3.1-flash-tts-preview`
|
|
231
|
-
- `openai`: `gpt-4o-mini-tts-2025-12-15`
|
|
232
|
-
|
|
233
|
-
- speech-to-text
|
|
234
|
-
- `openrouter`: `openai/gpt-4o-mini-transcribe`
|
|
235
|
-
- `gemini`: `gemini-3.1-flash-lite-preview`, `gemini-2.5-flash-lite`
|
|
236
|
-
- `openai`: `gpt-4o-mini-transcribe-2025-12-15`
|
|
237
|
-
|
|
238
|
-
## Hosted Registration Flow
|
|
239
|
-
|
|
240
|
-
For a third-party developer, the hosted publish handoff is:
|
|
241
|
-
|
|
242
|
-
1. push the repo changes that contain the target template folder
|
|
243
|
-
2. register the source location if it is new, or update the existing registration if the repo, branch, or template path changed
|
|
244
|
-
3. if the template is already registered and the location did not change, publish the exact GitHub commit SHA with `publish-update-hosted`; that command uploads a signed artifact for that commit
|
|
245
|
-
4. stop there, then tell the platform operator which commit was submitted if they ask
|
|
246
|
-
|
|
247
|
-
If the repo is private or prod-side GitHub access is uncertain, use the exact same `publish-update-hosted` flow anyway. It packages the commit locally and avoids relying on hosted `git ls-remote` or hosted branch-head import as the update path.
|
|
248
|
-
|
|
249
|
-
Registration data should be treated like this:
|
|
250
|
-
|
|
251
|
-
- `repo_url`: the GitHub repo that contains the template code
|
|
252
|
-
- `branch`: the branch Vidfarm should watch for the latest version, usually `main`
|
|
253
|
-
- `template_module_path`: the repo-relative path to the template TypeScript entrypoint, for example `src/vidfarm_template_funnychat/src/template.ts`
|
|
254
|
-
- `install_command`: the exact command that installs dependencies for the registered template source
|
|
255
|
-
- `build_command`: the exact command that leaves the compiled JavaScript entrypoint beside the declared TypeScript entrypoint, or `:` when the compiled `.js` files are already committed and no build step is needed
|
|
256
|
-
- `commit_sha`: for developer publish flow, the exact GitHub commit to package locally and submit for review on an already-registered source
|
|
257
|
-
|
|
258
|
-
Registration command rule:
|
|
259
|
-
|
|
260
|
-
- do not guess `install_command` and `build_command`
|
|
261
|
-
- for a standalone template repo rooted at the template itself, root-level commands like `npm install` and `npm run build` are usually correct
|
|
262
|
-
- for a multi-template repo, the commands must match the registered template folder, usually with `--prefix <template-folder>`
|
|
263
|
-
- if the declared `template_module_path` is `src/vidfarm_template_chadvirgin/src/template.ts`, then a typical install command is `npm install --prefix src/vidfarm_template_chadvirgin`
|
|
264
|
-
- if that template folder already commits `src/template.js`, a typical build command is `:`
|
|
265
|
-
- if that template folder requires compilation, a typical build command is `npm run build --prefix src/vidfarm_template_chadvirgin`
|
|
266
|
-
- a broken `build_command` will block hosted import even if the source registration itself succeeded
|
|
267
|
-
- before telling a user to register or update hosted source metadata, inspect the repo's actual `package.json` files and choose commands that match the template's real location
|
|
268
|
-
|
|
269
|
-
Do not tell third-party developers to run AWS-backed operator commands just to publish template code. If the task is only "make my updated template available to Vidfarm", the correct answer is GitHub push plus source registration metadata for new sources, or GitHub push plus `publish-update-hosted --commit-sha ...` for existing sources.
|
|
270
|
-
|
|
271
|
-
When reasoning about hosted visibility:
|
|
272
|
-
|
|
273
|
-
- the required developer-side outcome is that the intended commit is pushed to the registered branch
|
|
274
|
-
- do not infer hosted GitHub access failure from a local CLI auth error
|
|
275
|
-
- for hosted template updates, the review artifact is uploaded from the developer machine and prod later imports it from S3, so server-side GitHub access is not part of the normal publish path
|
|
276
|
-
- if prod-side import fails on `git ls-remote`, GitHub username/password prompts, or private-repo access, the correct fix is usually to publish the exact commit as an artifact from a locally authenticated checkout, not to keep retrying branch-head import
|
|
277
|
-
|
|
278
|
-
If a developer can register a source but receives `403 Admin access required` when trying to import or activate it, that is the expected boundary, not a blocker they are supposed to solve. It means the handoff point was reached correctly.
|
|
279
|
-
|
|
280
|
-
Hosted registration should use `register-source-hosted`, not a local DB-backed command. That command calls the Vidfarm REST API so the source appears in the production review queue with `pending_review` status.
|
|
281
|
-
|
|
282
|
-
For updates to an already-registered template, use `publish-update-hosted` so the exact GitHub commit is packaged locally, uploaded as a signed artifact, and enters review as a pending release without granting approval or activation rights.
|
|
283
|
-
|
|
284
|
-
## Template Deploy Cycle
|
|
285
|
-
|
|
286
|
-
If the user explicitly says "template deploy cycle", interpret that as the internal platform-operator sequence:
|
|
287
|
-
|
|
288
|
-
1. import that template commit into the hosted platform as a template source release
|
|
289
|
-
2. approve and activate the new release
|
|
290
|
-
3. run the prod deploy script if platform code changed, or reuse the current prod image for a formal restart if the change was template-only
|
|
291
|
-
|
|
292
|
-
Operator preference rule:
|
|
293
|
-
|
|
294
|
-
- if a pending artifact-backed release already exists for the intended commit, prefer approving and activating that release instead of asking prod to resolve branch head from GitHub
|
|
295
|
-
- activation is the step that syncs checked-in template `about/` preview assets into hosted storage under `templates/:template_id/about/*`
|
|
296
|
-
- if a hosted template exists in the catalog but its preview media redirects to missing S3 keys, re-activating the intended release on a platform build that contains the sync logic is the correct fix
|
|
297
|
-
|
|
298
|
-
Do not assume "template deploy cycle" means "deploy the entire dirty root repo". If the root worktree has unrelated changes and the release is template-only, prefer reusing the current prod image with:
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
scripts/deploy-prod-inplace.sh --image-uri <current-prod-image> --skip-check --skip-build
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## First Read
|
|
305
|
-
|
|
306
|
-
Read these files first when doing template work:
|
|
307
|
-
|
|
308
|
-
1. [GETTING_STARTED.developers.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/GETTING_STARTED.developers.md)
|
|
309
|
-
2. [README.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/README.md)
|
|
310
|
-
3. [templates/vidfarm_template_0000/SKILL.md](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/vidfarm_template_0000/SKILL.md)
|
|
311
|
-
4. [templates/vidfarm_template_0000/src/template.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/vidfarm_template_0000/src/template.ts)
|
|
312
|
-
5. [src/template-sdk.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/template-sdk.ts)
|
|
313
|
-
6. [src/cli.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/src/cli.ts)
|
|
314
|
-
|
|
315
|
-
If the task is narrow, read only the template files and CLI slice relevant to that task.
|
|
316
|
-
|
|
317
|
-
## Mental Model
|
|
318
|
-
|
|
319
|
-
A Vidfarm template is a local module loaded by the platform. Work at the template layer, not the platform layer.
|
|
320
|
-
|
|
321
|
-
The contract is:
|
|
322
|
-
|
|
323
|
-
- `defineTemplate({...})` declares the public template
|
|
324
|
-
- `operations` define the public async API surface
|
|
325
|
-
- `jobs` implement the actual work
|
|
326
|
-
- `configSchema` defines editable per-user template config
|
|
327
|
-
- `about.viral_dna` and `about.visual_dna` explain why the format wins
|
|
328
|
-
- `about.proposal_generator` tells directors and agents how to turn product/about context into template-native post ideas
|
|
329
|
-
- `about.skeleton_prompt` gives directors and agents a fill-in-the-blanks prompt scaffold for the template
|
|
330
|
-
- `about.sample_prompts` shows future users and agents how to prompt the template well
|
|
331
|
-
- `SKILL.md` teaches humans and agents how to call the template correctly
|
|
332
|
-
- the canonical template entrypoint is `src/template.ts`
|
|
333
|
-
|
|
334
|
-
The platform-owned helper surface on `ctx.providers` currently includes:
|
|
335
|
-
|
|
336
|
-
- `generateText(...)`
|
|
337
|
-
- `generateImage(...)`
|
|
338
|
-
- `analyzeImageLayout(...)`
|
|
339
|
-
- `generateSpeech(...)`
|
|
340
|
-
- `transcribeSpeech(...)`
|
|
341
|
-
|
|
342
|
-
Every public template action should remain async and job-based. Prefer one or more named operations behind `POST /api/v1/templates/:templateId/operations/:operationName` instead of inventing custom synchronous endpoints.
|
|
343
|
-
|
|
344
|
-
Keep operation design reasonably coarse-grained. These routes are customer-facing, usage-limited API calls, so avoid exploding one user action into a large number of tiny operations unless the workflow genuinely needs that split.
|
|
345
|
-
|
|
346
|
-
Vidfarm already has native queueing for template jobs. When a task needs multiple runs, do not invent a custom batch manager, worker pool, queue coordinator, or other fancy orchestration layer in the template or in temporary validation code. The default pattern is:
|
|
347
|
-
|
|
348
|
-
- submit jobs in a reasonable loop
|
|
349
|
-
- record the returned job IDs
|
|
350
|
-
- poll those jobs through the standard job endpoints
|
|
351
|
-
- if completion will take a while, tell the user to check back later instead of overengineering lifecycle control
|
|
352
|
-
|
|
353
|
-
Use extra job-management code only when the user explicitly asks for it and there is a concrete platform requirement that the built-in queue cannot satisfy.
|
|
354
|
-
|
|
355
|
-
Templates are expected to evolve through multiple revisions. One-shot generation is not the standard. The standard is:
|
|
356
|
-
|
|
357
|
-
- create a working first pass
|
|
358
|
-
- gather feedback in plain English
|
|
359
|
-
- modify the template
|
|
360
|
-
- re-run the job
|
|
361
|
-
- repeat until output is dependable
|
|
362
|
-
|
|
363
|
-
## Provider And Model Dependency Rule
|
|
364
|
-
|
|
365
|
-
The current template standard does not have a first-class `dependencies`, `requirements`, or `supportedModels` field in `defineTemplate({...})`.
|
|
366
|
-
|
|
367
|
-
Until the standard grows one, agents should document AI dependencies in two places for every template that uses external models:
|
|
368
|
-
|
|
369
|
-
1. in the template-local `SKILL.md`
|
|
370
|
-
2. near the top of `src/template.ts` as a checked-in constant or clearly named comment block
|
|
371
|
-
|
|
372
|
-
That documentation should describe:
|
|
373
|
-
|
|
374
|
-
- supported provider names
|
|
375
|
-
- allowed model IDs per provider
|
|
376
|
-
- which capability each model is intended for, such as `text`, `image`, `layout_analysis`, `tts`, `stt`, or `video`
|
|
377
|
-
- whether the list is strict, preferred, or just known-good defaults
|
|
378
|
-
- any runtime caveats, especially when a provider is only partially supported by the current platform adapter
|
|
379
|
-
|
|
380
|
-
Use this shape as the current documentation convention:
|
|
381
|
-
|
|
382
|
-
```ts
|
|
383
|
-
const TEMPLATE_PROVIDER_REQUIREMENTS = {
|
|
384
|
-
text: [
|
|
385
|
-
{ provider: "openai", models: ["gpt-5.4"], strict: false },
|
|
386
|
-
{ provider: "gemini", models: ["gemini-3.1-flash-lite", "gemini-2.5-flash-lite"], strict: false },
|
|
387
|
-
{ provider: "openrouter", models: ["qwen/qwen3.6-flash"], strict: false }
|
|
388
|
-
],
|
|
389
|
-
image: [
|
|
390
|
-
{ provider: "openai", models: ["gpt-image-1", "gpt-image-2"], strict: false },
|
|
391
|
-
{ provider: "gemini", models: ["gemini-3.1-flash-image-preview", "gemini-2.5-flash-image"], strict: false },
|
|
392
|
-
{ provider: "openrouter", models: ["bytedance/seedance-2.0", "bytedance-seed/seedream-4.5"], strict: false }
|
|
393
|
-
],
|
|
394
|
-
video: [
|
|
395
|
-
{ provider: "openai", models: ["sora-2"], strict: false },
|
|
396
|
-
{ provider: "gemini", models: ["veo-3.0-generate-001"], strict: false }
|
|
397
|
-
]
|
|
398
|
-
} as const;
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
Recommended baseline model set, matching the current repo examples unless a template has a specific reason to differ:
|
|
402
|
-
|
|
403
|
-
```ts
|
|
404
|
-
const TEMPLATE_PROVIDER_RECOMMENDATIONS = {
|
|
405
|
-
text: {
|
|
406
|
-
openai: "gpt-5.4",
|
|
407
|
-
gemini: "gemini-3.1-flash-lite",
|
|
408
|
-
openrouter: "qwen/qwen3.6-flash"
|
|
409
|
-
},
|
|
410
|
-
layout_analysis: {
|
|
411
|
-
openai: "gpt-5.4",
|
|
412
|
-
gemini: "gemini-3.1-flash-lite",
|
|
413
|
-
openrouter: "qwen/qwen3.6-flash"
|
|
414
|
-
},
|
|
415
|
-
image: {
|
|
416
|
-
openai: "gpt-image-1",
|
|
417
|
-
gemini: "gemini-3.1-flash-image-preview",
|
|
418
|
-
openrouter: "google/gemini-3.1-flash-image-preview"
|
|
419
|
-
},
|
|
420
|
-
video: {
|
|
421
|
-
openai: "sora-2",
|
|
422
|
-
gemini: "veo-3.0-generate-001"
|
|
423
|
-
},
|
|
424
|
-
tts: {
|
|
425
|
-
openai: "gpt-4o-mini-tts-2025-12-15",
|
|
426
|
-
gemini: "gemini-3.1-flash-tts-preview",
|
|
427
|
-
openrouter: "google/gemini-3.1-flash-tts-preview"
|
|
428
|
-
},
|
|
429
|
-
stt: {
|
|
430
|
-
openai: "gpt-4o-mini-transcribe-2025-12-15",
|
|
431
|
-
gemini: "gemini-3.1-flash-lite-preview",
|
|
432
|
-
openrouter: "openai/gpt-4o-mini-transcribe"
|
|
433
|
-
}
|
|
434
|
-
} as const;
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
Important:
|
|
438
|
-
|
|
439
|
-
- this is documentation for humans and agents, not a framework-consumed schema field
|
|
440
|
-
- do not pretend a provider/model pair is supported if the runtime adapter does not actually implement that path yet
|
|
441
|
-
- if the runtime only supports a subset, mark the rest as planned or aspirational in `SKILL.md`
|
|
442
|
-
- when a template depends on reference-image attachments, call out whether that currently works for all providers or only some of them
|
|
443
|
-
|
|
444
|
-
## Golden Path: Media To Template
|
|
445
|
-
|
|
446
|
-
Use this flow whenever the task is "make a new template from this source".
|
|
447
|
-
|
|
448
|
-
### 1. Stage raw inspiration in `drafts/`
|
|
449
|
-
|
|
450
|
-
Before scaffolding, encourage the developer to place source material in a repo-local `drafts/` folder.
|
|
451
|
-
|
|
452
|
-
Suggested layout:
|
|
453
|
-
|
|
454
|
-
```txt
|
|
455
|
-
drafts/
|
|
456
|
-
source_notes.md
|
|
457
|
-
preview/
|
|
458
|
-
screenshot-01.png
|
|
459
|
-
clip-01.mp4
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
This is the preferred handoff shape for agent-driven template creation. A Vidfarm developer should be able to drag media into `drafts/preview/`, add rough notes to `drafts/source_notes.md`, then tell the agent to create a template from those relative paths.
|
|
463
|
-
|
|
464
|
-
If the source media is not already present in the repo, upload it into the authenticated developer storage namespace first instead of inventing ad hoc external hosting. An agent can take a developer-provided local file path and run this directly:
|
|
465
|
-
|
|
466
|
-
```bash
|
|
467
|
-
npx @mevdragon/vidfarm-devcli presign-preview-media \
|
|
468
|
-
--file ./local/path/to/screenshot-01.png \
|
|
469
|
-
--directory drafts/preview
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
That command calls the hosted Vidfarm API with the user's `VIDFARM_API_KEY`, mints a presigned PUT URL scoped under `developer/<user_id>/*`, stores each uploaded file under a UUID path segment while preserving the original filename, uploads the file automatically when `--file` is provided, and returns both the `storage_key` and a public-read `preview_media_url`. Public readability for `developer/<user_id>/*` comes from Vidfarm bucket policy, not from public write access, so objects may be read directly by URL but should not be treated as listable or writable without authenticated API access. Agents should prefer that path for hosted preview uploads whenever the input is a local media file path, and should paste the returned absolute `preview_media_url` directly into `about.preview_media` when the template needs to work immediately in the hosted catalog.
|
|
473
|
-
|
|
474
|
-
Do not assume a checked-in repo asset like `about/preview-01.png` already exists at `templates/:template_id/about/*` in hosted S3. That stable template namespace is populated by the platform import and activation flow, not by the developer presign command. Before admin import/activation, the immediately valid hosted preview URL is the returned `developer/<user_id>/*` public URL.
|
|
475
|
-
|
|
476
|
-
### 2. Start local runtime
|
|
477
|
-
|
|
478
|
-
```bash
|
|
479
|
-
npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
|
|
480
|
-
npx @mevdragon/vidfarm-devcli session
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
This boots the local API, worker, SQLite state, provider-key seeding, and local Remotion rendering.
|
|
484
|
-
|
|
485
|
-
### 3. Choose a new template slug and folder
|
|
486
|
-
|
|
487
|
-
Use a folder name that starts with `vidfarm_template_`, such as `templates/vidfarm_template_<nnnn>/`.
|
|
488
|
-
|
|
489
|
-
Keep the identifiers separate:
|
|
490
|
-
|
|
491
|
-
- the folder / package name should keep the `vidfarm_template_` prefix
|
|
492
|
-
- the `slugId` should stay clean and human-meaningful, for example `ugc_hooks_v1`
|
|
493
|
-
- `about.title` is the user-facing display title and should not be prefixed with `Vidfarm Template` unless that phrase is genuinely part of the brand or concept
|
|
494
|
-
- avoid redundant titles like `Vidfarm Template UGC Hooks V1` when `UGC Hooks V1` is the actual display name
|
|
495
|
-
|
|
496
|
-
### 3a. Use the native auto-create harness for media-to-template work
|
|
497
|
-
|
|
498
|
-
When the developer says "autocreate a template based on media in `<input_path>` and output template to `<output_path>`", use:
|
|
499
|
-
|
|
500
|
-
```bash
|
|
501
|
-
npx @mevdragon/vidfarm-devcli autocreate-template <input_path> <output_path>
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
Alias:
|
|
505
|
-
|
|
506
|
-
```bash
|
|
507
|
-
npx @mevdragon/vidfarm-devcli autocreate <input_path> <output_path>
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
The command accepts either positional paths or explicit flags:
|
|
511
|
-
|
|
512
|
-
```bash
|
|
513
|
-
npx @mevdragon/vidfarm-devcli autocreate-template \
|
|
514
|
-
--input-path ./drafts/my_format \
|
|
515
|
-
--output-path ./templates/vidfarm_template_my_format \
|
|
516
|
-
--link-to-original "https://www.tiktok.com/@example/video/1234567890"
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
What this does:
|
|
520
|
-
|
|
521
|
-
- creates `auto-create-templates/runs/<run_id>/`
|
|
522
|
-
- stages source notes and preview media under `source/`
|
|
523
|
-
- creates the standard analyzer artifact folders: `frames`, `audio`, `transcripts`, `ocr`, `motion`, `dna`, `extraction`, and `plan`
|
|
524
|
-
- snapshots the current reusable harness files into `runs/<run_id>/harness/` for traceability
|
|
525
|
-
- runs basic `ffprobe`/`ffmpeg` extraction when source video and local tools are available
|
|
526
|
-
- scaffolds the output template with the same starter logic as `generate-template`
|
|
527
|
-
- writes `manifest.json` and `agent_prompt.md` as the agent handoff
|
|
528
|
-
|
|
529
|
-
Useful options:
|
|
530
|
-
|
|
531
|
-
- `--run-id <id>`: choose the run folder name
|
|
532
|
-
- `--slug-id <slug>`: override the slug derived from the output folder
|
|
533
|
-
- `--template-id <uuid>`: pin the template UUID
|
|
534
|
-
- `--skip-dna-analysis`: scaffold without calling Gemini DNA analysis
|
|
535
|
-
- `--skip-media-probes`: skip local `ffprobe`/`ffmpeg` artifact generation
|
|
536
|
-
- `--skip-scaffold`: create only the run artifacts and handoff prompt
|
|
537
|
-
- `--harness-dir <path>`: use a local harness checkout other than `auto-create-templates/`
|
|
538
|
-
- `--force`: replace an existing output template folder
|
|
539
|
-
|
|
540
|
-
After running `autocreate-template`, continue the harness workflow instead of stopping at scaffold:
|
|
541
|
-
|
|
542
|
-
1. inspect `auto-create-templates/runs/<run_id>/agent_prompt.md`
|
|
543
|
-
2. create `dna/preservation_decision.json`
|
|
544
|
-
3. create `extraction/production_graph.json` matching `production-graph.schema.json`
|
|
545
|
-
4. create `plan/template_plan.json` matching `template-plan.schema.json`
|
|
546
|
-
5. implement `src/template.ts`, metadata, prompts, operations, jobs, and template-local `SKILL.md`
|
|
547
|
-
6. run `validate-template` and at least one real local job
|
|
548
|
-
|
|
549
|
-
The reusable harness lives in `auto-create-templates/AUTO_CREATE_TEMPLATES.md`. It is intentionally included in the devcli package as editable source material. Future improvements to the harness should be made there; each auto-create run stores a snapshot of the harness files used for that run so older runs remain explainable.
|
|
550
|
-
|
|
551
|
-
### 3b. Generate a plain starter template
|
|
552
|
-
|
|
553
|
-
Example:
|
|
554
|
-
|
|
555
|
-
```bash
|
|
556
|
-
npx @mevdragon/vidfarm-devcli generate-template \
|
|
557
|
-
--slug-id template_0007 \
|
|
558
|
-
--template-dir ./templates/vidfarm_template_0007 \
|
|
559
|
-
--link-to-original "https://www.tiktok.com/@example/video/1234567890" \
|
|
560
|
-
--source-notes-path ./drafts/source_notes.md \
|
|
561
|
-
--source-preview-dir ./drafts/preview
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
What this does:
|
|
565
|
-
|
|
566
|
-
- copies the starter template into the new folder
|
|
567
|
-
- rewrites IDs, names, and repo metadata
|
|
568
|
-
- stages `research/source_notes.md`
|
|
569
|
-
- stages `research/preview/*`
|
|
570
|
-
- creates the generated template DNA module
|
|
571
|
-
- automatically runs viral and visual DNA analysis when preview media exists and `GEMINI_API_KEY` is available
|
|
572
|
-
|
|
573
|
-
If you only have one local media file, put it in a temporary preview folder first and point `--source-preview-dir` at that folder.
|
|
574
|
-
|
|
575
|
-
If you need to scaffold before DNA analysis is ready:
|
|
576
|
-
|
|
577
|
-
```bash
|
|
578
|
-
npx @mevdragon/vidfarm-devcli generate-template \
|
|
579
|
-
--slug-id template_0007 \
|
|
580
|
-
--template-dir ./templates/vidfarm_template_0007 \
|
|
581
|
-
--skip-dna-analysis
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### 4. Stage research cleanly
|
|
585
|
-
|
|
586
|
-
Every new template should have:
|
|
587
|
-
|
|
588
|
-
- `research/source_notes.md`
|
|
589
|
-
- `research/preview/`
|
|
590
|
-
|
|
591
|
-
`source_notes.md` should answer:
|
|
592
|
-
|
|
593
|
-
- original format URL
|
|
594
|
-
- creator/account
|
|
595
|
-
- why it wins
|
|
596
|
-
- what must survive adaptation
|
|
597
|
-
- what can change for new brands
|
|
598
|
-
|
|
599
|
-
`research/preview/` should contain screenshots, frames, or short source clips that capture the format clearly.
|
|
600
|
-
|
|
601
|
-
### 5. Run DNA analysis explicitly when needed
|
|
602
|
-
|
|
603
|
-
If the scaffold skipped analysis, or if the source research changed, rerun:
|
|
604
|
-
|
|
605
|
-
```bash
|
|
606
|
-
npx @mevdragon/vidfarm-devcli analyze-viral-dna --template-dir ./templates/vidfarm_template_0007
|
|
607
|
-
npx @mevdragon/vidfarm-devcli analyze-visual-dna --template-dir ./templates/vidfarm_template_0007
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
These commands:
|
|
611
|
-
|
|
612
|
-
- upload the preview media for analysis
|
|
613
|
-
- generate structured viral and visual DNA JSON
|
|
614
|
-
- sync the generated DNA module back into the template
|
|
615
|
-
- populate the strings consumed by `about.viral_dna`, `about.visual_dna`, and `about.link_to_original`
|
|
616
|
-
|
|
617
|
-
After DNA analysis, add `about.proposal_generator`, `about.skeleton_prompt`, and `about.sample_prompts` manually. The standard now requires all three. `proposal_generator` should help a director combine product/about information with the template's format to invent many post proposals. `skeleton_prompt` should provide the default fill-in-the-blanks structure a director can instantiate quickly. `sample_prompts` should show what strong final prompts look like. Do not leave any of them as optional polish.
|
|
618
|
-
|
|
619
|
-
Required-field rule:
|
|
620
|
-
|
|
621
|
-
- treat missing required fields as a blocking bug, not as follow-up polish
|
|
622
|
-
- before calling a template "ready", verify every required field in `defineTemplate(...)` is present and populated with real values
|
|
623
|
-
- if a scaffold or older repo shape omits any current required field, update the template to the current contract in the same pass
|
|
624
|
-
|
|
625
|
-
Do not hand-write these summaries if the CLI can generate them from the source media.
|
|
626
|
-
|
|
627
|
-
### 6. Implement the actual repeatable workflow
|
|
628
|
-
|
|
629
|
-
Use [templates/vidfarm_template_0000/src/template.ts](/Users/localghost/Projects/OfficeX/OfficeX/ZoomGTM/vidfarm/templates/vidfarm_template_0000/src/template.ts) as the baseline pattern.
|
|
630
|
-
|
|
631
|
-
For a new template, make sure it has:
|
|
632
|
-
|
|
633
|
-
- `id`
|
|
634
|
-
- `slugId`
|
|
635
|
-
- `version`
|
|
636
|
-
- `about`
|
|
637
|
-
- `about.title`
|
|
638
|
-
- `about.description`
|
|
639
|
-
- `about.viral_dna`
|
|
640
|
-
- `about.visual_dna`
|
|
641
|
-
- `about.preview_media`
|
|
642
|
-
- `about.link_to_original`
|
|
643
|
-
- `about.proposal_generator` with a reusable instruction for proposal generation
|
|
644
|
-
- `about.skeleton_prompt` with a reusable fill-in-the-blanks prompt scaffold
|
|
645
|
-
- `about.sample_prompts` with multiple concrete examples
|
|
646
|
-
- `configSchema`
|
|
647
|
-
- `operations`
|
|
648
|
-
- `jobs`
|
|
649
|
-
- template-local `SKILL.md`
|
|
650
|
-
- `smokeTestPayload` for every operation
|
|
651
|
-
|
|
652
|
-
Expected implementation work usually includes:
|
|
653
|
-
|
|
654
|
-
- input schema design
|
|
655
|
-
- prompt design
|
|
656
|
-
- image generation and attachment usage
|
|
657
|
-
- text generation where needed
|
|
658
|
-
- slide, frame, manifest, or script output shaping
|
|
659
|
-
- local Remotion render wiring where the template outputs video
|
|
660
|
-
- artifact persistence through `ctx.storage`
|
|
661
|
-
- revision-friendly config and prompt controls where repeated tuning is likely
|
|
662
|
-
|
|
663
|
-
### 7. Expose standard REST routes only
|
|
664
|
-
|
|
665
|
-
The platform route shape is fixed. A template should work behind:
|
|
666
|
-
|
|
667
|
-
- `GET /api/v1/templates/:templateId`
|
|
668
|
-
- `GET /api/v1/templates/:templateId/skill`
|
|
669
|
-
- `GET /api/v1/rate-limit-status`
|
|
670
|
-
- `POST /api/v1/templates/:templateId/config`
|
|
671
|
-
- `POST /api/v1/templates/:templateId/operations/:operationName`
|
|
672
|
-
- `GET /api/v1/templates/:templateId/jobs/:jobId`
|
|
673
|
-
- `GET /api/v1/templates/:templateId/jobs/:jobId/logs`
|
|
674
|
-
- `POST /api/v1/templates/:templateId/jobs/:jobId/cancel`
|
|
675
|
-
|
|
676
|
-
Do not invent one-off REST endpoints for template behavior that already fits an operation workflow.
|
|
677
|
-
|
|
678
|
-
Template-local docs do not need to restate platform plan names or operation quota numbers unless a template adds stricter limits of its own.
|
|
679
|
-
|
|
680
|
-
Every template-local `SKILL.md` must also include TypeScript route templates for those routes. Treat this as part of the template standard, not optional documentation. The type block must name the concrete template slug, list every operation as a string-literal union, define each operation payload, and show the standard wrapper bodies.
|
|
681
|
-
|
|
682
|
-
Minimum block to adapt per template:
|
|
683
|
-
|
|
684
|
-
```ts
|
|
685
|
-
type TemplateSlug = "vidfarm_template_example";
|
|
686
|
-
type TemplateOperation = "create_asset" | "render_video";
|
|
687
|
-
|
|
688
|
-
type TemplateConfigRequest = {
|
|
689
|
-
config: {
|
|
690
|
-
defaultProvider?: "openai" | "gemini" | "openrouter" | "perplexity";
|
|
691
|
-
[key: string]: unknown;
|
|
692
|
-
};
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
type SubmitTemplateOperation<TPayload> = {
|
|
696
|
-
tracer?: string;
|
|
697
|
-
payload: TPayload;
|
|
698
|
-
webhook_url?: string;
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
type QueuedJobResponse = {
|
|
702
|
-
job_id: string;
|
|
703
|
-
tracer?: string;
|
|
704
|
-
status: "queued";
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
type JobStatusResponse<TOutput = unknown> = {
|
|
708
|
-
job_id: string;
|
|
709
|
-
template_id: TemplateSlug;
|
|
710
|
-
operation_name: TemplateOperation;
|
|
711
|
-
tracer?: string;
|
|
712
|
-
status: "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
713
|
-
progress?: number;
|
|
714
|
-
output?: TOutput;
|
|
715
|
-
error?: string;
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
type TemplateRoute =
|
|
719
|
-
| `GET /api/v1/templates/${TemplateSlug}`
|
|
720
|
-
| `GET /api/v1/templates/${TemplateSlug}/skill`
|
|
721
|
-
| `POST /api/v1/templates/${TemplateSlug}/config`
|
|
722
|
-
| `POST /api/v1/templates/${TemplateSlug}/operations/${TemplateOperation}`
|
|
723
|
-
| `GET /api/v1/templates/${TemplateSlug}/jobs`
|
|
724
|
-
| `GET /api/v1/templates/${TemplateSlug}/jobs/${string}`
|
|
725
|
-
| `GET /api/v1/templates/${TemplateSlug}/jobs/${string}/logs`
|
|
726
|
-
| `POST /api/v1/templates/${TemplateSlug}/jobs/${string}/cancel`;
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
For collection-style REST reads, use cursor pagination instead of assuming a single unbounded response:
|
|
730
|
-
|
|
731
|
-
- send `limit`
|
|
732
|
-
- if the response returns `next_cursor`, request the next page with `cursor=<that value>`
|
|
733
|
-
- this applies to template job lists, structured logs, artifacts, and the admin source/release queues
|
|
734
|
-
|
|
735
|
-
If the template accepts custom HTML, attachment URLs, generated image prompts, render-slide manifests, provider/model choices, or template-specific output artifacts, include those fields in the route types instead of leaving them as `Record<string, unknown>`.
|
|
736
|
-
|
|
737
|
-
### 8. Validate end to end
|
|
738
|
-
|
|
739
|
-
Run:
|
|
740
|
-
|
|
741
|
-
```bash
|
|
742
|
-
npx @mevdragon/vidfarm-devcli validate-template --template-id template_0007
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
Then call the real operation through the local API using the local session headers from:
|
|
746
|
-
|
|
747
|
-
```bash
|
|
748
|
-
npx @mevdragon/vidfarm-devcli session
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
Minimum bar:
|
|
752
|
-
|
|
753
|
-
- save config if the template exposes config
|
|
754
|
-
- launch at least one real job
|
|
755
|
-
- poll job status
|
|
756
|
-
- inspect logs
|
|
757
|
-
- inspect produced artifacts
|
|
758
|
-
- if you need ad hoc scripts or test-run inputs to drive this validation, keep them under a sibling `tmp/` folder and not inside `src/`
|
|
759
|
-
|
|
760
|
-
For multi-job validation, keep it simple: create the jobs in a loop, wait or poll, inspect the finished results, and move on. Do not turn local validation into a custom batch-processing subsystem.
|
|
761
|
-
|
|
762
|
-
The expected result is that another agent can rerun the template without reverse-engineering the workflow.
|
|
763
|
-
|
|
764
|
-
## Golden Path: Natural-Language Revisions
|
|
765
|
-
|
|
766
|
-
Use this flow whenever the task is "change this template so it behaves differently" and the input is ordinary feedback rather than code-level instructions.
|
|
767
|
-
|
|
768
|
-
### 1. Interpret the feedback as implementation work
|
|
769
|
-
|
|
770
|
-
Map the revision request onto one or more of these layers:
|
|
771
|
-
|
|
772
|
-
- source research or DNA misunderstanding
|
|
773
|
-
- prompt wording
|
|
774
|
-
- operation schema
|
|
775
|
-
- workflow logic
|
|
776
|
-
- image attachment handling
|
|
777
|
-
- layout or caption placement
|
|
778
|
-
- storage artifacts or output manifest shape
|
|
779
|
-
- Remotion composition, timing, or pacing
|
|
780
|
-
- template config defaults
|
|
781
|
-
- template-local `SKILL.md` examples and instructions
|
|
782
|
-
|
|
783
|
-
Do not just restate the feedback. Convert it into code changes.
|
|
784
|
-
|
|
785
|
-
### 2. Change the template, not just the prompt
|
|
786
|
-
|
|
787
|
-
If the problem is structural, fix the template implementation. Examples:
|
|
788
|
-
|
|
789
|
-
- if outputs drift from the source format, tighten prompt construction or reference attachments
|
|
790
|
-
- if pacing is wrong, change duration logic or Remotion timing
|
|
791
|
-
- if captions clip or overlap UI, change safe areas and layout logic
|
|
792
|
-
- if the template needs more user control, extend `configSchema` or operation input schema
|
|
793
|
-
- if DNA summaries are now wrong, update source notes and rerun DNA analysis
|
|
794
|
-
|
|
795
|
-
Prefer durable fixes over fragile one-off prompt tweaks.
|
|
796
|
-
|
|
797
|
-
### 3. Revalidate after each revision
|
|
798
|
-
|
|
799
|
-
After every meaningful revision:
|
|
800
|
-
|
|
801
|
-
- run `npx @mevdragon/vidfarm-devcli validate-template --template-id <templateIdOrSlug>`
|
|
802
|
-
- run a real local job
|
|
803
|
-
- inspect artifacts and logs
|
|
804
|
-
- confirm the requested behavior actually changed
|
|
805
|
-
|
|
806
|
-
If the revision changed the expected usage pattern, update the template-local `SKILL.md` in the same pass.
|
|
807
|
-
|
|
808
|
-
### 4. Keep iterating until the template is reusable
|
|
809
|
-
|
|
810
|
-
A revision is not complete just because the code compiles. It is complete when:
|
|
811
|
-
|
|
812
|
-
- the requested change is visible in the output
|
|
813
|
-
- the change does not obviously regress the core format
|
|
814
|
-
- the template can still be rerun by another user or agent
|
|
815
|
-
- `about.proposal_generator`, `about.skeleton_prompt`, and `about.sample_prompts` still reflect the best current way to ideate and prompt the template
|
|
816
|
-
- the usage instructions still match the implementation
|
|
817
|
-
|
|
818
|
-
## Template Contract
|
|
819
|
-
|
|
820
|
-
Use this shape:
|
|
821
|
-
|
|
822
|
-
```ts
|
|
823
|
-
export const myTemplate = defineTemplate({
|
|
824
|
-
id: "123e4567-e89b-42d3-a456-426614174000",
|
|
825
|
-
slugId: "ugc_hooks_v1",
|
|
826
|
-
version: "1.0.0",
|
|
827
|
-
about: {
|
|
828
|
-
title: "UGC Hooks V1",
|
|
829
|
-
description: "Generate hooks, previews, and final render inputs.",
|
|
830
|
-
viral_dna: "Fast creator-style hooks with simple repeatable structure.",
|
|
831
|
-
visual_dna: "Presentation-led mobile layouts with recognizable creator-native framing.",
|
|
832
|
-
preview_media: ["templates/ugc_hooks_v1/about/preview-01.jpg"],
|
|
833
|
-
link_to_original: "https://www.tiktok.com/@example/video/1234567890",
|
|
834
|
-
proposal_generator:
|
|
835
|
-
"Given the director's product, audience, and positioning, propose multiple UGC hook post ideas that fit this template. Return ideas that can either be used directly as prompts or expanded into a larger series of related prompts.",
|
|
836
|
-
skeleton_prompt:
|
|
837
|
-
"Create a [number]-slide UGC hook post for [audience] about [topic or product]. Hook: [opening]. Middle beats: [proof, story, objection, or comparison]. Ending: [CTA or payoff]. Tone: [voice].",
|
|
838
|
-
sample_prompts: [
|
|
839
|
-
"Create a 3-slide UGC hook sequence for a sleep supplement targeting new parents.",
|
|
840
|
-
"Make a creator-style launch teaser for a skincare serum with one hook, one proof point, and one CTA.",
|
|
841
|
-
"Generate a short product explainer slideshow for a budgeting app aimed at freelancers."
|
|
842
|
-
]
|
|
843
|
-
},
|
|
844
|
-
configSchema: z.object({
|
|
845
|
-
defaultProvider: z.enum(["openai", "openrouter", "gemini", "perplexity"]).default("openai")
|
|
846
|
-
}),
|
|
847
|
-
operations: {
|
|
848
|
-
scaffold: {
|
|
849
|
-
description: "Generate a script scaffold.",
|
|
850
|
-
inputSchema: z.object({
|
|
851
|
-
topic: z.string()
|
|
852
|
-
}),
|
|
853
|
-
workflow: "scaffoldWorkflow",
|
|
854
|
-
providerHint: "openai",
|
|
855
|
-
webhookSupport: true,
|
|
856
|
-
smokeTestPayload: {
|
|
857
|
-
topic: "creator hooks"
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
jobs: {
|
|
862
|
-
async scaffoldWorkflow(ctx, input) {
|
|
863
|
-
return {
|
|
864
|
-
progress: 1,
|
|
865
|
-
output: {}
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
});
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
Keep these roles clear:
|
|
873
|
-
|
|
874
|
-
- `id` is the UUID-style template identifier
|
|
875
|
-
- `slugId` is the stable human-readable identifier
|
|
876
|
-
- `version` is required and should be an explicit template version string such as `1.0.0`
|
|
877
|
-
- `about.title` is the customer-facing display name; it does not need the folder prefix and should usually read like a normal product/template title
|
|
878
|
-
- `about.description` is required and should explain the reusable output format, not just restate the folder name
|
|
879
|
-
- `about.viral_dna` is required and should describe the repeatable distribution mechanics that make the format work
|
|
880
|
-
- `about.visual_dna` is required and should describe the repeatable visual system, framing, pacing, and composition cues
|
|
881
|
-
- `about.preview_media` is required and should contain checked-in preview asset paths that represent the template well
|
|
882
|
-
- `about.link_to_original` is required and should point to the original inspiration post or source reference when one exists
|
|
883
|
-
- `about.proposal_generator` is required and should help directors turn product/about context into a list of strong post proposals for that template
|
|
884
|
-
- `about.skeleton_prompt` is required and should give directors a template-native fill-in-the-blanks prompt scaffold they can instantiate quickly
|
|
885
|
-
- `about.sample_prompts` is required and should contain realistic, high-signal examples that teach users how to get good results
|
|
886
|
-
- `operations` define the public API
|
|
887
|
-
- `jobs` implement the actual work
|
|
888
|
-
- `smokeTestPayload` is required for each operation
|
|
889
|
-
|
|
890
|
-
Required fields checklist:
|
|
891
|
-
|
|
892
|
-
- `id`
|
|
893
|
-
- `slugId`
|
|
894
|
-
- `version`
|
|
895
|
-
- `about.title`
|
|
896
|
-
- `about.description`
|
|
897
|
-
- `about.viral_dna`
|
|
898
|
-
- `about.visual_dna`
|
|
899
|
-
- `about.preview_media`
|
|
900
|
-
- `about.link_to_original`
|
|
901
|
-
- `about.proposal_generator`
|
|
902
|
-
- `about.skeleton_prompt`
|
|
903
|
-
- `about.sample_prompts`
|
|
904
|
-
- `configSchema`
|
|
905
|
-
- at least one operation
|
|
906
|
-
- a valid workflow function for every operation
|
|
907
|
-
- `smokeTestPayload` for every operation
|
|
908
|
-
- template-local `SKILL.md`
|
|
909
|
-
|
|
910
|
-
## Caption Style Standard
|
|
911
|
-
|
|
912
|
-
For TikTok-native captions, use the platform caption standard exposed by `vidfarm-devcli session` under `starter_style_options`.
|
|
913
|
-
|
|
914
|
-
Check the currently installed CLI values with:
|
|
915
|
-
|
|
916
|
-
```bash
|
|
917
|
-
npx @mevdragon/vidfarm-devcli session
|
|
918
|
-
```
|
|
919
|
-
|
|
920
|
-
The current standard version is `2026-05-30`. The CLI response includes `caption_standard_version`, `fonts`, `text_background_colors`, `presets`, `package_dependencies`, the source standard file, and the starter template style file.
|
|
921
|
-
|
|
922
|
-
Text background rendering rule:
|
|
923
|
-
|
|
924
|
-
- any selected text background color must render as an inline highlight chip that hugs the text only
|
|
925
|
-
- apply visible per-line padding around the glyph bounds; the background should feel intentional, not cramped
|
|
926
|
-
- use slightly curved corners like TikTok's native text highlight shape
|
|
927
|
-
- do not render full-width bars, paragraph washes, large caption panels, or loose boxes behind text
|
|
928
|
-
- for multi-line captions, each line should get its own tight chip or a chip shape that follows the actual text block closely
|
|
929
|
-
- support chip strength levels where practical: `subtle` for light editor-style chips, `standard` for normal TikTok color chips, and `strong` for high-contrast emphatic captions
|
|
930
|
-
|
|
931
|
-
Multiline caption rendering rule:
|
|
932
|
-
|
|
933
|
-
- wrap the caption once, choose one font size and line height for the whole caption, and render it as one multiline text block
|
|
934
|
-
- do not render each wrapped line as a separate trimmed text image; per-line trim bounds change apparent glyph scale, weight, line height, and shadow placement
|
|
935
|
-
- apply shadow or outline to the whole multiline text block, then composite the block into the frame
|
|
936
|
-
- optional background chips may still be per-line, but their geometry should be derived from measured line bounds after the shared multiline layout is decided
|
|
937
|
-
- tune TikTok Sans wrapping, size, and line spacing independently from Montserrat or generic sans assumptions
|
|
938
|
-
- validate with a caption that wraps into one long line and one short line; both lines must look like the same font size and weight with consistent shadow strength
|
|
939
|
-
|
|
940
|
-
Canonical font IDs:
|
|
941
|
-
|
|
942
|
-
- `tiktok_sans_semibold`: default native TikTok caption font, backed by `@fontsource/tiktok-sans` or the bundled `TikTokSans-SemiBold.ttf` starter asset
|
|
943
|
-
- `montserrat_semibold`: rounded modern caption style
|
|
944
|
-
- `source_code_pro_bold`: bold monospace caption style
|
|
945
|
-
- `yesteryear`: script caption style
|
|
946
|
-
- `georgia_bold`: bundled Georgia-style bold serif caption, backed by Libre Baskerville from Fontsource
|
|
947
|
-
- `abel`: condensed caption style
|
|
948
|
-
|
|
949
|
-
Legacy aliases remain accepted for older starters:
|
|
950
|
-
|
|
951
|
-
- `montserrat` -> `montserrat_semibold`
|
|
952
|
-
- `source_code_pro` -> `source_code_pro_bold`
|
|
953
|
-
|
|
954
|
-
Font package dependencies exposed by the CLI:
|
|
955
|
-
|
|
956
|
-
- `@fontsource/tiktok-sans`
|
|
957
|
-
- `@fontsource/montserrat`
|
|
958
|
-
- `@fontsource/source-code-pro`
|
|
959
|
-
- `@fontsource/libre-baskerville`
|
|
960
|
-
|
|
961
|
-
Bundled starter assets may also be available for template-local rendering:
|
|
962
|
-
|
|
963
|
-
- `TikTokSans-SemiBold.ttf`
|
|
964
|
-
- `Montserrat[wght].ttf`
|
|
965
|
-
- `SourceCodePro[wght].ttf`
|
|
966
|
-
- `Yesteryear-Regular.ttf`
|
|
967
|
-
- `Abel-Regular.ttf`
|
|
968
|
-
|
|
969
|
-
Canonical text background color IDs:
|
|
970
|
-
|
|
971
|
-
- `black`: `#000000`
|
|
972
|
-
- `red`: `#EA403F`
|
|
973
|
-
- `orange`: `#FF933D`
|
|
974
|
-
- `yellow`: `#F2CD46`
|
|
975
|
-
- `lime_green`: `#78C25E`
|
|
976
|
-
- `teal`: `#77C8A6`
|
|
977
|
-
- `light_blue`: `#3496F0`
|
|
978
|
-
- `dark_blue`: `#3496F0`
|
|
979
|
-
- `violet`: `#5756D4`
|
|
980
|
-
- `pink`: `#F7D7E9`
|
|
981
|
-
- `brown`: `#A3895B`
|
|
982
|
-
- `dark_green`: `#32523B`
|
|
983
|
-
- `blue_gray`: `#2F688C`
|
|
984
|
-
- `light_gray`: `#92979E`
|
|
985
|
-
- `dark_gray`: `#333333`
|
|
986
|
-
|
|
987
|
-
Canonical style presets:
|
|
988
|
-
|
|
989
|
-
- `tiktok_native_white`: TikTok Sans SemiBold, white fill, no color chip, native black shadow
|
|
990
|
-
- `tiktok_native_chip`: TikTok Sans SemiBold, white fill, red default inline highlight chip, `standard` chip strength, native black shadow
|
|
991
|
-
- `tiktok_editor_gray`: TikTok Sans SemiBold, dark fill, light gray default inline highlight chip, `subtle` chip strength, no shadow
|
|
992
|
-
|
|
993
|
-
Templates that expose caption styling should use these IDs in `configSchema`, operation payloads, manifests, and docs instead of inventing local names or hardcoding unrelated font stacks. If a template intentionally uses a format-specific typography system, document the exception in the template-local `SKILL.md`.
|
|
994
|
-
|
|
995
|
-
The caption standard is a default, not a hard lock. Templates may support `captionFont: "custom"` or template-specific text rendering when the user explicitly needs typography outside the standard. In that case, keep the standard options available, document the custom fields, and prefer bundled or template-local font assets over system fonts or remote Google Fonts URLs.
|
|
996
|
-
|
|
997
|
-
Best-practice rule:
|
|
998
|
-
|
|
999
|
-
- when creating a new template, the agent should author `about.proposal_generator`, `about.skeleton_prompt`, `about.sample_prompts`, and the template-local `SKILL.md` in the same pass without waiting for a separate follow-up request
|
|
1000
|
-
- every template should ship with sample prompts
|
|
1001
|
-
- every template should ship with a proposal generator prompt
|
|
1002
|
-
- every template should ship with a skeleton prompt that captures the default prompt structure
|
|
1003
|
-
- proposal generation should support a workflow of proposal -> prompts -> posts
|
|
1004
|
-
- proposal generation should use the skeleton prompt as a quality harness, so the ideas it emits can be instantiated cleanly without inventing a brand-new structure every time
|
|
1005
|
-
- proposal outputs should be useful either as direct one-off prompts or as seeds for a whole series
|
|
1006
|
-
- sample prompts should feel like strong filled-out versions of the skeleton prompt, not disconnected examples
|
|
1007
|
-
- include more than one example so users can see the range of valid requests
|
|
1008
|
-
- prefer prompts that are specific enough to be reusable exemplars, not vague one-liners
|
|
1009
|
-
- refresh `about.proposal_generator`, `about.skeleton_prompt`, and `about.sample_prompts` when the template's prompting strategy or supported use cases change
|
|
1010
|
-
|
|
1011
|
-
## Typical Template Patterns
|
|
1012
|
-
|
|
1013
|
-
When a developer says "use typical template patterns", interpret that as the default template-authoring contract below unless the template has a strong reason to differ.
|
|
1014
|
-
|
|
1015
|
-
Authoring defaults:
|
|
1016
|
-
|
|
1017
|
-
- when creating a new template, automatically write `about.proposal_generator`, `about.skeleton_prompt`, `about.sample_prompts`, and the template-local `SKILL.md`
|
|
1018
|
-
- the template-local `SKILL.md` should explain the template's operations, expected payloads, sample requests, provider caveats, and any format-specific guidance future agents need
|
|
1019
|
-
- if the template intentionally does not follow one of these patterns, call that out explicitly in the template-local `SKILL.md`
|
|
1020
|
-
|
|
1021
|
-
Asset-input defaults:
|
|
1022
|
-
|
|
1023
|
-
- image-generating or slide-generating operations should usually accept either an AI image prompt or an exact image source supplied by the director
|
|
1024
|
-
- video-aware operations should usually accept either an AI video prompt or an exact video source supplied by the director when the format benefits from source footage
|
|
1025
|
-
- exact media sources should accept either direct URLs or raw prompt text in the same high-level input family when practical
|
|
1026
|
-
- URL detection should be robust enough to handle normal query strings and signed URLs; do not assume a media URL has a clean extension with no params
|
|
1027
|
-
- media-type detection should prefer explicit user fields first, then MIME type or fetch metadata when available, then conservative URL/path heuristics as a fallback
|
|
1028
|
-
- if a template supports file uploads or attachment arrays, document whether it expects a single asset, multiple assets, or either
|
|
1029
|
-
|
|
1030
|
-
Operation-pattern defaults:
|
|
1031
|
-
|
|
1032
|
-
- for most image-generation or slide-generation capabilities, provide two operations or two clearly documented modes of one operation
|
|
1033
|
-
- one mode should be an explicit director-controlled path where the caller can provide exact copy, exact media, or exact slide instructions
|
|
1034
|
-
- one mode should be a full-auto AI path where the caller provides a higher-level prompt or brief and the template decides the detailed text, imagery, and slide plan
|
|
1035
|
-
- name these modes clearly in the template-local `SKILL.md` so future agents and developers can tell which route is deterministic versus generative
|
|
1036
|
-
|
|
1037
|
-
Slideshow-to-video defaults:
|
|
1038
|
-
|
|
1039
|
-
- any operation that turns slideshow media into a video should, by default, accept `[{ media_url: string, duration_ms: number }]`
|
|
1040
|
-
- `media_url` may point to either an image or a video, and the slideshow renderer should handle both
|
|
1041
|
-
- when video clips are supplied in slideshow media, preserve the clip visually for the requested slot duration using a documented strategy such as trim, loop, freeze-last-frame, or fit-to-slot
|
|
1042
|
-
- when the template needs richer control than this default shape, extend it rather than replacing it with an unrelated format
|
|
1043
|
-
|
|
1044
|
-
Remotion arbitrary-slide default:
|
|
1045
|
-
|
|
1046
|
-
- include an arbitrary slide operation when it fits the template family, backed by Remotion rendering
|
|
1047
|
-
- that operation should accept either an AI image prompt or custom HTML as the slide source
|
|
1048
|
-
- the intended use is arbitrary inserts such as outro call-to-action slides, sponsor cards, transitions, or other one-off slides that do not need a dedicated template-specific generator
|
|
1049
|
-
- if custom HTML is accepted, document the styling, sanitization, and asset-loading constraints in the template-local `SKILL.md`
|
|
1050
|
-
|
|
1051
|
-
Recommended input-shape convention:
|
|
1052
|
-
|
|
1053
|
-
```ts
|
|
1054
|
-
const TYPICAL_MEDIA_SOURCE = z.object({
|
|
1055
|
-
media_url: z.string().url().optional(),
|
|
1056
|
-
image_url: z.string().url().optional(),
|
|
1057
|
-
video_url: z.string().url().optional(),
|
|
1058
|
-
image_prompt: z.string().optional(),
|
|
1059
|
-
video_prompt: z.string().optional(),
|
|
1060
|
-
html: z.string().optional(),
|
|
1061
|
-
duration_ms: z.number().int().positive().optional()
|
|
1062
|
-
});
|
|
1063
|
-
```
|
|
1064
|
-
|
|
1065
|
-
Notes:
|
|
1066
|
-
|
|
1067
|
-
- templates may expose clearer, narrower schemas than this when that improves usability
|
|
1068
|
-
- prefer explicit fields like `image_prompt`, `image_url`, `video_prompt`, and `video_url` over guessing from one overloaded string when designing a new schema
|
|
1069
|
-
- if you still accept a single overloaded field for convenience, document the precedence rules clearly
|
|
1070
|
-
|
|
1071
|
-
## Provider Rules
|
|
1072
|
-
|
|
1073
|
-
Templates should use the provider abstractions already available on `ctx.providers`.
|
|
1074
|
-
|
|
1075
|
-
Rules:
|
|
1076
|
-
|
|
1077
|
-
- templates do not need to support all of `openai`, `gemini`, and `openrouter`; supporting at least one real provider path is usually enough unless the template explicitly promises broader portability
|
|
1078
|
-
- use the configured provider path instead of hardcoding one provider everywhere
|
|
1079
|
-
- let templates work with whichever supported provider key the developer actually has
|
|
1080
|
-
- keep prompts and model choices configurable when useful
|
|
1081
|
-
- use image attachments when the format depends on source references
|
|
1082
|
-
- avoid requiring multiple provider accounts unless the template genuinely needs them
|
|
1083
|
-
|
|
1084
|
-
Recommended defaults when a template supports these providers:
|
|
1085
|
-
|
|
1086
|
-
- `openai`: `gpt-5.4` for `text` and `layout_analysis`, `gpt-image-1` for `image`, `sora-2` for `video`, `gpt-4o-mini-tts-2025-12-15` for `tts`, `gpt-4o-mini-transcribe-2025-12-15` for `stt`
|
|
1087
|
-
- `gemini`: `gemini-3.1-flash-lite` for `text` and `layout_analysis`, `gemini-3.1-flash-image-preview` for `image`, `veo-3.0-generate-001` for `video`, `gemini-3.1-flash-tts-preview` for `tts`, `gemini-3.1-flash-lite-preview` for `stt`
|
|
1088
|
-
- `openrouter`: `qwen/qwen3.6-flash` for `text` and `layout_analysis`, `google/gemini-3.1-flash-image-preview` as the recommended paid `image` default where runtime support exists, `google/gemini-3.1-flash-tts-preview` with PCM for `tts`, `openai/gpt-4o-mini-transcribe` for `stt`
|
|
1089
|
-
|
|
1090
|
-
Important distinction:
|
|
1091
|
-
|
|
1092
|
-
- runtime template generation can use OpenAI, OpenRouter, Gemini, or Perplexity according to template logic
|
|
1093
|
-
- first-class speech helpers use a strict runtime allowlist per provider/model pair; if a template needs other speech models, document that it is using a custom provider path instead of the built-in helper
|
|
1094
|
-
- built-in DNA analysis commands currently depend on `GEMINI_API_KEY`
|
|
1095
|
-
|
|
1096
|
-
## Storage And Upload Rules
|
|
1097
|
-
|
|
1098
|
-
Do not hand-write direct S3 upload logic in template code. Use `ctx.storage`.
|
|
1099
|
-
|
|
1100
|
-
Use the built-in namespace conventions:
|
|
1101
|
-
|
|
1102
|
-
- `user/:user_id/*` for user-owned uploaded assets
|
|
1103
|
-
- `developer/:user_id/*` for developer-scoped authoring assets or scratch files
|
|
1104
|
-
- `templates/:template_id/users/:user_id/jobs/:job_id/*` for template job artifacts
|
|
1105
|
-
- `templates/:template_id/about/*` for template about-page media
|
|
1106
|
-
|
|
1107
|
-
Rules:
|
|
1108
|
-
|
|
1109
|
-
- keep user uploads under `user/`
|
|
1110
|
-
- keep developer-only working files under `developer/`
|
|
1111
|
-
- keep generated outputs under the template job namespace
|
|
1112
|
-
- keep about-page preview media under `templates/:template_id/about/`
|
|
1113
|
-
- prefer `putJson`, `putText`, `putBuffer`, and `getPublicUrl`
|
|
1114
|
-
- do not scatter files across arbitrary top-level prefixes
|
|
1115
|
-
|
|
1116
|
-
Hosted preview-media rule for developers:
|
|
1117
|
-
|
|
1118
|
-
- if an agent uploads preview media with `presign-preview-media`, the resulting hosted `about.preview_media` entry should be the returned absolute `developer/<user_id>/*` URL
|
|
1119
|
-
- only use `templates/:template_id/about/*` in `about.preview_media` when that object already exists there, typically after platform import/activation sync or another platform-managed copy step
|
|
1120
|
-
- a repo-local file such as `about/preview-01.png` is fine for source control and for platform sync, but it is not by itself an immediately valid hosted catalog URL
|
|
1121
|
-
|
|
1122
|
-
The runtime may back these writes with local filesystem storage or S3 depending on environment. The template should not care.
|
|
1123
|
-
|
|
1124
|
-
## API Usage
|
|
1125
|
-
|
|
1126
|
-
When calling a hosted Vidfarm API directly, use:
|
|
1127
|
-
|
|
1128
|
-
- `vidfarm-api-key`
|
|
1129
|
-
|
|
1130
|
-
If you need the authenticated customer identity for display or debugging, call:
|
|
1131
|
-
|
|
1132
|
-
- `GET /api/v1/user/me`
|
|
1133
|
-
|
|
1134
|
-
The template-local `SKILL.md` should show concrete request examples for that template's operations and payloads.
|
|
1135
|
-
|
|
1136
|
-
## Validation Checklist
|
|
1137
|
-
|
|
1138
|
-
After changes, validate with as many of these as apply:
|
|
1139
|
-
|
|
1140
|
-
1. `npm run check`
|
|
1141
|
-
2. `npm run build`
|
|
1142
|
-
3. `npx @mevdragon/vidfarm-devcli validate-template --template-id <templateIdOrSlug>`
|
|
1143
|
-
4. `npx @mevdragon/vidfarm-devcli session`
|
|
1144
|
-
5. save config if the template exposes config
|
|
1145
|
-
6. launch a real operation through the local REST API
|
|
1146
|
-
7. poll the job and fetch logs
|
|
1147
|
-
8. inspect produced artifacts
|
|
1148
|
-
|
|
1149
|
-
If you need several runs, submit them in a reasonable loop and poll the returned job IDs. Rely on Vidfarm's native queueing instead of adding bespoke batch scheduling or coordination logic.
|
|
1150
|
-
|
|
1151
|
-
If you changed slideshow, overlay, or video output behavior, also validate:
|
|
1152
|
-
|
|
1153
|
-
1. output images are the expected aspect ratio
|
|
1154
|
-
2. captions remain readable and do not clip
|
|
1155
|
-
3. important subjects stay inside safe framing
|
|
1156
|
-
4. final local video output matches expected pacing and composition
|
|
1157
|
-
|
|
1158
|
-
If the task was a revision request, also validate:
|
|
1159
|
-
|
|
1160
|
-
1. the specific natural-language feedback is reflected in the output
|
|
1161
|
-
2. the revision did not break the original core format
|
|
1162
|
-
3. the template-local `SKILL.md` still matches the current behavior
|
|
1163
|
-
|
|
1164
|
-
## What To Avoid
|
|
1165
|
-
|
|
1166
|
-
- asking third-party developers for platform secrets
|
|
1167
|
-
- mixing admin release instructions into template authoring guidance
|
|
1168
|
-
- requiring cloud Remotion setup for normal template work
|
|
1169
|
-
- adding one-off custom endpoints when an operation already fits the job model
|
|
1170
|
-
- hardcoding a developer's personal provider choice into template logic
|
|
1171
|
-
- skipping DNA analysis when source media is available
|
|
1172
|
-
- omitting `SKILL.md`, `research/source_notes.md`, or `smokeTestPayload`
|
|
1173
|
-
- stopping after scaffold generation without making the template runnable
|
|
1174
|
-
- treating revision feedback as "prompt advice" without changing the template when the fix belongs in code
|
|
1175
|
-
- assuming the first pass is final
|
|
1176
|
-
|
|
1177
|
-
## Output Style For Vidfarm Work
|
|
1178
|
-
|
|
1179
|
-
When reporting back after Vidfarm template changes:
|
|
1180
|
-
|
|
1181
|
-
- name the template changed
|
|
1182
|
-
- mention the operation or workflow affected
|
|
1183
|
-
- state whether you used scaffold plus DNA analysis or a manual extension path
|
|
1184
|
-
- summarize the natural-language revision request when the task was a revision
|
|
1185
|
-
- state how you verified it locally
|
|
1186
|
-
- call out any remaining gap such as mocked provider responses, missing preview media, or unexercised optional paths
|