@mevdragon/vidfarm-devcli 0.2.2 → 0.2.3

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.
@@ -1,178 +1,87 @@
1
- # Vidfarm Third-Party Developer Guide
1
+ # Vidfarm Developers
2
2
 
3
- This guide is for external developers building Vidfarm templates locally.
3
+ ## Interview Phase
4
4
 
5
- It covers:
5
+ Prepare for your Interview:
6
6
 
7
- - the local setup
8
- - the template contract
9
- - the local CLI workflow
10
- - the minimum hosted-platform context you need
7
+ 1. Browse the Winning Formats Gallery of viral TikTok videos here. These are samples of what you'd be recreating for customers:
8
+ https://winning-formats-gallery-tiktok.cloud.zoomgtm.com/
11
9
 
12
- It does not cover platform internals, admin release flow, or cloud infrastructure.
10
+ 2. Setup OpenAI Codex on your computer with free tier. This is your primary AI coding agent (really good to know, even for future jobs)
11
+ https://developers.openai.com/codex/cli
12
+ https://www.youtube.com/watch?v=GJsx_FuiwNg
13
13
 
14
- ## Local Setup
14
+ 3. Setup Remotion Skill on your computer. Codex will handle all the coding work, you just need to be able to get it to render the output videos/images. no need for suno, just image gen is enough.
15
+ https://www.youtube.com/watch?v=Xdy1vkhSz-M
15
16
 
16
- 1. Create a working folder for your template project.
17
- 2. Install the CLI from npm.
18
- 3. Create a local `.env` from `.env.example`.
19
- 4. Add at least one AI provider key.
17
+ 4. You’ll need to acquire an ai api key that can generate images at least. There’s many free and paid ones out there. Part of the skills test is to be resourceful and find it so you can test with (hint: check huggingface, openrouter, and ask codex to suggest others). You will not be penalized for using a weaker free ai
20
18
 
21
- Typical `.env`:
19
+ 5. Once you are ready, request the interview with @zoom_gtm and he will give you the skills test, gemini api key, and invite to first week trial run hands on helping customers (you will be paid for your time). You'd be recreating from the winning formats gallery
22
20
 
23
- ```env
24
- GEMINI_API_KEY=""
25
- OPENAI_API_KEY=""
26
- OPENROUTER_API_KEY=""
27
- PERPLEXITY_API_KEY=""
28
- ```
21
+ The skills test:
29
22
 
30
- Start the local runtime:
23
+ try to build your own workflow in VSCode + Codex cli + prompt.md files to generate a winning template. It should be easy to re-run your template to generate infinite content of that type. You may ask codex to explain what I mean
31
24
 
32
- ```bash
33
- npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
34
- ```
25
+ ## Pre-Setup for Skills Test
35
26
 
36
- This starts:
27
+ Hello Creative Directors! You can
37
28
 
38
- - the local Vidfarm API
39
- - the local worker
40
- - local SQLite state
41
- - local filesystem-backed media storage
42
- - local Remotion rendering when your template uses Remotion
29
+ 1. Create a Github account and setup SSH key so you can save your work & login on github CLI (ask codex how):
30
+ https://github.com
43
31
 
44
- ## Local Session
32
+ 2. Create an NPM account and login on npm CLI (ask codex how):
33
+ https://www.npmjs.com
45
34
 
46
- Run:
35
+ 3. DM me your github username & npm username. congrats! you are a developer now
47
36
 
48
- ```bash
49
- npx @mevdragon/vidfarm-devcli session
50
- ```
37
+ 4. Make sure you are familiar with codex & api keys prepared and have tried all of the above. I will provide a gemini ai api key for the skills test.
51
38
 
52
- This prints a reusable local session so you can test the API with `curl` or your own scripts.
39
+ MAKE SURE YOU ARE PREPARED. If I have to babysit you during the call, I will immediatlely end the interview early to not waste anyones time.
53
40
 
54
- ## Generate A Starter Template
41
+ 5. Final step, schedule your 1:1 skills test interview. do not book time until you have finished prior steps.
55
42
 
