playrig 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/AGENTS.md +106 -0
  2. package/LICENSE +37 -0
  3. package/README.md +77 -2
  4. package/bin/playrig.js +4 -0
  5. package/editions/ae/README.md +144 -0
  6. package/editions/ae/client/aeb.js +9 -0
  7. package/editions/ae/examples/hello.jsx +3 -0
  8. package/editions/ae/examples/inspect.jsx +7 -0
  9. package/editions/ae/examples/snap.jsx +15 -0
  10. package/editions/ae/lib/actions.json +159 -0
  11. package/editions/ae/lib/bridge-api.jsxinc +474 -0
  12. package/editions/ae/lib/dev.jsxinc +21 -0
  13. package/editions/ae/lib/icons/README.md +4 -0
  14. package/editions/ae/lib/icons/dot-error.svg +3 -0
  15. package/editions/ae/lib/icons/dot-idle.svg +3 -0
  16. package/editions/ae/lib/icons/dot-running.svg +3 -0
  17. package/editions/ae/lib/icons/make-png.js +25 -0
  18. package/editions/ae/lib/icons/png/dot-error.png +0 -0
  19. package/editions/ae/lib/icons/png/dot-error@2x.png +0 -0
  20. package/editions/ae/lib/icons/png/dot-idle.png +0 -0
  21. package/editions/ae/lib/icons/png/dot-idle@2x.png +0 -0
  22. package/editions/ae/lib/icons/png/dot-running.png +0 -0
  23. package/editions/ae/lib/icons/png/dot-running@2x.png +0 -0
  24. package/editions/ae/lib/icons/png/power-off.png +0 -0
  25. package/editions/ae/lib/icons/png/power-off@2x.png +0 -0
  26. package/editions/ae/lib/icons/png/power-on.png +0 -0
  27. package/editions/ae/lib/icons/png/power-on@2x.png +0 -0
  28. package/editions/ae/lib/icons/png/settings.png +0 -0
  29. package/editions/ae/lib/icons/png/settings@2x.png +0 -0
  30. package/editions/ae/lib/icons/png/status-error.png +0 -0
  31. package/editions/ae/lib/icons/png/status-error@2x.png +0 -0
  32. package/editions/ae/lib/icons/png/status-ok.png +0 -0
  33. package/editions/ae/lib/icons/png/status-ok@2x.png +0 -0
  34. package/editions/ae/lib/icons/png/status-rejected.png +0 -0
  35. package/editions/ae/lib/icons/png/status-rejected@2x.png +0 -0
  36. package/editions/ae/lib/icons/png/status-timeout.png +0 -0
  37. package/editions/ae/lib/icons/png/status-timeout@2x.png +0 -0
  38. package/editions/ae/lib/icons/png/status-unknown.png +0 -0
  39. package/editions/ae/lib/icons/png/status-unknown@2x.png +0 -0
  40. package/editions/ae/lib/icons/power-off.svg +4 -0
  41. package/editions/ae/lib/icons/power-on.svg +4 -0
  42. package/editions/ae/lib/icons/settings.svg +4 -0
  43. package/editions/ae/lib/icons/status-error.svg +4 -0
  44. package/editions/ae/lib/icons/status-ok.svg +4 -0
  45. package/editions/ae/lib/icons/status-rejected.svg +4 -0
  46. package/editions/ae/lib/icons/status-timeout.svg +4 -0
  47. package/editions/ae/lib/icons/status-unknown.svg +5 -0
  48. package/editions/ae/lib/panel-core.jsxinc +249 -0
  49. package/editions/ae/lib/update-key.pem +11 -0
  50. package/editions/ae/lib/updater.jsxinc +148 -0
  51. package/editions/ae/library-starter/INDEX.md +5 -0
  52. package/editions/ae/library-starter/README.md +161 -0
  53. package/editions/ae/library-starter/_common.jsx +187 -0
  54. package/editions/ae/library-starter/categories.json +9 -0
  55. package/editions/ae/library-starter/recipes/.gitkeep +0 -0
  56. package/editions/ae/package.json +7 -0
  57. package/editions/ae/panel/Playrig.jsx +39 -0
  58. package/editions/ae/panel/core.jsx +1026 -0
  59. package/editions/ae/skills/create-ae-recipe/SKILL.md +85 -0
  60. package/editions/ae/skills/create-ae-recipe/references/ae-patterns.md +88 -0
  61. package/editions/ae/skills/create-ae-recipe/references/video-analysis.md +72 -0
  62. package/editions/ae/skills/create-ae-recipe/scripts/media +5 -0
  63. package/editions/ae/skills/create-ae-recipe/scripts/media.py +253 -0
  64. package/editions/ae/skills/create-ae-recipe/scripts/setup.sh +17 -0
  65. package/editions/ae/skills/create-ae-video/SKILL.md +88 -0
  66. package/editions/ae/skills/create-ae-video/references/templates.md +90 -0
  67. package/editions/ae/skills/create-ae-video/scripts/preflight.js +99 -0
  68. package/editions/ae/skills/use-ae-recipes/SKILL.md +99 -0
  69. package/editions/ae/skills/use-ae-recipes/scripts/contact-sheet.jsx +10 -0
  70. package/editions/ae/skills/use-ae-recipes/scripts/edit-text.jsx +12 -0
  71. package/editions/ae/skills/use-ae-recipes/scripts/remove-comp.jsx +18 -0
  72. package/editions/pr/README.md +60 -0
  73. package/editions/pr/SCORE_PROCESS.md +41 -0
  74. package/editions/pr/client/aeb.js +9 -0
  75. package/editions/pr/examples/frame.js +6 -0
  76. package/editions/pr/examples/hello.js +4 -0
  77. package/editions/pr/organize.default.json +245 -0
  78. package/editions/pr/package.json +7 -0
  79. package/editions/pr/plugin/actions.js +79 -0
  80. package/editions/pr/plugin/dev.js +19 -0
  81. package/editions/pr/plugin/icons/README.md +4 -0
  82. package/editions/pr/plugin/icons/file-code.svg +6 -0
  83. package/editions/pr/plugin/icons/folder.svg +3 -0
  84. package/editions/pr/plugin/icons/power-off.svg +4 -0
  85. package/editions/pr/plugin/icons/power-on.svg +4 -0
  86. package/editions/pr/plugin/icons/settings.svg +4 -0
  87. package/editions/pr/plugin/icons/status-error.svg +4 -0
  88. package/editions/pr/plugin/icons/status-ok.svg +4 -0
  89. package/editions/pr/plugin/icons/status-rejected.svg +4 -0
  90. package/editions/pr/plugin/icons/status-timeout.svg +4 -0
  91. package/editions/pr/plugin/icons/status-unknown.svg +5 -0
  92. package/editions/pr/plugin/incremental.js +212 -0
  93. package/editions/pr/plugin/index.html +195 -0
  94. package/editions/pr/plugin/index.js +710 -0
  95. package/editions/pr/plugin/manifest.json +45 -0
  96. package/editions/pr/plugin/organize.js +223 -0
  97. package/editions/pr/skills/score-video/SKILL.md +69 -0
  98. package/editions/pr/skills/score-video/scripts/mix.py +112 -0
  99. package/editions/pr/skills/score-video/scripts/place.js +63 -0
  100. package/lib/ae.js +754 -0
  101. package/lib/common.js +132 -0
  102. package/lib/install.js +149 -0
  103. package/lib/main.js +107 -0
  104. package/lib/payload.js +84 -0
  105. package/lib/pr.js +239 -0
  106. package/lib/update.js +119 -0
  107. package/package.json +35 -4
  108. package/skills/create-video/SKILL.md +72 -0
  109. package/skills/create-video/references/lessons.md +31 -0
  110. package/skills/create-video/references/project-conventions.md +46 -0
  111. package/skills/create-video/scripts/ae/list-project.jsx +8 -0
  112. package/skills/create-video/scripts/ae/move-chips.jsx +14 -0
  113. package/skills/create-video/scripts/ae/organize-project.jsx +25 -0
  114. package/skills/create-video/scripts/ae/quadrant-chips.jsx +143 -0
  115. package/skills/create-video/scripts/ae/render-comps.jsx +16 -0
  116. package/skills/create-video/scripts/premiere/export-sequences.js +22 -0
  117. package/skills/create-video/scripts/premiere/make-sequences.js +24 -0
  118. package/skills/create-video/scripts/premiere/swap-media.js +43 -0
