Skip to content

🎥 Make videos programmatically with React

Merge remote-tracking branch 'origin/main' into create-video-recommended-skills

Igor Samokhovets7fd872187e9c
diff --cc packages/create-video/src/init.ts
index b6e45f15e2,8f097ff520..b7256f97b8
--- a/packages/create-video/src/init.ts
+++ b/packages/create-video/src/init.ts
@@@ -159,13 -159,10 +159,10 @@@ export const init = async () =>
onError: Log.warn,
});
- const shouldOverrideTailwind = selectedTemplate.allowEnableTailwind
- ? isYesFlagSelected()
- ? !isNoTailwindFlagSelected()
- : await askTailwind()
- : false;
+ const shouldOverrideTailwind =
+ selectedTemplate.allowEnableTailwind && !isNoTailwindFlagSelected();
- const shouldInstallSkills = isYesFlagSelected() ? false : await askSkills();
+ const skillsInstallation = isYesFlagSelected() ? null : await askSkills();
const pkgManager = selectPackageManager();
const pkgManagerVersion = await getPackageManagerVersionOrNull(pkgManager);
diff --cc packages/create-video/src/install-skills.ts
index 86056311ba,c309641878..afd1fd5ada
--- a/packages/create-video/src/install-skills.ts
+++ b/packages/create-video/src/install-skills.ts
@@@ -1,31 -1,70 +1,71 @@@
+ import {lstatSync, mkdirSync, realpathSync, symlinkSync} from 'node:fs';
+ import path from 'node:path';
import execa from 'execa';
+import type {SkillsInstallation} from './ask-skills';
import {Log} from './log';
-export const installSkills = async (projectRoot: string) => {
+export const installSkills = async (
+ projectRoot: string,
+ selection: SkillsInstallation,
+) => {
const command = process.platform === 'win32' ? 'npx.cmd' : 'npx';
+ const args = [
+ '-y',
+ '--loglevel=error',
+ 'add',
+ 'remotion-dev/skills',
++ '--agent',
++ 'universal',
+ ...(selection === 'recommended'
+ ? ['--skill', 'remotion-best-practices', '--yes']
+ : []),
+ ];
try {
- await execa(
- command,
- [
- '-y',
- '--loglevel=error',
- 'add',
- 'remotion-dev/skills',
- '--agent',
- 'universal',
- '--yes',
- ],
- {
- cwd: projectRoot,
- stdio: 'inherit',
- },
- );
+ await execa(command, args, {
+ cwd: projectRoot,
+ stdio: 'inherit',
+ });
} catch (e) {
Log.error('Error installing skills:', e);
Log.error('You can install them manually by running:');
- Log.error(
- ' npx [email protected] add remotion-dev/skills --agent universal --yes',
- );
+ Log.error(` npx ${args.join(' ')}`);
+ return;
+ }
+
+ const agentsSkills = path.join(projectRoot, '.agents', 'skills');
+ const claudeSkills = path.join(projectRoot, '.claude', 'skills');
+ const existing = lstatSync(claudeSkills, {throwIfNoEntry: false});
+
+ if (existing) {
+ let pointsToAgentsSkills = false;
+ if (existing.isSymbolicLink()) {
+ try {
+ pointsToAgentsSkills =
+ realpathSync(claudeSkills) === realpathSync(agentsSkills);
+ } catch {
+ // An existing link with a missing target must be preserved.
+ }
+ }
+
+ if (!pointsToAgentsSkills) {
+ Log.warn(
+ 'Could not link .claude/skills to .agents/skills because .claude/skills already exists.',
+ );
+ }
+
+ return;
+ }
+
+ try {
+ mkdirSync(path.dirname(claudeSkills), {recursive: true});
+ symlinkSync(
+ process.platform === 'win32' ? agentsSkills : '../.agents/skills',
+ claudeSkills,
+ process.platform === 'win32' ? 'junction' : 'dir',
+ );
+ } catch (e) {
+ Log.warn('Could not link .claude/skills to .agents/skills:', e);
}
};