56
- To scaffold a new template:
43
+ https://calendly.com/zoom-gtm/creative-director-interviews
57
44
 
58
- ```bash
59
- npx @mevdragon/vidfarm-devcli generate-template \
60
- --slug-id template_0001 \
61
- --template-dir ./templates/template_0001
62
- ```
45
+ ## Setup for Job
63
46
 
64
- That scaffold includes:
47
+ 0. Tell your manager your email so he can whitelist you access to Vidfarm. After he confirms you have access, login at https://vidfarm.cloud.zoomgtm.com
65
48
 
66
- - template source files
67
- - a template-local `SKILL.md`
68
- - `research/source_notes.md`
69
- - `research/preview/`
70
- - `src/template-dna.ts`
49
+ 1. Open VSCode in a new project called "Vidfarm-Developer"
71
50
 
72
- If preview media is present, the scaffold can also help generate `viral_dna` and `visual_dna`.
51
+ 2. Open terminal and login to github cli and npm cli (ask ai/codex if you need help). ask your manager if they gave you npm access to "vidfarm-devcli" yet.
73
52
 
74
- ## Validate Your Template
53
+ 3. Open Codex cli in terminal, with /permissions set to "Full Access"
75
54
 
76
- Use the CLI before handing a template off:
55
+ 4. Install the private skill by copying it from https://vidfarm.cloud.zoomgtm.com/settings in "Developer SKILL.md" button and pasting it into the below prompt for codex.
77
56
 
