cineprompt 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/bin/cineprompt.js +212 -0
- package/data/field-values.json +1508 -0
- package/lib/prompt-builder.js +200 -0
- package/lib/share.js +35 -0
- package/package.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Light Owl, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# cineprompt
|
|
2
|
+
|
|
3
|
+
CLI tool for building structured AI video prompts and share links via [cineprompt.io](https://cineprompt.io).
|
|
4
|
+
|
|
5
|
+
Turn shot descriptions into optimized prompts for Sora, Runway, Kling, Veo, Seedance, and other AI video generators.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g cineprompt
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run directly:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx cineprompt --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Get your API key from [cineprompt.io](https://cineprompt.io) → Settings → API Access (Pro subscription required).
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cineprompt auth cp_your_api_key_here
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Build a share link from state JSON
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cineprompt build '{"mode":"single","complexity":"complex","subjectType":"landscape","fields":{"media_type":["cinematic"],"tone":["peaceful"],"env_time":"golden hour, warm late afternoon light","shot_type":"establishing shot","movement":"pull out","focal_length":"24mm lens","dof":"deep focus","color_grade":"warm tones"}}'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Output:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
🎬 https://cineprompt.io/p/a8k2mf
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Build from a JSON file
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cineprompt build --file shot.json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Build from stdin
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cat shot.json | cineprompt build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Browse available fields
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# List all 92 fields
|
|
57
|
+
cineprompt fields
|
|
58
|
+
|
|
59
|
+
# Show valid values for a specific field
|
|
60
|
+
cineprompt fields env_time
|
|
61
|
+
cineprompt fields shot_type
|
|
62
|
+
cineprompt fields media_type
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## State JSON format
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mode": "single",
|
|
70
|
+
"complexity": "simple",
|
|
71
|
+
"subjectType": "character",
|
|
72
|
+
"fields": {
|
|
73
|
+
"media_type": ["cinematic"],
|
|
74
|
+
"tone": ["moody"],
|
|
75
|
+
"char_label": "A weathered fisherman",
|
|
76
|
+
"subject_description": "Deep wrinkles, sun-damaged skin",
|
|
77
|
+
"setting": "exterior",
|
|
78
|
+
"location_type": "dock, pier",
|
|
79
|
+
"env_time": "dawn, first light",
|
|
80
|
+
"weather": "fog",
|
|
81
|
+
"shot_type": "close-up",
|
|
82
|
+
"movement": "handheld",
|
|
83
|
+
"dof": "shallow depth of field, bokeh",
|
|
84
|
+
"lighting_style": "soft light",
|
|
85
|
+
"color_grade": "desaturated",
|
|
86
|
+
"sfx_environment": ["waves crashing, water ambience"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Required fields
|
|
92
|
+
|
|
93
|
+
- **mode** — `"single"` (multishot and frame-to-motion coming soon)
|
|
94
|
+
- **fields** — object mapping field names to values
|
|
95
|
+
|
|
96
|
+
### Optional fields
|
|
97
|
+
|
|
98
|
+
- **complexity** — `"simple"` (default) or `"complex"` (unlocks camera body, lens brand, film stock, color science)
|
|
99
|
+
- **subjectType** — `"character"`, `"object"`, `"vehicle"`, `"creature"`, `"landscape"`, or `"abstract"`
|
|
100
|
+
|
|
101
|
+
### Field types
|
|
102
|
+
|
|
103
|
+
- **Button fields** accept exact string values (use `cineprompt fields <name>` to see options)
|
|
104
|
+
- **Array fields** accept multiple values: `"media_type": ["cinematic", "documentary"]`
|
|
105
|
+
- **Free text fields** accept any string: `"subject_description": "whatever you want"`
|
|
106
|
+
|
|
107
|
+
## Use with AI agents
|
|
108
|
+
|
|
109
|
+
The CLI is designed to work with AI coding agents and automation tools. Your agent builds the state JSON, pipes it to `cineprompt build`, and gets back a share link.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Agent workflow
|
|
113
|
+
echo "$STATE_JSON" | cineprompt build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Works with [OpenClaw](https://openclaw.ai), Claude, GPT, and any agent that can run shell commands.
|
|
117
|
+
|
|
118
|
+
## Authentication
|
|
119
|
+
|
|
120
|
+
API keys are scoped to share link creation only. They cannot read other users' data, access saved prompts, or modify accounts.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Save key locally (~/.cineprompt/config.json)
|
|
124
|
+
cineprompt auth cp_your_key
|
|
125
|
+
|
|
126
|
+
# Or pass per-command
|
|
127
|
+
cineprompt build --api-key cp_your_key '{"fields":{...}}'
|
|
128
|
+
|
|
129
|
+
# Or set env var
|
|
130
|
+
CINEPROMPT_API_KEY=cp_your_key cineprompt build '{"fields":{...}}'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Links
|
|
134
|
+
|
|
135
|
+
- [CinePrompt](https://cineprompt.io) — prompt builder
|
|
136
|
+
- [Guides](https://cineprompt.io/guides) — articles on AI video prompting
|
|
137
|
+
- [Light Owl](https://lightowl.com) — production company behind CinePrompt
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CinePrompt CLI
|
|
5
|
+
*
|
|
6
|
+
* Create AI video prompts and share links via cineprompt.io.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* cineprompt build '{"mode":"single","fields":{...}}' → share link from state JSON
|
|
10
|
+
* cineprompt build --file state.json → share link from JSON file
|
|
11
|
+
* cat state.json | cineprompt build → share link from stdin
|
|
12
|
+
*
|
|
13
|
+
* Auth:
|
|
14
|
+
* cineprompt auth <api-key> → save API key locally
|
|
15
|
+
* --api-key <key> or CINEPROMPT_API_KEY env var
|
|
16
|
+
*
|
|
17
|
+
* Info:
|
|
18
|
+
* cineprompt --help
|
|
19
|
+
* cineprompt --version
|
|
20
|
+
* cineprompt fields → list all valid field names
|
|
21
|
+
* cineprompt fields <name> → show values for a field
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
25
|
+
import { join } from 'path';
|
|
26
|
+
import { homedir } from 'os';
|
|
27
|
+
import { buildPromptText } from '../lib/prompt-builder.js';
|
|
28
|
+
import { createShareLink } from '../lib/share.js';
|
|
29
|
+
import { createRequire } from 'module';
|
|
30
|
+
|
|
31
|
+
const require = createRequire(import.meta.url);
|
|
32
|
+
const pkg = require('../package.json');
|
|
33
|
+
|
|
34
|
+
// --- Config ---
|
|
35
|
+
const CONFIG_DIR = join(homedir(), '.cineprompt');
|
|
36
|
+
const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
|
|
37
|
+
|
|
38
|
+
function loadConfig() {
|
|
39
|
+
try { return JSON.parse(readFileSync(CONFIG_FILE, 'utf8')); }
|
|
40
|
+
catch { return {}; }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function saveConfig(config) {
|
|
44
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
45
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function resolveApiKey(args) {
|
|
49
|
+
// 1. --api-key flag
|
|
50
|
+
const idx = args.indexOf('--api-key');
|
|
51
|
+
if (idx !== -1 && args[idx + 1]) return args[idx + 1];
|
|
52
|
+
// 2. Env var
|
|
53
|
+
if (process.env.CINEPROMPT_API_KEY) return process.env.CINEPROMPT_API_KEY;
|
|
54
|
+
// 3. Saved config
|
|
55
|
+
const config = loadConfig();
|
|
56
|
+
if (config.apiKey) return config.apiKey;
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --- Commands ---
|
|
61
|
+
|
|
62
|
+
async function cmdAuth(args) {
|
|
63
|
+
const key = args[0];
|
|
64
|
+
if (!key || !key.startsWith('cp_')) {
|
|
65
|
+
console.error('Usage: cineprompt auth <api-key>');
|
|
66
|
+
console.error('Get your API key at cineprompt.io → Settings → API Access');
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
saveConfig({ ...loadConfig(), apiKey: key });
|
|
70
|
+
console.log('✓ API key saved to ~/.cineprompt/config.json');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function cmdBuild(args) {
|
|
74
|
+
const apiKey = resolveApiKey(args);
|
|
75
|
+
if (!apiKey) {
|
|
76
|
+
console.error('No API key. Set one with:');
|
|
77
|
+
console.error(' cineprompt auth <your-api-key>');
|
|
78
|
+
console.error(' --api-key <key>');
|
|
79
|
+
console.error(' CINEPROMPT_API_KEY=<key>');
|
|
80
|
+
console.error('');
|
|
81
|
+
console.error('Get your key at cineprompt.io → Settings → API Access (Pro required)');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let stateJson;
|
|
86
|
+
|
|
87
|
+
// --file flag
|
|
88
|
+
const fileIdx = args.indexOf('--file');
|
|
89
|
+
if (fileIdx !== -1 && args[fileIdx + 1]) {
|
|
90
|
+
stateJson = JSON.parse(readFileSync(args[fileIdx + 1], 'utf8'));
|
|
91
|
+
}
|
|
92
|
+
// Inline JSON argument (skip flags)
|
|
93
|
+
else {
|
|
94
|
+
const jsonArg = args.find(a => !a.startsWith('--') && a !== args[args.indexOf('--api-key') + 1]);
|
|
95
|
+
if (jsonArg) {
|
|
96
|
+
try { stateJson = JSON.parse(jsonArg); }
|
|
97
|
+
catch { /* not JSON, ignore */ }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Stdin
|
|
102
|
+
if (!stateJson && !process.stdin.isTTY) {
|
|
103
|
+
const chunks = [];
|
|
104
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
105
|
+
const input = Buffer.concat(chunks).toString().trim();
|
|
106
|
+
if (input) stateJson = JSON.parse(input);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!stateJson) {
|
|
110
|
+
console.error('No state JSON provided. Use:');
|
|
111
|
+
console.error(' cineprompt build \'{"mode":"single","fields":{...}}\'');
|
|
112
|
+
console.error(' cineprompt build --file state.json');
|
|
113
|
+
console.error(' cat state.json | cineprompt build');
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Ensure required structure
|
|
118
|
+
if (!stateJson.fields) {
|
|
119
|
+
console.error('Error: state JSON must have a "fields" object.');
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
stateJson.mode = stateJson.mode || 'single';
|
|
123
|
+
stateJson.complexity = stateJson.complexity || 'simple';
|
|
124
|
+
|
|
125
|
+
const promptText = buildPromptText(stateJson);
|
|
126
|
+
if (!promptText) {
|
|
127
|
+
console.error('Error: no prompt text generated. Check your field values.');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
const result = await createShareLink(apiKey, stateJson, promptText, stateJson.mode);
|
|
133
|
+
console.log(`🎬 ${result.url}`);
|
|
134
|
+
} catch (err) {
|
|
135
|
+
console.error(`Error: ${err.message}`);
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function cmdFields(args) {
|
|
141
|
+
const fieldValues = require('../data/field-values.json');
|
|
142
|
+
const fieldName = args[0];
|
|
143
|
+
|
|
144
|
+
if (fieldName) {
|
|
145
|
+
const values = fieldValues[fieldName];
|
|
146
|
+
if (!values) {
|
|
147
|
+
console.error(`Unknown field: ${fieldName}`);
|
|
148
|
+
console.error(`Run "cineprompt fields" to see all field names.`);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
if (Array.isArray(values)) {
|
|
152
|
+
values.forEach(v => console.log(` ${v}`));
|
|
153
|
+
} else {
|
|
154
|
+
console.log(JSON.stringify(values, null, 2));
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
const names = Object.keys(fieldValues);
|
|
158
|
+
console.log(`${names.length} fields available:\n`);
|
|
159
|
+
names.forEach(n => {
|
|
160
|
+
const v = fieldValues[n];
|
|
161
|
+
const count = Array.isArray(v) ? `(${v.length} options)` : '(free text)';
|
|
162
|
+
console.log(` ${n} ${count}`);
|
|
163
|
+
});
|
|
164
|
+
console.log(`\nRun "cineprompt fields <name>" to see values for a field.`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function showHelp() {
|
|
169
|
+
console.log(`
|
|
170
|
+
cineprompt v${pkg.version} — AI video prompt builder
|
|
171
|
+
|
|
172
|
+
Commands:
|
|
173
|
+
build <json> Create a share link from state JSON
|
|
174
|
+
build --file <path> Create a share link from a JSON file
|
|
175
|
+
auth <api-key> Save your API key locally
|
|
176
|
+
fields List all valid field names
|
|
177
|
+
fields <name> Show valid values for a field
|
|
178
|
+
|
|
179
|
+
Options:
|
|
180
|
+
--api-key <key> Use this API key (or set CINEPROMPT_API_KEY)
|
|
181
|
+
--version, -v Show version
|
|
182
|
+
--help, -h Show this help
|
|
183
|
+
|
|
184
|
+
Examples:
|
|
185
|
+
cineprompt auth cp_abc123
|
|
186
|
+
cineprompt build '{"mode":"single","complexity":"complex","subjectType":"landscape","fields":{"media_type":["cinematic"],"env_time":"golden hour, warm late afternoon light"}}'
|
|
187
|
+
cat shot.json | cineprompt build
|
|
188
|
+
|
|
189
|
+
Get your API key: cineprompt.io → Settings → API Access (Pro required)
|
|
190
|
+
Docs: cineprompt.io/guides
|
|
191
|
+
`.trim());
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// --- Main ---
|
|
195
|
+
const args = process.argv.slice(2);
|
|
196
|
+
const cmd = args[0];
|
|
197
|
+
|
|
198
|
+
if (!cmd || cmd === '--help' || cmd === '-h') {
|
|
199
|
+
showHelp();
|
|
200
|
+
} else if (cmd === '--version' || cmd === '-v') {
|
|
201
|
+
console.log(pkg.version);
|
|
202
|
+
} else if (cmd === 'auth') {
|
|
203
|
+
cmdAuth(args.slice(1));
|
|
204
|
+
} else if (cmd === 'build') {
|
|
205
|
+
cmdBuild(args.slice(1));
|
|
206
|
+
} else if (cmd === 'fields') {
|
|
207
|
+
cmdFields(args.slice(1));
|
|
208
|
+
} else {
|
|
209
|
+
console.error(`Unknown command: ${cmd}`);
|
|
210
|
+
console.error('Run "cineprompt --help" for usage.');
|
|
211
|
+
process.exit(1);
|
|
212
|
+
}
|