package/lib/pr.js ADDED
@@ -0,0 +1,239 @@
1
+ 'use strict';
2
+ // playrig-pr client: submits JavaScript (.js) jobs to the UXP panel, reads results.
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const C = require('./common');
7
+ const { ID_RE, USAGE, die, writeAtomic, defaultId, sleep, readResult } = C;
8
+ const APP = C.APPS.pr;
9
+ const rootDir = (flags) => C.rootDir(APP, flags);
10
+
11
+ function parseSnap(spec) {
12
+ const at = spec.lastIndexOf('@');
13
+ if (at < 1) die(`Bad --snap "${spec}". Expected "<sequence>@t1,t2,..."`);
14
+ const times = spec.slice(at + 1).split(',').map((s) => Number(s.trim()));
15
+ if (!times.length || times.some((t) => !Number.isFinite(t))) die(`Bad times in --snap "${spec}"`);
16
+ return { sequence: spec.slice(0, at), times };
17
+ }
18
+
19
+ function parseInspect(spec) {
20
+ const colon = spec.lastIndexOf(':');
21
+ if (colon > 0 && /^\d+$/.test(spec.slice(colon + 1))) return { sequence: spec.slice(0, colon), depth: Number(spec.slice(colon + 1)) };
22
+ return { sequence: spec, depth: 1 };
23
+ }
24
+
25
+ function printResult(root, r, opts = {}) {
26
+ const outDir = path.join(root, 'out', r.id);
27
+ const lines = [];
28
+ lines.push(`[${r.status}] ${r.id}${r.durationMs != null ? ` (${r.durationMs} ms)` : ''}${r.appVersion ? ` Premiere ${r.appVersion}` : ''}`);
29
+ if (r.description) lines.push(`about: ${r.description}`);
30
+ if (r.project && r.project.path) lines.push(`project: ${r.project.path}${r.project.dirty ? ' (unsaved changes)' : ''}`);
31
+ if (r.error) {
32
+ lines.push(`error: ${r.error.message}${r.error.line ? ` (line ${r.error.line}${r.error.fileName ? ' of ' + r.error.fileName : ''})` : ''}`);
33
+ if (r.error.source != null) lines.push(` > ${String(r.error.source).trim()}`);
34
+ }
35
+ if (r.sync) lines.push(`project log: ${r.sync.ok ? r.sync.dir : 'NOT SYNCED (' + r.sync.reason + ')'}`);
36
+ if (r.backup) lines.push(`backup: ${r.backup.ok ? r.backup.file : 'none (' + r.backup.reason + ')'}`);
37
+ if (r.log && r.log.length) { lines.push('log:'); r.log.forEach((l) => lines.push(` ${l}`)); }
38
+ if (r.snapshots && r.snapshots.length) {
39
+ lines.push('snapshots:');
40
+ r.snapshots.forEach((s) => {
41
+ lines.push(s.ok ? ` ${path.join(outDir, s.file)}` : ` FAILED ${s.sequence} @ ${s.time}: ${s.error || 'unknown'}`);
42
+ });
43
+ }
44
+ if (r.returnValue !== null && r.returnValue !== undefined) lines.push(`return: ${JSON.stringify(r.returnValue)}`);
45
+ if (r.inspect && opts.showInspect) lines.push(`inspect: ${JSON.stringify(r.inspect, null, 2)}`);
46
+ lines.push(`result: ${path.join(outDir, 'result.json')}`);
47
+ console.log(lines.join('\n'));
48
+ }
49
+
50
+ // Writes options + job into the inbox and waits for result.json. `source` is the job text (string or Buffer).
51
+ async function submitJob(root, id, source, flags, extraOptions) {
52
+ if (!ID_RE.test(id)) die(`Bad id "${id}". Must match ^[A-Za-z0-9_-]{1,64}$`);
53
+ if (Buffer.byteLength(source) > 2 * 1024 * 1024) die('Job file is larger than 2 MB');
54
+
55
+ const inbox = path.join(root, 'inbox');
56
+ fs.mkdirSync(inbox, { recursive: true });
57
+ fs.mkdirSync(path.join(root, 'out'), { recursive: true });
58
+ if (fs.existsSync(path.join(root, 'out', id, 'result.json'))) die(`Job id "${id}" already has a result. Use a new --id.`);
59
+
60
+ const timeoutSec = flags.timeout !== undefined ? Number(flags.timeout) : 120;
61
+ if (!Number.isFinite(timeoutSec) || timeoutSec <= 0) die('--timeout must be a positive number of seconds');
62
+ const options = { timeoutSec, ...extraOptions };
63
+ if (flags.desc) options.description = String(flags.desc).slice(0, 240);
64
+ if (flags.action) options.action = String(flags.action).slice(0, 40);
65
+ if (flags['no-undo']) options.undoGroup = false;
66
+ const snaps = [...(options.snapshots || []), ...(flags.snap || []).map(parseSnap)];
67
+ if (snaps.length) options.snapshots = snaps;
68
+ if (flags.inspect) options.inspect = parseInspect(flags.inspect);
69
+
70
+ // Options first, then the job. The panel only reacts to <id>.js.
71
+ writeAtomic(path.join(inbox, `${id}.json`), JSON.stringify(options, null, 2));
72
+ writeAtomic(path.join(inbox, `${id}.js`), source);
73
+
74
+ const deadline = Date.now() + (timeoutSec + 60) * 1000;
75
+ let r = null;
76
+ while (Date.now() < deadline) {
77
+ r = readResult(root, id);
78
+ if (r) break;
79
+ await sleep(250);
80
+ }
81
+ if (!r) {
82
+ die(`No result for "${id}" after ${timeoutSec + 60} s. Is Premiere Pro open with the Playrig panel started (press Start)?\n` +
83
+ `Job is still in ${inbox} or ${path.join(root, 'running')}.`, 3);
84
+ }
85
+ return r;
86
+ }
87
+
88
+ async function cmdRun(pos, flags) {
89
+ const root = rootDir(flags);
90
+ const jsxPath = pos[0];
91
+ if (!jsxPath) die(`Missing <file.js>\n\n${USAGE}`);
92
+ if (!fs.existsSync(jsxPath)) die(`File not found: ${jsxPath}`);
93
+ const r = await submitJob(root, flags.id || defaultId(jsxPath), fs.readFileSync(jsxPath), flags, {});
94
+ finish(root, r, flags);
95
+ }
96
+
97
+ // ------------------------------------------------------------------ scratch: track and remove experimental sequences / items
98
+ // Same idea as the After Effects edition: record what the project holds, experiment freely (clone sequences, import test files),
99
+ // then remove exactly what was added. Sequences are deleted; project items removed from their bin. Files on disk are never touched.
100
+ function scratchFile(root) { return path.join(root, 'scratch-baseline.json'); }
101
+
102
+ const SCRATCH_SCAN = `
103
+ const gid = (s) => { try { return String(s.guid); } catch (e) { return s.name; } };
104
+ const seqs = []; for (const s of await PLAYRIG.project.getSequences()) seqs.push({ id: gid(s), name: s.name });
105
+ const items = [];
106
+ async function walk(folder, path) {
107
+ for (const it of await folder.getItems()) {
108
+ let bin = null; try { bin = ppro.FolderItem.cast(it); } catch (e) { }
109
+ const id = String(await it.getId());
110
+ items.push({ id, name: it.name, path: path, bin: !!bin });
111
+ if (bin) await walk(bin, path + "/" + it.name);
112
+ }
113
+ }
114
+ await walk(await PLAYRIG.project.getRootItem(), "");
115
+ `;
116
+
117
+ async function scratchJob(root, label, source) {
118
+ const stamp = new Date().toISOString().replace(/\D/g, '').slice(2, 14);
119
+ const r = await submitJob(root, `scratch-${label}-${stamp}`, source, { snap: [] }, { action: label === 'clean' ? 'scratch.cleanup' : 'scratch.baseline', description: label === 'clean' ? 'Removed the sequences and items added since the scratch baseline.' : 'Recorded or compared the project against the scratch baseline.' });
120
+ if (r.status !== 'ok') { printResult(root, r); die('scratch job failed', 1); }
121
+ return r;
122
+ }
123
+
124
+ async function cmdScratch(pos, flags) {
125
+ const root = rootDir(flags);
126
+ const sub = pos[0];
127
+ if (sub === 'start') {
128
+ const r = await scratchJob(root, 'start', `${SCRATCH_SCAN}\nPLAYRIG.ret({ project: PLAYRIG.project.path, seqs, items });`);
129
+ fs.writeFileSync(scratchFile(root), JSON.stringify(r.returnValue));
130
+ console.log(`Baseline recorded: ${r.returnValue.seqs.length} sequences, ${r.returnValue.items.length} project items in ${r.returnValue.project}. Run \`playrig pr scratch clean --yes\` when done experimenting.`);
131
+ return;
132
+ }
133
+ if (sub !== 'status' && sub !== 'clean') die(USAGE);
134
+ if (!fs.existsSync(scratchFile(root))) die('No baseline. Run: playrig pr scratch start', 1);
135
+ const base = JSON.parse(fs.readFileSync(scratchFile(root), 'utf8'));
136
+ if (sub === 'clean' && !flags.yes) die('This removes sequences and project items created since `scratch start`. Run `playrig pr scratch status` to see them, then add --yes.', 1);
137
+ const job = `${SCRATCH_SCAN}
138
+ const base = ${JSON.stringify(base)};
139
+ if (base.project !== PLAYRIG.project.path) throw new Error("A different project is open than when the baseline was recorded. Run: playrig pr scratch start");
140
+ const oldSeq = new Set(base.seqs.map((s) => s.id)), oldItem = new Set(base.items.map((i) => i.id));
141
+ const newSeqs = seqs.filter((s) => !oldSeq.has(s.id));
142
+ const newItems = items.filter((i) => !oldItem.has(i.id));
143
+ const report = { sequences: newSeqs.map((s) => s.name), items: newItems.map((i) => (i.bin ? "bin " : "") + i.path + "/" + i.name) };
144
+ if (${sub === 'clean' ? 'true' : 'false'}) {
145
+ const removed = { sequences: [], items: [], failed: [] };
146
+ for (const ns of newSeqs) { try { const s = (await PLAYRIG.project.getSequences()).find((x) => gid(x) === ns.id); if (s && (await PLAYRIG.project.deleteSequence(s))) removed.sequences.push(ns.name); } catch (e) { removed.failed.push("sequence " + ns.name + ": " + e.message); } }
147
+ // project items that still exist (imports, bins): remove each from its parent bin
148
+ const root = await PLAYRIG.project.getRootItem();
149
+ const find = async (folder, id) => { for (const it of await folder.getItems()) { if (String(await it.getId()) === id) return { it, parent: folder }; let b = null; try { b = ppro.FolderItem.cast(it); } catch (e) { } if (b) { const f = await find(b, id); if (f) return f; } } return null; };
150
+ for (const ni of newItems.slice().reverse()) {
151
+ try { const f = await find(root, ni.id); if (!f) continue; await PLAYRIG.transact("Playrig: scratch clean", (ca) => { ca.addAction(f.parent.createRemoveItemAction(f.it)); }); removed.items.push(ni.name); }
152
+ catch (e) { removed.failed.push("item " + ni.name + ": " + e.message); }
153
+ }
154
+ report.removed = removed;
155
+ }
156
+ PLAYRIG.ret(report);`;
157
+ const r = await scratchJob(root, sub, job);
158
+ const v = r.returnValue;
159
+ if (sub === 'status') {
160
+ console.log(`Since baseline: ${v.sequences.length} new sequence(s), ${v.items.length} new project item(s).`);
161
+ v.sequences.forEach((n) => console.log(` sequence: ${n}`));
162
+ v.items.forEach((n) => console.log(` item: ${n}`));
163
+ if (v.sequences.length + v.items.length) console.log('Remove with: playrig pr scratch clean --yes');
164
+ } else {
165
+ console.log(`Removed ${v.removed.sequences.length} sequence(s), ${v.removed.items.length} project item(s).`);
166
+ v.removed.sequences.forEach((n) => console.log(` sequence: ${n}`));
167
+ v.removed.failed.forEach((n) => console.log(` FAILED ${n}`));
168
+ }
169
+ }
170
+
171
+ function cmdStatus(pos, flags) {
172
+ const root = rootDir(flags);
173
+ const id = pos[0];
174
+ if (!id || !ID_RE.test(id)) die(`Missing or bad <id>\n\n${USAGE}`);
175
+ const r = readResult(root, id);
176
+ if (r) { printResult(root, r); process.exit(r.status === 'ok' ? 0 : 1); }
177
+ if (fs.existsSync(path.join(root, 'running', `${id}.js`))) { console.log(`[running] ${id}`); return; }
178
+ if (fs.existsSync(path.join(root, 'inbox', `${id}.js`))) { console.log(`[queued] ${id}`); return; }
179
+ die(`Unknown job "${id}"`, 1);
180
+ }
181
+
182
+ // Job history is per project: by default `tail` shows the jobs of the project the most recent job ran in (so an agent never reads another
183
+ // project's history by mistake). --all lists everything, --project <path-or-name> picks one.
184
+ function cmdTail(flags) {
185
+ const root = rootDir(flags);
186
+ const out = path.join(root, 'out');
187
+ if (!fs.existsSync(out)) die(`No out folder at ${out}`, 1);
188
+ const all = fs.readdirSync(out)
189
+ .map((d) => ({ d, f: path.join(out, d, 'result.json') }))
190
+ .filter((x) => fs.existsSync(x.f))
191
+ .map((x) => { try { return { ...x, t: fs.statSync(x.f).mtimeMs, r: JSON.parse(fs.readFileSync(x.f, 'utf8')) }; } catch (e) { return null; } })
192
+ .filter(Boolean)
193
+ .sort((a, b) => b.t - a.t);
194
+ if (!all.length) { console.log('No results yet.'); return; }
195
+ const projOf = (x) => (x.r.project && x.r.project.path) || '';
196
+ let rows = all, label = 'all projects';
197
+ if (!flags.all) {
198
+ const want = flags.project || projOf(all.find((x) => projOf(x)) || all[0]);
199
+ rows = all.filter((x) => projOf(x) === want || (flags.project && projOf(x).includes(flags.project)));
200
+ label = want ? path.basename(want) : '(no project recorded)';
201
+ }
202
+ console.log(`Jobs for: ${label}${flags.all ? '' : ' (use --all for every project)'}`);
203
+ rows.slice(0, 5).forEach((x) => {
204
+ const r = x.r, err = r.error ? ` - ${r.error.message}` : '', proj = flags.all && projOf(x) ? ` [${path.basename(projOf(x))}]` : '';
205
+ console.log(`${new Date(x.t).toISOString()} [${r.status}] ${r.id}${proj}${err}`);
206
+ });
207
+ }
208
+
209
+ async function main(sub, pos, flags) {
210
+ if (sub === 'run') return cmdRun(pos, flags);
211
+ if (sub === 'status') return cmdStatus(pos, flags);
212
+ if (sub === 'tail') return cmdTail(flags);
213
+ if (sub === 'scratch') return cmdScratch(pos, flags);
214
+ if (sub === 'snap') return cmdSnap(pos, flags);
215
+ if (sub === 'inspect') return cmdInspect(pos, flags);
216
+ return die(USAGE);
217
+ }
218
+
219
+ // snap / inspect: a no-op job that only carries the snapshot / inspect request.
220
+ async function cmdSnap(pos, flags) {
221
+ if (!pos.length) die('Usage: playrig pr snap "<sequence>@t1,t2,..." [more specs]');
222
+ const root = rootDir(flags);
223
+ const r = await submitJob(root, flags.id || defaultId('snap'), 'PLAYRIG.log("snapshot");', { ...flags, snap: [...flags.snap, ...pos], action: 'frame.export', desc: flags.desc || 'Exported frames' }, {});
224
+ finish(root, r, flags);
225
+ }
226
+ async function cmdInspect(pos, flags) {
227
+ if (!pos[0]) die('Usage: playrig pr inspect "<sequence>"');
228
+ const root = rootDir(flags);
229
+ const r = await submitJob(root, flags.id || defaultId('inspect'), 'PLAYRIG.log("inspect");', { ...flags, inspect: pos[0], action: 'project.inspect', desc: flags.desc || 'Inspected a sequence' }, {});
230
+ finish(root, r, { ...flags, inspect: pos[0] });
231
+ }
232
+
233
+ function finish(root, r, flags) {
234
+ if (flags.json) console.log(JSON.stringify(r, null, 2));
235
+ else printResult(root, r, { showInspect: !!flags.inspect });
236
+ process.exit(r.status === 'ok' ? 0 : 1);
237
+ }
238
+
239
+ module.exports = { main };
package/lib/update.js ADDED
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+ // playrig update [ae|pr|cli] [--check]
3
+ // The same trust rules as the panel's updater: pinned release URL, SHA-256 from the feed, RSA-SHA256 signature checked against the
4
+ // public key shipped with the edition (packages/ae/lib/update-key.pem). `update ae` installs into the user's data folder, which the
5
+ // After Effects stub prefers over its bundled copy; `update pr` downloads the .ccx and opens it with Creative Cloud.
6
+ const crypto = require('crypto');
7
+ const fs = require('fs');
8
+ const os = require('os');
9
+ const path = require('path');
10
+ const cp = require('child_process');
11
+ const C = require('./common');
12
+ const P = require('./payload');
13
+
14
+ const FEED = 'https://raw.githubusercontent.com/viveknigam3003/playrig-releases/main/versions.json';
15
+ const ASSET_PREFIX = 'https://github.com/viveknigam3003/playrig-releases/releases/download/';
16
+
17
+ const ver = (v) => { const m = /(\d+)\.(\d+)\.(\d+)/.exec(String(v || '')); return m ? [+m[1], +m[2], +m[3]] : null; };
18
+ const isNewer = (a, b) => { a = ver(a); b = ver(b); if (!a || !b) return false; for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i]; return false; };
19
+
20
+ const userBase = () => process.platform === 'win32'
21
+ ? path.join(process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming'), 'Playrig', 'ae')
22
+ : path.join(os.homedir(), 'Library', 'Application Support', 'Playrig', 'ae');
23
+
24
+ function versionIn(dir) { try { return P.readJSON(path.join(dir, 'version.json')).version; } catch (e) { return null; } }
25
+
26
+ // Newest After Effects payload this machine will load: the user's data folder or the copy beside the stub.
27
+ function installedAE() {
28
+ const found = [versionIn(path.join(userBase(), 'current'))];
29
+ const bases = process.platform === 'win32' ? [path.join(process.env.ProgramFiles || 'C:\\Program Files', 'Adobe')] : ['/Applications'];
30
+ for (const b of bases) {
31
+ if (!fs.existsSync(b)) continue;
32
+ for (const d of fs.readdirSync(b)) if (/^Adobe After Effects/.test(d)) {
33
+ const rel = process.platform === 'win32' ? path.join('Support Files', 'Scripts', 'ScriptUI Panels') : path.join('Scripts', 'ScriptUI Panels');
34
+ found.push(versionIn(path.join(b, d, rel, 'Playrig lib')));
35
+ }
36
+ }
37
+ return found.filter(Boolean).sort((x, y) => (isNewer(x, y) ? -1 : isNewer(y, x) ? 1 : 0))[0] || null;
38
+ }
39
+
40
+ async function getFeed() {
41
+ const url = process.env.PLAYRIG_FEED || FEED;
42
+ const res = await fetch(url);
43
+ if (res.status === 404) throw new Error('No update feed is published yet.');
44
+ if (!res.ok) throw new Error(`Could not read the update feed (${res.status}).`);
45
+ return { feed: await res.json(), custom: !!process.env.PLAYRIG_FEED };
46
+ }
47
+
48
+ async function download(entry, custom) {
49
+ if (!custom && !String(entry.url).startsWith(ASSET_PREFIX)) throw new Error('The update URL is not on the Playrig releases page; refusing it.');
50
+ const res = await fetch(entry.url);
51
+ if (!res.ok) throw new Error(`Download failed (${res.status}).`);
52
+ const bytes = Buffer.from(await res.arrayBuffer());
53
+ if (crypto.createHash('sha256').update(bytes).digest('hex') !== String(entry.sha256).toLowerCase()) throw new Error('Checksum mismatch: the download is not the release that was published. Nothing was installed.');
54
+ const key = path.join(C.editionDir('ae') || '', 'lib', 'update-key.pem');
55
+ if (!fs.existsSync(key)) throw new Error('update-key.pem not found; cannot verify the update.');
56
+ if (!crypto.verify('sha256', bytes, fs.readFileSync(key), Buffer.from(String(entry.sig), 'base64'))) throw new Error('Signature check failed: the update was not signed by Playrig. Nothing was installed.');
57
+ return bytes;
58
+ }
59
+
60
+ function extract(zip, dest) {
61
+ fs.mkdirSync(dest, { recursive: true });
62
+ const r = process.platform === 'win32' ? cp.spawnSync('tar', ['-xf', zip, '-C', dest]) : cp.spawnSync('unzip', ['-q', '-o', zip, '-d', dest]);
63
+ if (r.status !== 0) throw new Error('Could not unpack the update.');
64
+ }
65
+
66
+ async function updateAE(entry, custom) {
67
+ if (entry.stubApi && Number(entry.stubApi) > P.STUB_API) throw new Error(`Version ${entry.version} needs a newer Playrig.jsx: run \`playrig install ae\`.`);
68
+ const bytes = await download(entry, custom);
69
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'playrig-update-'));
70
+ const base = userBase(), fresh = path.join(base, `new-${Date.now()}`);
71
+ try {
72
+ const zip = path.join(tmp, 'payload.zip');
73
+ fs.writeFileSync(zip, bytes);
74
+ extract(zip, fresh);
75
+ if (!fs.existsSync(path.join(fresh, 'core.jsx')) || versionIn(fresh) !== entry.version) throw new Error('The unpacked update is not the expected version.');
76
+ fs.rmSync(path.join(base, 'previous'), { recursive: true, force: true });
77
+ if (fs.existsSync(path.join(base, 'current'))) fs.renameSync(path.join(base, 'current'), path.join(base, 'previous'));
78
+ fs.renameSync(fresh, path.join(base, 'current'));
79
+ } finally { fs.rmSync(tmp, { recursive: true, force: true }); fs.rmSync(fresh, { recursive: true, force: true }); }
80
+ console.log(`playrig-ae ${entry.version} installed. Restart After Effects to use it.`);
81
+ }
82
+
83
+ async function updatePR(entry, custom) {
84
+ const bytes = await download(entry, custom);
85
+ const file = path.join(os.homedir(), 'Documents', 'Playrig', `Playrig (PR) ${entry.version}.ccx`);
86
+ fs.mkdirSync(path.dirname(file), { recursive: true });
87
+ fs.writeFileSync(file, bytes);
88
+ console.log(`Downloaded and verified ${file}`);
89
+ const opener = process.platform === 'darwin' ? ['open', [file]] : process.platform === 'win32' ? ['cmd', ['/c', 'start', '', file]] : null;
90
+ if (opener) { cp.spawnSync(opener[0], opener[1], { stdio: 'ignore' }); console.log('Opened it with the Creative Cloud installer. Confirm the install there.'); }
91
+ }
92
+
93
+ async function update(pos, flags) {
94
+ const what = pos[0];
95
+ if (process.platform !== 'darwin' && (what === 'ae' || what === 'pr')) C.die('Playrig supports macOS only for now (Windows is not supported yet).', 1);
96
+ if (what && !['ae', 'pr', 'cli'].includes(what)) C.die('Usage: playrig update [ae|pr|cli] [--check]');
97
+ const { feed, custom } = await getFeed();
98
+ const have = {
99
+ ae: installedAE() || (C.editionDir('ae') && P.editionVersion('ae')) || null,
100
+ pr: C.editionDir('pr') ? P.readJSON(path.join(C.editionDir('pr'), 'plugin', 'manifest.json')).version : null,
101
+ cli: P.readJSON(path.join(C.CLI_DIR, 'package.json')).version,
102
+ };
103
+ const names = { ae: 'playrig-ae', pr: 'playrig-pr', cli: 'playrig' };
104
+ let pending = 0;
105
+ for (const id of (what ? [what] : ['ae', 'pr', 'cli'])) {
106
+ const e = feed[id];
107
+ if (!e) { console.log(`${names[id]}: no release published yet.`); continue; }
108
+ const newer = isNewer(e.version, have[id]);
109
+ if (newer) pending++;
110
+ console.log(`${names[id]}: ${have[id] || 'not installed'}${newer ? ` -> ${e.version} available${e.notes ? ` (${e.notes})` : ''}` : ' (up to date)'}`);
111
+ if (!newer || flags.check) continue;
112
+ if (id === 'ae') await updateAE(e, custom);
113
+ else if (id === 'pr') await updatePR(e, custom);
114
+ else console.log(' Update the CLI with: npm install -g playrig@latest');
115
+ }
116
+ if (flags.check && pending) process.exitCode = 10; // handy for scripts: 10 = an update is available
117
+ }
118
+
119
+ module.exports = { update, isNewer, installedAE, userBase };
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "playrig",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Playrig lets Claude, Codex or any coding agent control After Effects and Premiere Pro.",
5
+ "bin": {
6
+ "playrig": "bin/playrig.js",
7
+ "prg": "bin/playrig.js"
8
+ },
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "lib",
15
+ "skills",
16
+ "editions",
17
+ "LICENSE",
18
+ "README.md",
19
+ "AGENTS.md"
20
+ ],
21
+ "scripts": {
22
+ "prepack": "node scripts/stage.js stage",
23
+ "postpack": "node scripts/stage.js clean",
24
+ "test": "node test/cli.test.js && node test/updater.test.js && node test/update-cli.test.js"
25
+ },
26
+ "keywords": [
27
+ "after-effects",
28
+ "premiere-pro",
29
+ "adobe",
30
+ "agent",
31
+ "claude",
32
+ "codex",
33
+ "video",
34
+ "automation"
35
+ ],
36
+ "license": "SEE LICENSE IN LICENSE"
37
+ }
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: create-video
3
+ description: End-to-end workflow for making a short motion video with Claude across After Effects, Premiere Pro and Epidemic Sound, using the playrig-ae and playrig-pr, in the user's own project layout. Covers brief and storyboard, building scenes in AE (wide AND portrait), keeping AE tidy, rendering, syncing to Premiere sequences, scoring (music + SFX) via score-video, and exporting to the project's final folders. Use at the start of any request to make, animate, recreate, sync, score or export a video, or when the user continues a video already in progress ("update the pills", "sync it with Premiere", "export the video").
4
+ ---
5
+
6
+ # create-video
7
+
8
+ You are the conductor of a small production pipeline. The user sketches the idea in plain words, reacts to what they see, and expects you to carry it through After Effects (AE) -> Premiere Pro (PP) -> sound -> final export without being walked step by step. This skill holds how that user likes to work, how their projects are laid out, and the traps already hit.
9
+
10
+ Delegate to `score-video` (music + SFX) rather than duplicating it. This skill decides *which* applies and glues the Premiere side. Load `references/project-conventions.md` (layout, naming) and `references/lessons.md` (gotchas) when you reach those phases; do not read them upfront.
11
+
12
+ ## Ground rules (the user has stated or enforced every one)
13
+ 1. **Never save** an AE or PP project. The user saves. Every job is one Undo step. Say "unsaved" in handovers.
14
+ 2. **Never delete or rebuild what exists unless asked.** Adding a new comp/sequence: yes. Changing a scene: **edit the existing comps in place** (move a layer, change a value) instead of remove-and-rebuild. The user called out repeated rebuilds explicitly. Rebuild only if the change cannot be done in place, and say why first.
15
+ 3. **Never overwrite a file** another app has imported. Render and export to new versioned names (`_v2`), and `5_FINAL` files carry `_FINAL`.
16
+ 4. **Downstream is stale after an upstream change**: say so in one line and offer the sync (re-render, swap in PP, re-sound, re-export). Do it when told ("sync it with Premiere", "export it").
17
+ 5. **Look at frames before claiming anything** (start, mid, end of each move, and the last frame). Measure audio; never claim how it sounds ("measured, not heard").
18
+ 6. **The user renames and reorganises** (sequences, bins, AE folders). Look targets up by name freshly each time, expect renames, and read state before every job.
19
+ 7. **Say what you could not verify**, plainly, with the evidence for the rest.
20
+
21
+ ## How to talk to this user
22
+ - Short status lines at each step ("rebuilding the portrait comp"), a visible result quickly, then concrete questions only when the answer changes the outcome (e.g. a font that isn't installed and needs an AE restart: ask once, recommend one option).
23
+ - They give a detailed brief once, then iterate with short reactions ("a bit faster", "bigger", "flip that"). Treat each as a precise change request; keep what they did not mention.
24
+ - Think out loud about *process* when asked ("think through how you're doing it so we can make it a skill"); otherwise be concise.
25
+ - They notice content errors you did not: a flipped axis, chips placed at random so claims were false. Run a **content sanity pass** (below) before showing, and own mistakes in one sentence.
26
+ - Never imply they said something they did not. Quote or paraphrase accurately.
27
+
28
+ ## The pipeline
29
+
30
+ ### 0. Preflight (before asking anything)
31
+ - the After Effects and Premiere Pro panels answering (both panels started), project open in each, `ffmpeg`/`python3` present, Epidemic Sound tools loaded if sound is in scope. Fonts the brief names are installed *in AE* (check `app.fonts`); if not, ask once (install + AE restart needs the project saved; or use an installed stand-in and keep the font name in one constant).
32
+ - Read the PP job log's `project:` line and list the project folder: it has the numbered folders in `references/project-conventions.md`. Resuming? Read `EDIT_LOGS` and list existing comps/sequences first and ask whether to continue them.
33
+
34
+ ### 1. Brief (<= 5 questions, state assumptions)
35
+ Purpose, length (default 7-15 s, 24 fps), **formats (default: wide 1920x1080 AND portrait 1080x1920 as two real scenes, never a letterboxed crop)**, content/labels, tone. End with a 6-line brief the user can correct. Ask whether sound is wanted.
36
+
37
+ ### 2. Content sanity pass (when the video makes claims)
38
+ If the picture asserts something (a chart, a ranking, quadrants, comparisons), reason through whether each placement is *true* before building, say it is a judgement, and name the two or three most arguable calls. Placement must use the whole canvas honestly (e.g. every quadrant of a 2x2 gets used when the data supports it; quality can be stated *relative* to the items shown). Axis direction and label wording are part of this check (top = "most", bottom = "least").
39
+
40
+ ### 3. Build in AE
41
+ - Build scenes with a job script kept in `scenes/` (see `scripts/ae/quadrant-chips.jsx` as the worked example: parameterised by `--param portrait=1`, one constants block for sizes/fonts/timings). Read `create-ae-video` for storyboard/gates when the piece is larger than one scene.
42
+ - **Motion defaults the user asked for**: every move on Bezier temporal ease (symmetric 50/50 for travel, ~10/90 for ease-out landings), no linear or erratic motion; pops are a short scale overshoot (about 114%) that settles, not a plain fade; typewriter text one glyph per frame; elements reveal outward from the centre; axes/lines get arrowheads that land as the line arrives.
43
+ - **Legibility is judged at viewing size.** 16 px text on 1920 wide was unreadable; scale type with one factor (`K`, bigger for portrait) and check a real frame. Labels must not cross axis lines or other elements; check chips against axes, labels and frame edges.
44
+ - Portrait is its own layout (fewer columns): re-space, do not just rotate the wide one.
45
+ - File the result: `01_COMPS/<aspect>` and `02_ASSETS` via `scripts/ae/organize-project.jsx` (moves only).
46
+ - Show a contact sheet / final frames of **both** formats and ask for a reaction before moving on.
47
+
48
+ ### 4. Iterate in place
49
+ Use `scripts/ae/move-chips.jsx` style edits (set a layer's value in the existing comp). After each change re-snap a frame. Keep the scene script in step with the comps so a future rebuild matches. Unique `--id` per bridge call when two run in the same second (collisions fail silently).
50
+
51
+ ### 5. Render from AE
52
+ `scripts/ae/render-comps.jsx` (H.264, AE render queue) into `<project>/1_FOOTAGE/AE_Motion/` with versioned names; it refuses to overwrite. Pull a frame from the mp4 and look at it. The AE project may be unsaved; scripted rendering still works.
53
+
54
+ ### 6. Premiere: sequences from the renders
55
+ `scripts/premiere/make-sequences.js`: import (only what is not already in the project), `createSequenceFromMedia(name, [clip], bin)` so each sequence takes the clip's size (portrait stays 1080x1920). Sequence names: `MASTER - <Title> (Wide 16x9)` / `(Portrait 9x16)`. Playrig auto-files imports into bins; walk bins with `FolderItem.cast`.
56
+
57
+ ### 7. Sound (optional but usually yes)
58
+ Hand to `score-video` with the picture facts: sequence length, event times **measured from the render** (not from the script), label start times and character counts, brand/mood. It owns the music brief, Epidemic search, ducking, SFX and placement. Layout: A1 score, A2/A3 SFX.
59
+
60
+ ### 8. Sync after changes
61
+ `scripts/premiere/swap-media.js`: re-import the new render under its new name, overwrite V1 at 0 in each sequence, then re-lay any audio that depended on the picture (new pop for a new chip, retimed bed). Verify by listing every track: names, start/end, nothing left over. Replace clips **in place with same-length files**; Premiere's remove-clip call does not work through Playrig.
62
+
63
+ ### 9. Export
64
+ Drafts to `4_EXPORTS`. Finals to `5_FINAL/Wide` and `5_FINAL/Vertical` (`_FINAL` names) via `scripts/premiere/export-sequences.js` (preset "Match Source - High bitrate"). Then `ffprobe` size/duration, loudness, and a sync check on the exported audio. Never overwrite an existing export; ask if a name exists.
65
+
66
+ ### 10. Handover (compact)
67
+ Comps/sequences and where they are, what is final vs draft, parameters most worth tweaking, assumptions and judgement calls, what you could not verify, unsaved reminder, stale downstream items, next options. Offer, do not volunteer, risky follow-ups (re-export over files, deleting unused items).
68
+
69
+ ## Quick reference
70
+ - CLI: `playrig ae run <file.jsx> [--param k=v] [--snap "Comp@t,t"] [--id unique] [--no-undo]` and `playrig pr run <file.js> [--snap "Sequence@t"]`. Premiere jobs are modern JS with `ppro`, `BRIDGE`; AE jobs are ES3 with `BRIDGE`.
71
+ - Read a job's result when output is empty: `~/Documents/Playrig/pr/out/<id>/result.json` (AE: `~/Documents/Playrig/ae/out/<id>/result.json`).
72
+ - Scratch files go in the session scratchpad, reusable scripts in `scenes/` (AE) or this skill's `scripts/`.
@@ -0,0 +1,31 @@
1
+ # Lessons and gotchas (each one cost a retry)
2
+
3
+ ## Content and design
4
+ - A chart/ranking video must be *true*: first pass placed brands at random (the brief said random) and put strong cameras in "Overpriced"/"Budget". Reason through each placement, mark it as judgement, use all quadrants, and allow quality to be relative among the items shown.
5
+ - Axis direction is content: "Most Affordable" on top, "Least Affordable" at the bottom; quadrant names and chip positions must follow when an axis flips (flip every chip's row).
6
+ - Text at 16 px on 1920 wide was unreadable; scale all type by one factor and judge a real frame. Portrait needs a larger factor than wide.
7
+ - Chips must not cross an axis line or sit on label zones (labels occupy about +-300 px around the centre, +-100 px vertically in wide).
8
+ - Portrait has few columns: a chip near the right edge (23 px margin) reads as cramped; re-space instead of squeezing.
9
+
10
+ ## After Effects
11
+ - ES3 only. Shape layers are created at the comp centre: set Position [0,0] for absolute-coordinate paths. Add properties first, then fetch property handles (handles go stale when you add siblings).
12
+ - Trim Paths with two sub-paths animates both at once: use it for "grow from centre".
13
+ - Text animator expression selector for typewriter: opacity animator + `textIndex*framesPerChar`; glyph k is first visible on frame `ceil(start*fps + k*framesPerChar)`.
14
+ - A failed job can leave a half-built comp: check for duplicates and remove the incomplete one.
15
+ - Two Playrig calls in the same second with `$RANDOM` ids can collide ("already has a result"): use `$(date +%s)` or a descriptive id.
16
+ - Render queue works on an unsaved project; applying "H.264 - Match Render Settings - 40 Mbps" gives MP4.
17
+
18
+ ## Premiere Pro
19
+ - Modern JS; `await` works. Always use `p.lockedAccess(() => p.executeTransaction(ca => ..., "label"))` for edits.
20
+ - `createSequenceFromMedia(name, [clip], bin)` sizes the sequence to the clip.
21
+ - `createOverwriteItemAction(item, TickTime, videoTrackIdx, audioTrackIdx)`; an overwrite with a *shorter* clip leaves a remnant of the old one: pad the new file to the old length.
22
+ - `createRemoveItemsAction` fails with "script object is no longer valid" for all arguments tried; replace clips in place instead.
23
+ - Imports are auto-filed into bins; a second import of the same file duplicates the project item. Import only what is missing; remove duplicates with `folder.createRemoveItemAction(item)` (project items work, clips on a timeline do not).
24
+ - Premiere snaps to frames (24 fps = 41.7 ms): note, do not apologise.
25
+ - Export: `EncoderManager.exportSequence(seq, EXPORT_IMMEDIATELY, path, presetPath, true)`; file extension from `getExportFileExtension(seq, preset)`.
26
+
27
+ ## Audio (see score-video for detail)
28
+ - Time sound from the *rendered picture*, not from the script. Inspect each SFX file's envelope; the loud part may not be at 0 s.
29
+ - `atrim` after `amix`/`apad` is broken in ffmpeg 9: use `-t` on the output.
30
+ - Do not claim beat-sync on syncopated music: duck instead (about -6 dB under events, 0 between).
31
+ - The audio detector cannot see ticks under music in the final mix: say so rather than claiming a verified sync.
@@ -0,0 +1,46 @@
1
+ # Project conventions (how this user organises things)
2
+
3
+ Observed on the "Motion Videos AI" project; treat as the default layout and look for it first. If a folder is missing, create it and say so. Never reorganise what is already there.
4
+
5
+ ## On disk (project folder = the folder above `0_PROJECT/`)
6
+ ```
7
+ 0_PROJECT/ .prproj / .aep live here; EDIT_LOGS/ is written by Playrig (do not edit)
8
+ 1_FOOTAGE/
9
+ AE_Motion/ renders from After Effects: <Title>_Wide(_v2).mp4, <Title>_Portrait(_v2).mp4
10
+ 2_SOUND/
11
+ SFX/ downloaded + processed effects (v2/, v3/ for regenerated sets)
12
+ 3_MUSIC/ music: original edit, *_ducked_vN.wav (generated)
13
+ 4_EXPORTS/ drafts / review exports (Audio, Graded, Thumbnails, Timelines subfolders exist)
14
+ 5_FINAL/ finals only
15
+ Wide/ <Title>_Wide_16x9_FINAL.mp4
16
+ Vertical/ <Title>_Vertical_9x16_FINAL.mp4
17
+ Audio/ Thumbnails/
18
+ ```
19
+ "FINALS" in the user's words = `5_FINAL`. Drafts = `4_EXPORTS` (name them `MASTER_<Title>_Wide_16x9.mp4` etc.).
20
+
21
+ ## Naming
22
+ - Versioned renders and generated audio: new suffix each time (`_v2`, `_v3`); never reuse a name that Premiere has imported.
23
+ - Finals: `_FINAL` suffix; check the folder first, never overwrite.
24
+ - Formats are always a pair: **Wide 16x9 (1920x1080)** and **Portrait/Vertical 9x16 (1080x1920)**, 24 fps unless told otherwise.
25
+ - AE comps: `<Title>` (wide) and `<Title> Portrait`.
26
+ - PP sequences: `MASTER - <Title> (Wide 16x9)` and `MASTER - <Title> (Portrait 9x16)`. The user renamed the default sequence names to this; always find them by name at the start of a job.
27
+
28
+ ## After Effects project
29
+ ```
30
+ 01_COMPS/
31
+ 16x9 Wide/ 9x16 Portrait/ 1x1 Square/ (created on demand, keyed by comp aspect)
32
+ 02_ASSETS/
33
+ Solids/
34
+ ```
35
+ `scripts/ae/organize-project.jsx` is safe to re-run (moves only; reuses folders by name). Unused solids left by rebuilds may linger: mention, do not delete unasked.
36
+
37
+ ## Premiere project bins (set by the user; Playrig auto-files imports)
38
+ Observed: `1_MASTER` (the MASTER sequences), `2_FOOTAGE/RENDERS` (AE renders), `5_SOUND`, `6_MUSIC`, `99_ARCHIVE`. Playrig's `organize.default.json` rules decide where an import lands; read the `[organize] filed ...` line in the job log. Items are not at the project root, so walk bins (`ppro.FolderItem.cast(item)`), and find by exact file name.
39
+
40
+ ## Audio track layout in each sequence
41
+ `A1` score (ducked) at 0; `A2` whoosh + chip pops; `A3` typing bed + alternate pops. One clip per event, same-length files when replacing.
42
+
43
+ ## Tools and fonts
44
+ - Fonts: the brief's font must be installed in AE; stand-in used so far: Menlo (mono) while Space Mono was not installed. Keep font PostScript names in one constants block.
45
+ - Epidemic Sound is the music/SFX source. ffmpeg/ffprobe/python3 stdlib for audio work.
46
+ - Presets: Premiere export uses Media Encoder preset "00 - Match Source - High bitrate.epr" (H.264, native size/fps). AE render template "H.264 - Match Render Settings - 40 Mbps".
@@ -0,0 +1,8 @@
1
+ // Lists every project item with its type, size and parent folder (read-only).
2
+ var i, it, t, rows = [];
3
+ for (i = 1; i <= app.project.numItems; i++) {
4
+ it = app.project.item(i);
5
+ t = it instanceof CompItem ? "comp " + it.width + "x" + it.height + " " + it.duration + "s" : (it instanceof FolderItem ? "folder" : (it instanceof FootageItem ? "footage" : "other"));
6
+ rows.push(i + ". " + it.name + " [" + t + "] in: " + (it.parentFolder === app.project.rootFolder ? "(root)" : it.parentFolder.name));
7
+ }
8
+ PLAYRIG.log(rows.join("\n"));
@@ -0,0 +1,14 @@
1
+ // Move existing chips in an existing comp (no rebuild). Chip shape layers are named "Chip - <Brand>"; the label is parented to the chip.
2
+ // Run: playrig ae run scenes/move-chips.jsx --param comp="Quadrant Chips" --param moves="Fujifilm:-2:-3|Nikon:-3:-1"
3
+ // moves = Brand:i:j (i columns right of centre, j rows below centre, 120 px grid).
4
+ if (typeof P === "undefined" || !P.comp || !P.moves) { throw new Error("Pass --param comp=<comp> --param moves=\"Brand:i:j|Brand:i:j\""); }
5
+ var CELL = 120, comp = PLAYRIG.comp(P.comp), parts = String(P.moves).split("|"), out = [], k, f, i, layer, pos, name;
6
+ for (k = 0; k < parts.length; k++) {
7
+ f = parts[k].split(":"); name = "Chip - " + f[0]; layer = null;
8
+ for (i = 1; i <= comp.numLayers; i++) { if (comp.layer(i).name === name) { layer = comp.layer(i); } }
9
+ if (!layer) { throw new Error("No layer \"" + name + "\" in " + comp.name); }
10
+ pos = layer.property("ADBE Transform Group").property("ADBE Position");
11
+ pos.setValue([comp.width / 2 + Number(f[1]) * CELL, comp.height / 2 + Number(f[2]) * CELL]);
12
+ out.push(f[0] + " -> " + pos.value[0] + "," + pos.value[1]);
13
+ }
14
+ PLAYRIG.log(out.join("\n"));
@@ -0,0 +1,25 @@
1
+ // Organise the AE project: comps into 01_COMPS/<aspect> folders, existing Solids folder under 02_ASSETS.
2
+ // Moves only; nothing is renamed, deleted or saved. Safe to re-run (reuses folders by name).
3
+ function folder(name, parent) {
4
+ var i, it;
5
+ for (i = 1; i <= app.project.numItems; i++) {
6
+ it = app.project.item(i);
7
+ if (it instanceof FolderItem && it.name === name && it.parentFolder === parent) { return it; }
8
+ }
9
+ var f = app.project.items.addFolder(name); f.parentFolder = parent; return f;
10
+ }
11
+ function aspectFolderName(c) { return c.width > c.height ? "16x9 Wide" : (c.width < c.height ? "9x16 Portrait" : "1x1 Square"); }
12
+
13
+ var root = app.project.rootFolder, comps = [], solids = null, i, it, moved = [];
14
+ for (i = 1; i <= app.project.numItems; i++) {
15
+ it = app.project.item(i);
16
+ if (it instanceof CompItem) { comps.push(it); }
17
+ if (it instanceof FolderItem && it.name === "Solids" && it.parentFolder === root) { solids = it; }
18
+ }
19
+ var compsRoot = folder("01_COMPS", root);
20
+ for (i = 0; i < comps.length; i++) {
21
+ var dest = folder(aspectFolderName(comps[i]), compsRoot);
22
+ if (comps[i].parentFolder !== dest) { comps[i].parentFolder = dest; moved.push(comps[i].name + " -> 01_COMPS/" + dest.name); }
23
+ }
24
+ if (solids) { solids.parentFolder = folder("02_ASSETS", root); moved.push("Solids -> 02_ASSETS/Solids"); }
25
+ PLAYRIG.log(moved.join("\n"));