78
- ```bash
79
- npx @mevdragon/vidfarm-devcli validate-template --template-id template_0000
57
+ ```txt
58
+ Please take this agent skill and install it locally. Then install the vidfarm-devcli from npm, ask me for the otp if need, I will enter it. Here is the agent skill: [pasted]
80
59
  ```
81
60
 
82
- You should also run real local jobs for the operations you added and inspect the results.
83
-
84
- ## Template Contract
85
-
86
- Vidfarm expects templates to fit a consistent contract.
87
-
88
- Each template should define:
89
-
90
- - `id`
91
- - `slugId`
92
- - `version`
93
- - `about`
94
- - `configSchema`
95
- - `operations`
96
- - `jobs`
97
-
98
- The important idea is:
99
-
100
- - `operations` are the public actions
101
- - `jobs` do the actual work
102
- - every meaningful action should fit the async job pattern
103
-
104
- Each operation should include a `smokeTestPayload`.
105
-
106
- Each template should also include:
107
-
108
- - a template-local `SKILL.md`
109
- - `about.viral_dna`
110
- - `about.visual_dna`
111
- - `about.preview_media`
112
- - `about.link_to_original` when relevant
113
-
114
- ## How The Hosted Platform Uses Your Template
115
-
116
- The hosted platform loads templates behind a standard wrapper.
117
-
118
- From the caller's perspective, templates are used through routes like:
61
+ 5. Create a .env file at folder root with your AI API KEY. You need at least 1 of 3 and it doesn't matter which. We recommend Gemini. Ask your manager for an AI API key.
119
62
 
120
- - `GET /api/v1/templates/:templateId`
121
- - `GET /api/v1/templates/:templateId/skill`
122
- - `POST /api/v1/templates/:templateId/config`
123
- - `POST /api/v1/templates/:templateId/operations/:operationName`
124
- - `GET /api/v1/templates/:templateId/jobs/:jobId`
125
- - `GET /api/v1/templates/:templateId/jobs/:jobId/logs`
126
-
127
- This means your template should focus on:
128
-
129
- - clear metadata
130
- - strong input schemas
131
- - repeatable workflow logic
132
- - useful job output
133
-
134
- Avoid building custom standalone HTTP APIs inside the template.
135
-
136
- ## Review And Approval
137
-
138
- Finishing a template locally does not make it live automatically.
139
-
140
- The expected flow is:
141
-
142
- 1. build and validate the template locally
143
- 2. hand off the template source for review
144
- 3. wait for Vidfarm admin approval before the template is made available on the hosted platform
145
-
146
- This is the key production boundary external developers need to understand. Your job is to produce a clean, repeatable template package that passes review.
147
-
148
- ## Hosted Auth Context
149
-
150
- When you call a hosted Vidfarm API directly, authenticated requests use:
151
-
152
- - `vidfarm-user-id`
153
- - `vidfarm-api-key`
154
-
155
- Those values come from Vidfarm user auth and settings.
156
-
157
- For local development, the CLI session command handles this for you by printing a seeded local session.
63
+ ```.env
64
+ GEMINI_API_KEY="______"
65
+ OPENAI_API_KEY="______"
66
+ OPENROUTER_API_KEY="______"
67
+ ```
158
68
 
159
- ## Remotion
69
+ 6. Extend that .env file with another secret VIDFARM_API_KEY, you can get it at https://vidfarm.cloud.zoomgtm.com/settings
160
70
 
161
- For third-party template authors, Remotion is local-only in this workflow.
71
+ ```.env
72
+ VIDFARM_API_KEY="_______"
73
+ ```
162
74
 
163
- If your template uses Remotion:
75
+ 6. Create a new folder called `src/`, this is where we are going to do most of our development work.
164
76
 
165
- - build it locally
166
- - validate it locally
167
- - keep the template code compatible with local CLI execution
77
+ 7. Tell codex to:
168
78
 
169
- You do not need shared cloud Remotion infrastructure details to author a template.
79
+ ```txt
80
+ use the vidfarm-devcli to copy-reference-template into src/vidfarm_template_0000 so i can view it as example
81
+ ```
170
82
 
171
- ## Recommended Reading
83
+ That will populate with a reference folder of what a template code looks like. We are going to create a new template.
172
84
 
173
- Start with:
85
+ 8. Create a new folder beside src called `drafts/` which is where we will put messy files when needed.
174
86
 
175
- 1. `README.md`
176
- 2. `SKILL.developer.md`
177
- 3. `templates/template_0000/SKILL.md`
178
- 4. `templates/template_0000/src/template.ts`
87
+ 9. Now find an easy winning format from https://winning-formats-gallery-tiktok.cloud.zoomgtm.com/ and save the image to your drafts/ folder. then tell Codex to look at that image (right click, copy relative path, paste to codex), then tell codex please make a new template based on the image.
package/README.md CHANGED
@@ -29,9 +29,11 @@ Useful commands:
29
29
  npx @mevdragon/vidfarm-devcli dev --port 3310 --reset
30
30
  npx @mevdragon/vidfarm-devcli session
31
31
  npx @mevdragon/vidfarm-devcli validate-template --template-id template_0000
32
- npx @mevdragon/vidfarm-devcli generate-template --slug-id template_0001 --template-dir ./templates/template_0001
33
- npx @mevdragon/vidfarm-devcli analyze-viral-dna --template-dir ./templates/template_0001
34
- npx @mevdragon/vidfarm-devcli analyze-visual-dna --template-dir ./templates/template_0001
32
+ npx @mevdragon/vidfarm-devcli copy-reference-template --template-dir ./src/vidfarm_template_0000
33
+ npx @mevdragon/vidfarm-devcli generate-template --slug-id template_0001 --template-dir ./templates/vidfarm_template_0001
34
+ npx @mevdragon/vidfarm-devcli analyze-viral-dna --template-dir ./templates/vidfarm_template_0001
35
+ npx @mevdragon/vidfarm-devcli analyze-visual-dna --template-dir ./templates/vidfarm_template_0001
36
+ npx @mevdragon/vidfarm-devcli presign-preview-media --file ./drafts/preview/example.png --directory drafts/preview
35
37
  ```
36
38
 
37
39
  After install, the package exposes both `vidfarm` and `vidfarm-devcli` as local binaries.
@@ -49,6 +51,8 @@ The local CLI runs the same template contract used by the hosted platform, but w
49
51
 
50
52
  Use `vidfarm session` to print reusable auth headers and a sample `curl` request for the local REST API.
51
53
 
