Skip to content

🎥 Make videos programmatically with React

Docs: Sync generated system prompt (#8944)

Jonny Burger751e1ab126dd
diff --git a/packages/docs/src/helpers/system-prompt.ts b/packages/docs/src/helpers/system-prompt.ts
index fba8aaa0ff..7341c4cc37 100644
--- a/packages/docs/src/helpers/system-prompt.ts
+++ b/packages/docs/src/helpers/system-prompt.ts
@@ -170,11 +170,11 @@ export const MyComp: React.FC = () => {
\`\`\`
A Sequence has a "from" prop that specifies the frame number where the element should appear.
-The "from" prop can be negative, in which case the Sequence will start immediately but cut off the first "from" frames.
+A Sequence has a "trimBefore" prop that trims the start of the child timeline by a number of frames.
A Sequence has a "durationInFrames" prop that specifies how long the element should appear.
-If a child component of Sequence calls "useCurrentFrame()", the enumeration starts from the first frame the Sequence appears and starts at 0.
+If a child component of Sequence calls "useCurrentFrame()", the enumeration starts from the first frame the Sequence appears and starts at "trimBefore".
\`\`\`tsx
import {Sequence} from 'remotion';
@@ -369,5 +369,4 @@ If the user is using the Node.js APIs:
- A site can be deployed using \`deploySite()\`: https://www.remotion.dev/docs/lambda/deploysite
- A video can be rendered using \`renderMediaOnLambda()\`: https://www.remotion.dev/docs/lambda/rendermediaonlambda.
- If a video is rendered, the progress must be polled using \`getRenderProgress()\`: https://www.remotion.dev/docs/lambda/getrenderprogress
-
`.trimStart();
diff --git a/packages/docs/src/test/system-prompt.test.ts b/packages/docs/src/test/system-prompt.test.ts
new file mode 100644
index 0000000000..af49dcbd98
--- /dev/null
+++ b/packages/docs/src/test/system-prompt.test.ts
@@ -0,0 +1,19 @@
+import {expect, test} from 'bun:test';
+import {readFileSync} from 'fs';
+import path from 'path';
+import {SYSTEM_PROMPT} from '../helpers/system-prompt';
+
+const normalizeLineEndings = (text: string) => {
+ return text.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
+};
+
+test('SYSTEM_PROMPT is generated from llms.txt', () => {
+ const llms = readFileSync(
+ path.join(__dirname, '..', '..', 'static', 'llms.txt'),
+ 'utf8',
+ );
+
+ expect(normalizeLineEndings(SYSTEM_PROMPT)).toBe(
+ normalizeLineEndings(llms.trimStart()),
+ );
+});
diff --git a/packages/docs/update-prompt.ts b/packages/docs/update-prompt.ts
index be96d27ea5..56101e97b4 100644
--- a/packages/docs/update-prompt.ts
+++ b/packages/docs/update-prompt.ts
@@ -9,14 +9,20 @@ const output = Bun.file(
path.join(__dirname, 'src', 'helpers', 'system-prompt.ts'),
);
+const escapedSource = source
+ .replaceAll('\\', '\\\\')
+ .replaceAll('`', '\\`')
+ .replaceAll('${', '\\${');
+
const tsText =
[
'// Auto-generated by bun update-prompt.ts',
'',
'export const SYSTEM_PROMPT = `',
- source.replaceAll('`', '\\`'),
- '`.trimStart();',
- ].join('\n') + '\n';
+ ].join('\n') +
+ '\n' +
+ escapedSource +
+ '`.trimStart();\n';
// @ts-expect-error
await Bun.write(output, tsText);