@vibeframe/cli 0.27.0 → 0.29.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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/dist/agent/adapters/index.d.ts +1 -0
  3. package/dist/agent/adapters/index.d.ts.map +1 -1
  4. package/dist/agent/adapters/index.js +5 -0
  5. package/dist/agent/adapters/index.js.map +1 -1
  6. package/dist/agent/adapters/openrouter.d.ts +16 -0
  7. package/dist/agent/adapters/openrouter.d.ts.map +1 -0
  8. package/dist/agent/adapters/openrouter.js +100 -0
  9. package/dist/agent/adapters/openrouter.js.map +1 -0
  10. package/dist/agent/types.d.ts +1 -1
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/commands/agent.d.ts.map +1 -1
  13. package/dist/commands/agent.js +3 -1
  14. package/dist/commands/agent.js.map +1 -1
  15. package/dist/commands/setup.js +5 -2
  16. package/dist/commands/setup.js.map +1 -1
  17. package/dist/config/schema.d.ts +2 -1
  18. package/dist/config/schema.d.ts.map +1 -1
  19. package/dist/config/schema.js +2 -0
  20. package/dist/config/schema.js.map +1 -1
  21. package/dist/index.js +0 -0
  22. package/package.json +16 -12
  23. package/.turbo/turbo-build.log +0 -4
  24. package/.turbo/turbo-lint.log +0 -21
  25. package/.turbo/turbo-test.log +0 -689
  26. package/src/agent/adapters/claude.ts +0 -143
  27. package/src/agent/adapters/gemini.ts +0 -159
  28. package/src/agent/adapters/index.ts +0 -61
  29. package/src/agent/adapters/ollama.ts +0 -231
  30. package/src/agent/adapters/openai.ts +0 -116
  31. package/src/agent/adapters/xai.ts +0 -119
  32. package/src/agent/index.ts +0 -251
  33. package/src/agent/memory/index.ts +0 -151
  34. package/src/agent/prompts/system.ts +0 -106
  35. package/src/agent/tools/ai-editing.ts +0 -845
  36. package/src/agent/tools/ai-generation.ts +0 -1073
  37. package/src/agent/tools/ai-pipeline.ts +0 -1055
  38. package/src/agent/tools/ai.ts +0 -21
  39. package/src/agent/tools/batch.ts +0 -429
  40. package/src/agent/tools/e2e.test.ts +0 -545
  41. package/src/agent/tools/export.ts +0 -184
  42. package/src/agent/tools/filesystem.ts +0 -237
  43. package/src/agent/tools/index.ts +0 -150
  44. package/src/agent/tools/integration.test.ts +0 -775
  45. package/src/agent/tools/media.ts +0 -697
  46. package/src/agent/tools/project.ts +0 -313
  47. package/src/agent/tools/timeline.ts +0 -951
  48. package/src/agent/types.ts +0 -68
  49. package/src/commands/agent.ts +0 -340
  50. package/src/commands/ai-analyze.ts +0 -429
  51. package/src/commands/ai-animated-caption.ts +0 -390
  52. package/src/commands/ai-audio.ts +0 -941
  53. package/src/commands/ai-broll.ts +0 -490
  54. package/src/commands/ai-edit-cli.ts +0 -658
  55. package/src/commands/ai-edit.ts +0 -1542
  56. package/src/commands/ai-fill-gaps.ts +0 -566
  57. package/src/commands/ai-helpers.ts +0 -65
  58. package/src/commands/ai-highlights.ts +0 -1303
  59. package/src/commands/ai-image.ts +0 -761
  60. package/src/commands/ai-motion.ts +0 -347
  61. package/src/commands/ai-narrate.ts +0 -451
  62. package/src/commands/ai-review.ts +0 -309
  63. package/src/commands/ai-script-pipeline-cli.ts +0 -1710
  64. package/src/commands/ai-script-pipeline.ts +0 -1365
  65. package/src/commands/ai-suggest-edit.ts +0 -264
  66. package/src/commands/ai-video-fx.ts +0 -445
  67. package/src/commands/ai-video.ts +0 -915
  68. package/src/commands/ai-viral.ts +0 -595
  69. package/src/commands/ai-visual-fx.ts +0 -601
  70. package/src/commands/ai.test.ts +0 -627
  71. package/src/commands/ai.ts +0 -307
  72. package/src/commands/analyze.ts +0 -282
  73. package/src/commands/audio.ts +0 -644
  74. package/src/commands/batch.test.ts +0 -279
  75. package/src/commands/batch.ts +0 -440
  76. package/src/commands/detect.ts +0 -329
  77. package/src/commands/doctor.ts +0 -237
  78. package/src/commands/edit-cmd.ts +0 -1014
  79. package/src/commands/export.ts +0 -918
  80. package/src/commands/generate.ts +0 -2146
  81. package/src/commands/media.ts +0 -177
  82. package/src/commands/output.ts +0 -142
  83. package/src/commands/pipeline.ts +0 -398
  84. package/src/commands/project.test.ts +0 -127
  85. package/src/commands/project.ts +0 -149
  86. package/src/commands/sanitize.ts +0 -60
  87. package/src/commands/schema.ts +0 -130
  88. package/src/commands/setup.ts +0 -509
  89. package/src/commands/timeline.test.ts +0 -499
  90. package/src/commands/timeline.ts +0 -529
  91. package/src/commands/validate.ts +0 -77
  92. package/src/config/config.test.ts +0 -197
  93. package/src/config/index.ts +0 -125
  94. package/src/config/schema.ts +0 -82
  95. package/src/engine/index.ts +0 -2
  96. package/src/engine/project.test.ts +0 -702
  97. package/src/engine/project.ts +0 -439
  98. package/src/index.ts +0 -146
  99. package/src/utils/api-key.test.ts +0 -41
  100. package/src/utils/api-key.ts +0 -247
  101. package/src/utils/audio.ts +0 -83
  102. package/src/utils/exec-safe.ts +0 -75
  103. package/src/utils/first-run.ts +0 -52
  104. package/src/utils/provider-resolver.ts +0 -56
  105. package/src/utils/remotion.ts +0 -951
  106. package/src/utils/subtitle.test.ts +0 -227
  107. package/src/utils/subtitle.ts +0 -169
  108. package/src/utils/tty.ts +0 -196
  109. package/tsconfig.json +0 -20
