Skip to content

🎥 Make videos programmatically with React

skills add

Ayushman274a1fdb6e74
diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts
index a30d33c410..05b21e448c 100644
--- a/packages/cli/src/index.ts
+++ b/packages/cli/src/index.ts
@@ -40,6 +40,7 @@ import {
import {render} from './render';
import {shouldUseNonOverlayingLogger} from './should-use-non-overlaying-logger';
import {still} from './still';
+import {skillsCommand} from './skills';
import {studioCommand} from './studio';
import {upgradeCommand} from './upgrade';
import {
@@ -138,6 +139,8 @@ export const cli = async () => {
logLevel,
args: additionalArgs,
});
+ } else if (command === 'skills') {
+ await skillsCommand(args);
} else if (command === VERSIONS_COMMAND) {
await versionsCommand(remotionRoot, logLevel);
} else if (command === BROWSER_COMMAND) {
diff --git a/packages/cli/src/print-help.ts b/packages/cli/src/print-help.ts
index 219c27f156..058870a232 100644
--- a/packages/cli/src/print-help.ts
+++ b/packages/cli/src/print-help.ts
@@ -146,6 +146,18 @@ export const printHelp = (logLevel: LogLevel) => {
{indent: false, logLevel},
chalk.gray('https://www.remotion.dev/docs/cli/add'),
);
+
+ Log.info({indent: false, logLevel});
+ Log.info(
+ {indent: false, logLevel},
+ chalk.blue('remotion skills add') +
+ chalk.gray(' | ') +
+ chalk.blue('update'),
+ );
+ Log.info(
+ {indent: false, logLevel},
+ 'Install or update skills from remotion-dev/skills.',
+ );
Log.info({indent: false, logLevel});
Log.info(
diff --git a/packages/cli/src/skills.ts b/packages/cli/src/skills.ts
new file mode 100644
index 0000000000..ae6cc3efdf
--- /dev/null
+++ b/packages/cli/src/skills.ts
@@ -0,0 +1,35 @@
+import {spawn} from 'node:child_process';
+
+export const skillsCommand = async (args: string[]) => {
+ const subcommand = args[0]; // add | update
+ const restArgs = args.slice(1);
+
+ if (!subcommand || !['add', 'update'].includes(subcommand)) {
+ throw new Error(
+ `Unknown skills command: ${subcommand ?? 'none'}. Supported: add, update`,
+ );
+ }
+
+ const command = process.platform === 'win32' ? 'npm.cmd' : 'npm';
+ const fullArgs = ['exec', 'skills', subcommand, 'remotion-dev/skills', ...restArgs];
+
+ const child = spawn(command, fullArgs, {
+ stdio: 'inherit',
+ shell: true,
+ });
+
+ return new Promise<void>((resolve, reject) => {
+ child.on('exit', (code) => {
+ if (code === 0) {
+ resolve();
+ } else {
+ // Don't log here because npx/skills should have already logged its own errors
+ process.exit(code ?? 1);
+ }
+ });
+
+ child.on('error', (err) => {
+ reject(err);
+ });
+ });
+};