@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,68 +0,0 @@
1
- /**
2
- * Core types for the VibeFrame Agentic System
3
- */
4
-
5
- export interface ToolParameter {
6
- type: "string" | "number" | "boolean" | "array" | "object";
7
- description: string;
8
- required?: boolean;
9
- enum?: string[];
10
- items?: ToolParameter;
11
- properties?: Record<string, ToolParameter>;
12
- }
13
-
14
- export interface ToolDefinition {
15
- name: string;
16
- description: string;
17
- parameters: {
18
- type: "object";
19
- properties: Record<string, ToolParameter>;
20
- required: string[];
21
- };
22
- }
23
-
24
- export interface ToolCall {
25
- id: string;
26
- name: string;
27
- arguments: Record<string, unknown>;
28
- }
29
-
30
- export interface ToolResult {
31
- toolCallId: string;
32
- success: boolean;
33
- output: string;
34
- error?: string;
35
- }
36
-
37
- export interface AgentMessage {
38
- role: "system" | "user" | "assistant" | "tool";
39
- content: string;
40
- toolCalls?: ToolCall[];
41
- toolCallId?: string;
42
- }
43
-
44
- export interface AgentConfig {
45
- provider: LLMProvider;
46
- model?: string;
47
- maxTurns?: number;
48
- verbose?: boolean;
49
- }
50
-
51
- export type LLMProvider = "openai" | "claude" | "gemini" | "ollama" | "xai";
52
-
53
- export interface LLMResponse {
54
- content: string;
55
- toolCalls?: ToolCall[];
56
- finishReason: "stop" | "tool_calls" | "length" | "error";
57
- }
58
-
59
- export interface AgentContext {
60
- projectPath: string | null;
61
- workingDirectory: string;
62
- }
63
-
64
- export interface AgentTurn {
65
- input: string;
66
- response: string;
67
- toolsUsed: string[];
68
- }
@@ -1,340 +0,0 @@
1
- /**
2
- * Agent Command - Interactive AI agent REPL
3
- * Provides natural language interface with tool calling
4
- */
5
-
6
- import { Command } from "commander";
7
- import { createInterface } from "node:readline";
8
- import { createRequire } from "node:module";
9
- import chalk from "chalk";
10
- import ora from "ora";
11
- import { AgentExecutor } from "../agent/index.js";
12
- import { getApiKeyFromConfig, type LLMProvider } from "../config/index.js";
13
- import { hasTTY } from "../utils/tty.js";
14
- import { loadEnv } from "../utils/api-key.js";
15
-
16
- const require = createRequire(import.meta.url);
17
- const pkg = require("../../package.json");
18
-
19
- export interface StartAgentOptions {
20
- provider?: string;
21
- model?: string;
22
- project?: string;
23
- verbose?: boolean;
24
- maxTurns?: string;
25
- input?: string;
26
- confirm?: boolean;
27
- }
28
-
29
- /**
30
- * Prompt user for confirmation before tool execution
31
- */
32
- async function promptConfirm(
33
- toolName: string,
34
- args: Record<string, unknown>
35
- ): Promise<boolean> {
36
- const { createInterface } = await import("node:readline");
37
- const rl = createInterface({
38
- input: process.stdin,
39
- output: process.stdout,
40
- terminal: process.stdin.isTTY ?? false,
41
- });
42
-
43
- return new Promise((resolve) => {
44
- const argsStr = JSON.stringify(args, null, 2);
45
- console.log();
46
- console.log(chalk.yellow(`Execute ${chalk.bold(toolName)}?`));
47
- console.log(chalk.dim(argsStr));
48
- rl.question(chalk.cyan("(y/n): "), (answer) => {
49
- rl.close();
50
- resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
51
- });
52
- });
53
- }
54
-
55
- /**
56
- * Start the AI agent
57
- * @param options - Agent options
58
- */
59
- export async function startAgent(options: StartAgentOptions = {}): Promise<void> {
60
- const isNonInteractive = !!options.input;
61
- const confirmMode = options.confirm || false;
62
-
63
- // Check if TTY is available (skip for non-interactive mode)
64
- if (!isNonInteractive && !hasTTY()) {
65
- console.error(chalk.red("Error: Agent mode requires a terminal."));
66
- console.log(chalk.dim("Run 'vibe agent' directly from your terminal."));
67
- console.log(chalk.dim("Or use --input <query> for non-interactive mode."));
68
- process.exit(1);
69
- }
70
-
71
- const provider = (options.provider || "openai") as LLMProvider;
72
- const verbose = options.verbose || false;
73
- const maxTurns = parseInt(options.maxTurns || "10", 10) || 10;
74
-
75
- // Load environment variables from .env
76
- loadEnv();
77
-
78
- // Get API key
79
- const spinner = ora("Initializing agent...").start();
80
-
81
- let apiKey: string | undefined;
82
- const providerKeyMap: Record<string, string> = {
83
- openai: "openai",
84
- claude: "anthropic",
85
- gemini: "google",
86
- ollama: "ollama", // Ollama doesn't need API key
87
- xai: "xai",
88
- };
89
-
90
- if (provider !== "ollama") {
91
- apiKey = await getApiKeyFromConfig(providerKeyMap[provider]);
92
- if (!apiKey) {
93
- spinner.fail(chalk.red(`API key required for ${provider}`));
94
- console.log();
95
- console.log(chalk.yellow("Configure your API key:"));
96
- console.log(chalk.dim(" Run: vibe setup"));
97
- console.log(chalk.dim(` Or set: ${getEnvVar(provider)}`));
98
- process.exit(1);
99
- }
100
- } else {
101
- apiKey = "http://localhost:11434"; // Default Ollama URL
102
- }
103
-
104
- // Create agent
105
- let agent: AgentExecutor;
106
- try {
107
- agent = new AgentExecutor({
108
- provider,
109
- apiKey,
110
- model: options.model,
111
- maxTurns,
112
- verbose,
113
- projectPath: options.project,
114
- confirmCallback: confirmMode ? promptConfirm : undefined,
115
- });
116
-
117
- await agent.initialize();
118
- spinner.succeed(chalk.green("Agent initialized"));
119
- } catch (error) {
120
- spinner.fail(chalk.red("Failed to initialize agent"));
121
- console.error(error);
122
- process.exit(1);
123
- }
124
-
125
- // Non-interactive mode: run single query and exit
126
- if (isNonInteractive) {
127
- try {
128
- const result = await agent.execute(options.input!);
129
-
130
- if (verbose && result.toolsUsed.length > 0) {
131
- console.log(chalk.dim(`Used: ${result.toolsUsed.join(", ")}`));
132
- }
133
-
134
- console.log(result.response);
135
-
136
- if (verbose) {
137
- console.log(chalk.dim(`(${result.turns} turn${result.turns > 1 ? "s" : ""})`));
138
- }
139
-
140
- process.exit(0);
141
- } catch (error) {
142
- console.error(chalk.red(error instanceof Error ? error.message : String(error)));
143
- process.exit(1);
144
- }
145
- }
146
-
147
- // Print welcome banner
148
- const version = pkg.version;
149
- const toolCount = agent.getTools().length;
150
- const cwd = process.cwd().replace(process.env.HOME || "", "~");
151
-
152
- console.log();
153
- console.log(chalk.cyan("██╗ ██╗██╗██████╗ ███████╗███████╗██████╗ █████╗ ███╗ ███╗███████╗"));
154
- console.log(chalk.cyan("██║ ██║██║██╔══██╗██╔════╝██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝"));
155
- console.log(chalk.cyan("██║ ██║██║██████╔╝█████╗ █████╗ ██████╔╝███████║██╔████╔██║█████╗"));
156
- console.log(chalk.cyan("╚██╗ ██╔╝██║██╔══██╗██╔══╝ ██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝"));
157
- console.log(chalk.cyan(" ╚████╔╝ ██║██████╔╝███████╗██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗"));
158
- console.log(chalk.cyan(" ╚═══╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝"));
159
- console.log();
160
- console.log(chalk.dim(` v${version} · ${provider}${options.model ? ` · ${options.model}` : ""} · ${cwd}`));
161
- console.log();
162
-
163
- // Show status line
164
- const statusParts = [
165
- chalk.green(`${toolCount} tools`),
166
- confirmMode ? chalk.yellow("confirm mode") : null,
167
- options.project ? chalk.blue(`project: ${options.project}`) : null,
168
- ].filter(Boolean);
169
-
170
- console.log(chalk.dim(" ") + statusParts.join(chalk.dim(" · ")));
171
- console.log();
172
- console.log(chalk.dim(" Commands: exit · reset · tools · context"));
173
- console.log();
174
-
175
- // Wrap readline in a Promise that resolves only when readline closes
176
- // This keeps the Node.js event loop alive until the user exits
177
- return new Promise<void>((resolve) => {
178
- // Ensure stdin keeps the event loop alive
179
- if (typeof process.stdin.ref === "function") {
180
- process.stdin.ref();
181
- }
182
-
183
- // Keepalive timer to prevent event loop from exiting
184
- // This is cleared when readline closes
185
- const keepalive = setInterval(() => {
186
- // Keep event loop alive
187
- }, 60000);
188
-
189
- // Create readline interface
190
- const rl = createInterface({
191
- input: process.stdin,
192
- output: process.stdout,
193
- terminal: process.stdin.isTTY ?? false,
194
- historySize: 100,
195
- prompt: chalk.green("you> "),
196
- });
197
-
198
- // Handle SIGINT (Ctrl+C)
199
- rl.on("SIGINT", () => {
200
- console.log();
201
- console.log(chalk.dim('Use "exit" to quit'));
202
- rl.prompt();
203
- });
204
-
205
- // Process user input
206
- const processInput = async (input: string) => {
207
- const trimmed = input.trim();
208
-
209
- if (!trimmed) {
210
- rl.prompt();
211
- return;
212
- }
213
-
214
- // Handle special commands
215
- if (trimmed.toLowerCase() === "exit" || trimmed.toLowerCase() === "quit") {
216
- console.log();
217
- console.log(chalk.dim("Goodbye!"));
218
- rl.close();
219
- return;
220
- }
221
-
222
- if (trimmed.toLowerCase() === "reset") {
223
- agent.reset();
224
- console.log(chalk.dim("Context cleared"));
225
- rl.prompt();
226
- return;
227
- }
228
-
229
- if (trimmed.toLowerCase() === "tools") {
230
- const tools = agent.getTools();
231
- console.log();
232
- console.log(chalk.bold.cyan("Available Tools"));
233
- console.log(chalk.dim("─".repeat(50)));
234
- for (const tool of tools.sort()) {
235
- console.log(` ${chalk.yellow(tool)}`);
236
- }
237
- console.log();
238
- console.log(chalk.dim(`Total: ${tools.length} tools`));
239
- console.log();
240
- rl.prompt();
241
- return;
242
- }
243
-
244
- if (trimmed.toLowerCase() === "context") {
245
- const context = agent.getContext();
246
- console.log();
247
- console.log(chalk.bold.cyan("Current Context"));
248
- console.log(chalk.dim("─".repeat(50)));
249
- console.log(chalk.dim("Working Directory:"), context.workingDirectory);
250
- console.log(chalk.dim("Project:"), context.projectPath || "(none)");
251
- console.log();
252
- rl.prompt();
253
- return;
254
- }
255
-
256
- // Execute agent
257
- // discardStdin: false is critical - ora's default discards stdin which breaks readline
258
- const execSpinner = ora({
259
- text: "Thinking...",
260
- color: "cyan",
261
- discardStdin: false,
262
- }).start();
263
-
264
- try {
265
- const result = await agent.execute(trimmed);
266
-
267
- if (verbose && result.toolsUsed.length > 0) {
268
- execSpinner.info(chalk.dim(`Used: ${result.toolsUsed.join(", ")}`));
269
- } else {
270
- execSpinner.stop();
271
- }
272
-
273
- console.log();
274
- console.log(chalk.cyan("vibe>"), result.response);
275
- console.log();
276
-
277
- if (verbose) {
278
- console.log(chalk.dim(`(${result.turns} turn${result.turns > 1 ? "s" : ""})`));
279
- console.log();
280
- }
281
- } catch (error) {
282
- execSpinner.fail(chalk.red("Error"));
283
- console.error(chalk.red(error instanceof Error ? error.message : String(error)));
284
- console.log();
285
- }
286
-
287
- // Resume readline and show prompt (ora spinner may have paused it)
288
- rl.resume();
289
- rl.prompt();
290
- // Ensure stdin stays referenced after async operations
291
- if (typeof process.stdin.ref === "function") {
292
- process.stdin.ref();
293
- }
294
- };
295
-
296
- // Handle each line
297
- rl.on("line", (line) => {
298
- processInput(line).catch((err) => {
299
- console.error(chalk.red("Error:"), err.message);
300
- rl.resume();
301
- rl.prompt();
302
- });
303
- });
304
-
305
- // Handle close - resolve the Promise to allow natural exit
306
- rl.on("close", () => {
307
- clearInterval(keepalive);
308
- console.log();
309
- console.log(chalk.dim("Goodbye!"));
310
- resolve();
311
- });
312
-
313
- // Start REPL
314
- rl.prompt();
315
- });
316
- }
317
-
318
- export const agentCommand = new Command("agent")
319
- .description("Start the AI agent with natural language interface")
320
- .option("-p, --provider <provider>", "LLM provider (openai, claude, gemini, ollama, xai)", "openai")
321
- .option("-m, --model <model>", "Model to use (provider-specific)")
322
- .option("--project <path>", "Project file to load")
323
- .option("-v, --verbose", "Show verbose output including tool calls")
324
- .option("--max-turns <n>", "Maximum turns per request", "10")
325
- .option("-i, --input <query>", "Run a single query and exit (non-interactive)")
326
- .option("-c, --confirm", "Confirm before each tool execution")
327
- .action(async (options) => {
328
- await startAgent(options);
329
- });
330
-
331
- function getEnvVar(provider: string): string {
332
- const envVars: Record<string, string> = {
333
- openai: "OPENAI_API_KEY",
334
- claude: "ANTHROPIC_API_KEY",
335
- gemini: "GOOGLE_API_KEY",
336
- ollama: "(no API key needed)",
337
- xai: "XAI_API_KEY",
338
- };
339
- return envVars[provider] || "API_KEY";
340
- }