@@ -1,309 +0,0 @@
1
- /**
2
- * @module ai-review
3
- *
4
- * AI-powered video quality review and auto-fix using Gemini.
5
- *
6
- * CLI command: review
7
- *
8
- * Execute function:
9
- * executeReview - Analyze video quality across 5 categories and optionally auto-fix
10
- *
11
- * @dependencies Gemini (Google), FFmpeg (auto-fix filters)
12
- */
13
-
14
- import { Command } from "commander";
15
- import { readFile, rename } from "node:fs/promises";
16
- import { resolve } from "node:path";
17
- import { existsSync } from "node:fs";
18
- import chalk from "chalk";
19
- import ora from "ora";
20
- import { GeminiProvider } from "@vibeframe/ai-providers";
21
- import { getApiKey, loadEnv } from "../utils/api-key.js";
22
- import { execSafe } from "../utils/exec-safe.js";
23
- import type { VideoReviewFeedback } from "./ai-edit.js";
24
-
25
- /** Options for {@link executeReview}. */
26
- export interface ReviewOptions {
27
- /** Path to the video file to review */
28
- videoPath: string;
29
- /** Optional storyboard JSON for context-aware review */
30
- storyboardPath?: string;
31
- /** Automatically apply fixable corrections via FFmpeg */
32
- autoApply?: boolean;
33
- /** Run a verification pass after applying fixes */
34
- verify?: boolean;
35
- /** Gemini model shorthand (default: "flash") */
36
- model?: "flash" | "flash-2.5" | "pro";
37
- /** Output path for the fixed video (auto-apply mode) */
38
- outputPath?: string;
39
- }
40
-
41
- /** Result from {@link executeReview}. */
42
- export interface ReviewResult {
43
- /** Whether the review completed successfully */
44
- success: boolean;
45
- /** Structured review feedback with per-category scores */
46
- feedback?: VideoReviewFeedback;
47
- /** Descriptions of fixes that were auto-applied */
48
- appliedFixes?: string[];
49
- /** Post-fix verification quality score 1-10 */
50
- verificationScore?: number;
51
- /** Path to the reviewed/fixed output video */
52
- outputPath?: string;
53
- /** Error message on failure */
54
- error?: string;
55
- }
56
-
57
- function parseReviewFeedback(response: string): VideoReviewFeedback | null {
58
- let cleaned = response.trim();
59
- if (cleaned.startsWith("```json")) {
60
- cleaned = cleaned.slice(7);
61
- } else if (cleaned.startsWith("```")) {
62
- cleaned = cleaned.slice(3);
63
- }
64
- if (cleaned.endsWith("```")) {
65
- cleaned = cleaned.slice(0, -3);
66
- }
67
- cleaned = cleaned.trim();
68
-
69
- try {
70
- const parsed = JSON.parse(cleaned);
71
- if (typeof parsed.overallScore !== "number" || !parsed.categories) {
72
- return null;
73
- }
74
- return parsed as VideoReviewFeedback;
75
- } catch {
76
- return null;
77
- }
78
- }
79
-
80
- /**
81
- * Review video quality using Gemini AI and optionally auto-fix issues.
82
- *
83
- * Analyzes 5 quality categories (pacing, color, text readability, audio-visual
84
- * sync, composition) and returns scored feedback. When auto-apply is enabled,
85
- * applies fixable corrections via FFmpeg filters.
86
- *
87
- * @param options - Review configuration
88
- * @returns Result with structured feedback and optional fix details
89
- */
90
- export async function executeReview(options: ReviewOptions): Promise<ReviewResult> {
91
- const { videoPath, storyboardPath, autoApply = false, verify = false, model = "flash" } = options;
92
-
93
- const absVideoPath = resolve(process.cwd(), videoPath);
94
- if (!existsSync(absVideoPath)) {
95
- return { success: false, error: `Video not found: ${absVideoPath}` };
96
- }
97
-
98
- const apiKey = process.env.GOOGLE_API_KEY || (await getApiKey("GOOGLE_API_KEY", "Google"));
99
- if (!apiKey) {
100
- return { success: false, error: "Google API key required for Gemini video review. Run 'vibe setup' or set GOOGLE_API_KEY in .env" };
101
- }
102
-
103
- let storyboardContext = "";
104
- if (storyboardPath) {
105
- const absStoryboardPath = resolve(process.cwd(), storyboardPath);
106
- if (existsSync(absStoryboardPath)) {
107
- const content = await readFile(absStoryboardPath, "utf-8");
108
- storyboardContext = `\n\nOriginal storyboard for reference:\n${content}`;
109
- }
110
- }
111
-
112
- const modelMap: Record<string, string> = {
113
- flash: "gemini-3-flash-preview",
114
- "flash-2.5": "gemini-2.5-flash",
115
- pro: "gemini-2.5-pro",
116
- };
117
- const modelId = modelMap[model] || modelMap.flash;
118
-
119
- const reviewPrompt = `You are a professional video editor reviewing this video for quality. Analyze the video and return a JSON review with the following structure. Return ONLY valid JSON, no extra text.
120
-
121
- {
122
- "overallScore": <number 1-10>,
123
- "categories": {
124
- "pacing": { "score": <1-10>, "issues": ["..."], "fixable": <boolean> },
125
- "color": { "score": <1-10>, "issues": ["..."], "fixable": <boolean>, "suggestedFilter": "<ffmpeg filter or null>" },
126
- "textReadability": { "score": <1-10>, "issues": ["..."], "fixable": <boolean>, "suggestions": ["..."] },
127
- "audioVisualSync": { "score": <1-10>, "issues": ["..."], "fixable": <boolean> },
128
- "composition": { "score": <1-10>, "issues": ["..."], "fixable": <boolean> }
129
- },
130
- "autoFixable": [
131
- { "type": "color_grade"|"text_overlay_adjust"|"speed_adjust"|"crop", "description": "...", "ffmpegFilter": "..." }
132
- ],
133
- "recommendations": ["..."]
134
- }
135
-
136
- Score each category 1-10. For fixable issues, provide an FFmpeg filter in autoFixable. Be specific and practical.${storyboardContext}`;
137
-
138
- const gemini = new GeminiProvider();
139
- await gemini.initialize({ apiKey });
140
-
141
- const videoData = await readFile(absVideoPath);
142
- const analysisResult = await gemini.analyzeVideo(videoData, reviewPrompt, {
143
- model: modelId as "gemini-3-flash-preview" | "gemini-2.5-flash" | "gemini-2.5-pro",
144
- });
145
-
146
- if (!analysisResult.success || !analysisResult.response) {
147
- return { success: false, error: analysisResult.error || "Gemini video analysis failed" };
148
- }
149
-
150
- const feedback = parseReviewFeedback(analysisResult.response);
151
- if (!feedback) {
152
- return {
153
- success: false,
154
- error: "Failed to parse review feedback from Gemini response",
155
- };
156
- }
157
-
158
- const result: ReviewResult = {
159
- success: true,
160
- feedback,
161
- appliedFixes: [],
162
- };
163
-
164
- if (autoApply && feedback.autoFixable.length > 0) {
165
- let currentInput = absVideoPath;
166
- const outputBase = options.outputPath
167
- ? resolve(process.cwd(), options.outputPath)
168
- : absVideoPath.replace(/(\.[^.]+)$/, "-reviewed$1");
169
-
170
- for (const fix of feedback.autoFixable) {
171
- if (fix.type === "color_grade" && fix.ffmpegFilter) {
172
- try {
173
- const tempOutput = outputBase.replace(/(\.[^.]+)$/, `-fix-${result.appliedFixes!.length}$1`);
174
- await execSafe("ffmpeg", ["-i", currentInput, "-vf", fix.ffmpegFilter, "-c:a", "copy", tempOutput, "-y"], { timeout: 600000, maxBuffer: 50 * 1024 * 1024 });
175
- currentInput = tempOutput;
176
- result.appliedFixes!.push(`${fix.type}: ${fix.description}`);
177
- } catch {
178
- // Skip failed fix, continue with others
179
- }
180
- } else if (fix.type === "text_overlay_adjust") {
181
- result.appliedFixes!.push(`${fix.type}: ${fix.description} (manual adjustment recommended)`);
182
- }
183
- }
184
-
185
- if (currentInput !== absVideoPath) {
186
- const finalOutput = outputBase;
187
- try {
188
- await rename(currentInput, finalOutput);
189
- result.outputPath = finalOutput;
190
- } catch {
191
- result.outputPath = currentInput;
192
- }
193
- }
194
- }
195
-
196
- if (verify && result.outputPath) {
197
- const verifyVideoData = await readFile(result.outputPath);
198
- const verifyResult = await gemini.analyzeVideo(
199
- verifyVideoData,
200
- "Rate this video overall quality on a scale of 1-10. Return ONLY a JSON object: {\"score\": <number>}",
201
- { model: modelId as "gemini-3-flash-preview" | "gemini-2.5-flash" | "gemini-2.5-pro" }
202
- );
203
-
204
- if (verifyResult.success && verifyResult.response) {
205
- try {
206
- let cleaned = verifyResult.response.trim();
207
- if (cleaned.startsWith("```json")) cleaned = cleaned.slice(7);
208
- if (cleaned.startsWith("```")) cleaned = cleaned.slice(3);
209
- if (cleaned.endsWith("```")) cleaned = cleaned.slice(0, -3);
210
- const parsed = JSON.parse(cleaned.trim());
211
- result.verificationScore = parsed.score;
212
- } catch {
213
- // Verification parse failed, not critical
214
- }
215
- }
216
- }
217
-
218
- return result;
219
- }
220
-
221
- export function registerReviewCommand(aiCommand: Command): void {
222
- aiCommand
223
- .command("review")
224
- .description("Review video quality using Gemini AI and optionally auto-fix issues")
225
- .argument("<video>", "Video file path")
226
- .option("-s, --storyboard <path>", "Storyboard JSON file for context")
227
- .option("--auto-apply", "Automatically apply fixable corrections")
228
- .option("--verify", "Run verification pass after applying fixes")
229
- .option("-m, --model <model>", "Gemini model: flash (default), flash-2.5, pro", "flash")
230
- .option("-o, --output <path>", "Output video file path (for auto-apply)")
231
- .action(async (videoPath: string, options) => {
232
- try {
233
- loadEnv();
234
-
235
- const spinner = ora("Reviewing video with Gemini...").start();
236
-
237
- const result = await executeReview({
238
- videoPath,
239
- storyboardPath: options.storyboard,
240
- autoApply: options.autoApply,
241
- verify: options.verify,
242
- model: options.model,
243
- outputPath: options.output,
244
- });
245
-
246
- if (!result.success) {
247
- spinner.fail(chalk.red(result.error || "Video review failed"));
248
- process.exit(1);
249
- }
250
-
251
- spinner.succeed(chalk.green("Video review complete"));
252
- console.log();
253
-
254
- const fb = result.feedback!;
255
- console.log(chalk.bold.cyan("Video Review"));
256
- console.log(chalk.dim("─".repeat(60)));
257
- console.log(`Overall Score: ${chalk.bold(fb.overallScore >= 7 ? chalk.green(String(fb.overallScore)) : fb.overallScore >= 5 ? chalk.yellow(String(fb.overallScore)) : chalk.red(String(fb.overallScore)))}/10`);
258
- console.log();
259
-
260
- const categories = [
261
- ["Pacing", fb.categories.pacing],
262
- ["Color", fb.categories.color],
263
- ["Text Readability", fb.categories.textReadability],
264
- ["Audio-Visual Sync", fb.categories.audioVisualSync],
265
- ["Composition", fb.categories.composition],
266
- ] as const;
267
-
268
- for (const [name, cat] of categories) {
269
- const scoreColor = cat.score >= 7 ? chalk.green : cat.score >= 5 ? chalk.yellow : chalk.red;
270
- const fixable = cat.fixable ? chalk.dim(" [fixable]") : "";
271
- console.log(` ${name.padEnd(20)} ${scoreColor(String(cat.score).padStart(2))}/10${fixable}`);
272
- if (cat.issues.length > 0) {
273
- for (const issue of cat.issues) {
274
- console.log(chalk.dim(` - ${issue}`));
275
- }
276
- }
277
- }
278
-
279
- if (result.appliedFixes && result.appliedFixes.length > 0) {
280
- console.log();
281
- console.log(chalk.bold.green("Applied Fixes:"));
282
- for (const fix of result.appliedFixes) {
283
- console.log(chalk.green(` + ${fix}`));
284
- }
285
- if (result.outputPath) {
286
- console.log(chalk.green(` Output: ${result.outputPath}`));
287
- }
288
- }
289
-
290
- if (result.verificationScore !== undefined) {
291
- console.log();
292
- console.log(chalk.bold(`Verification Score: ${result.verificationScore}/10`));
293
- }
294
-
295
- if (fb.recommendations.length > 0) {
296
- console.log();
297
- console.log(chalk.bold("Recommendations:"));
298
- for (const rec of fb.recommendations) {
299
- console.log(chalk.dim(` * ${rec}`));
300
- }
301
- }
302
- console.log();
303
- } catch (error) {
304
- console.error(chalk.red("Video review failed"));
305
- console.error(error);
306
- process.exit(1);
307
- }
308
- });
309
- }