54
+ For hosted preview-media uploads, use `vidfarm-devcli presign-preview-media`. It calls the authenticated Vidfarm API with `VIDFARM_API_KEY` and returns a presigned PUT URL under `developer/<user_id>/preview_media/*` plus the resulting Vidfarm media URL.
55
+
52
56
  ## What The Hosted Platform Expects From Templates
53
57
 
54
58
  Vidfarm treats templates as async job producers, not as ad hoc endpoints.
@@ -57,6 +61,7 @@ Each template should provide:
57
61
 
58
62
  - stable template metadata
59
63
  - a `SKILL.md` file for users and agents
64
+ - a TypeScript entrypoint at `src/template.ts`
60
65
  - one or more named operations
61
66
  - workflow functions behind those operations
62
67
  - a `smokeTestPayload` for each operation
@@ -79,6 +84,36 @@ Third-party developers build and validate templates locally first.
79
84
 
80
85
  After handoff, a Vidfarm admin reviews the template before it is made available on the hosted platform. Template authors should assume there is an approval step between local development and production availability.
81
86
 
87
+ ## Template Deploy Cycle
88
+
89
+ When someone says "template deploy cycle" in this repo, they mean this exact sequence:
90
+
91
+ 1. commit and `git push` the repo that contains the template folder, such as `templates/vidfarm_template_<slug>/` inside a monorepo or a standalone template repo
92
+ 2. as the platform admin, pull/import that template commit into Vidfarm
93
+ 3. approve and activate the imported template release in the hosted platform
94
+ 4. run the prod deploy script if platform-runtime code changed, or reuse the current prod image if the change was template-only and you just need a formal deploy-cycle restart
95
+
96
+ For `template_0000`, that usually means:
97
+
98
+ ```bash
99
+ git -C templates/vidfarm_template_0000 push origin production
100
+ # then run the platform operator command
101
+ node dist/src/cli.js deploy-template-cycle \
102
+ --env-file .env.production \
103
+ --stack-name VidfarmProdStack \
104
+ --template-id 4c7a7e1a-7f35-4f30-9f86-9c8a63c7f2db \
105
+ --slug-id template_0000 \
106
+ --repo-url https://github.com/your-org/your-template-repo \
107
+ --branch production \
108
+ --template-module-path templates/vidfarm_template_0000/src/template.ts
109
+ ```
110
+
111
+ The important distinction is:
112
+
113
+ - template repo changes ship through template source import and activation
114
+ - platform code changes ship through the root prod deploy script
115
+ - multiple templates can live in one git repo as long as each template has its own folder and its `template_module_path` points at that folder's `src/template.ts`
116
+
82
117
  ## Authentication Context
83
118
 
84
119
  When calling a hosted Vidfarm API directly, authenticated requests use:
@@ -86,7 +121,12 @@ When calling a hosted Vidfarm API directly, authenticated requests use:
86
121
  - `vidfarm-user-id`
87
122
  - `vidfarm-api-key`
88
123
 
89
- Those values come from Vidfarm login and settings, not from platform infrastructure secrets.
124
+ The API key comes from Vidfarm login and settings, not from platform infrastructure secrets.
125
+ If you need to discover the authenticated customer ID first, resolve it from `GET /api/v1/user/me` and then send both headers on subsequent requests.
126
+
127
+ For hosted template source registration, treat `template_module_path` as repo-relative and point it at the template's TypeScript entrypoint, for example `templates/vidfarm_template_hooks/src/template.ts`. Each template folder must start with `vidfarm_template_`. The import flow builds the repo and loads the compiled `src/template.js` sibling at activation time.
128
+
129
+ For private GitHub repos, export `VIDFARM_GITHUB_TOKEN` (or `GITHUB_TOKEN`) before running `import-source-prod` or `deploy-template-cycle`. The prod operator command injects that token into the live container's git config for the import and keeps the stored `repo_url` clean.
90
130
 
91
131
  For local CLI usage, the `session` command gives you a local seeded session so you can test without manually wiring auth state.
92
132