import { z } from "zod";
import { ROVODEV_MODELS, APPROVAL_MODES, ERROR_MESSAGES } from "../constants.js";
import { executeRovodevCLI } from "../utils/rovodevExecutor.js";
/**
* Ask Rovodev tool - main interaction with acli rovodev
*/
export const askRovodevTool = {
name: "ask-rovodev",
description: "Query Rovodev AI with support for file analysis (@file or #file syntax), codebase exploration, and large context windows. Supports various models and execution modes.",
category: "primary",
zodSchema: z.object({
prompt: z
.string()
.min(1)
.describe("The query or instruction for Rovodev. Use @filename, #filename, or directory references to include file contents. Example: '@src/ Explain this codebase structure'"),
model: z
.enum([
ROVODEV_MODELS.PRIMARY,
ROVODEV_MODELS.FALLBACK,
ROVODEV_MODELS.ADVANCED,
ROVODEV_MODELS.BASIC,
ROVODEV_MODELS.EXPERT
])
.optional()
.describe(`Optional model to use (e.g., '${ROVODEV_MODELS.PRIMARY}'). If not specified, uses the default model (${ROVODEV_MODELS.PRIMARY}).`),
sandbox: z
.boolean()
.default(false)
.describe("Use sandbox mode to safely test code changes, execute scripts, or run potentially risky operations in an isolated environment"),
approvalMode: z
.enum([
APPROVAL_MODES.PLAN,
APPROVAL_MODES.DEFAULT,
APPROVAL_MODES.AUTO_EDIT,
APPROVAL_MODES.YOLO
])
.optional()
.describe("Control tool execution approval: 'plan' (analyze only), 'default' (prompt for approval), 'auto-edit' (auto-approve edits), 'yolo' (auto-approve all)"),
yolo: z
.boolean()
.default(false)
.describe("Enable YOLO mode to automatically approve all tool calls without prompting (equivalent to approvalMode='yolo')"),
allFiles: z
.boolean()
.default(false)
.describe("Include all files in the current directory as context (use with caution for large directories)"),
debug: z
.boolean()
.default(false)
.describe("Enable debug mode for more verbose output"),
codeMode: z
.boolean()
.default(false)
.describe("Enable code-specific analysis mode for better code understanding"),
reviewMode: z
.boolean()
.default(false)
.describe("Enable code review mode for detailed feedback"),
optimize: z
.boolean()
.default(false)
.describe("Request optimization suggestions for the code"),
explain: z
.boolean()
.default(false)
.describe("Request detailed explanations of code functionality")
}),
execute: async (args, onProgress) => {
const { prompt, model, sandbox, approvalMode, yolo, allFiles, debug, codeMode, reviewMode, optimize, explain } = args;
// Validate prompt
if (!prompt || !prompt.trim()) {
throw new Error(ERROR_MESSAGES.NO_PROMPT_PROVIDED);
}
// Execute Rovodev CLI
const result = await executeRovodevCLI({
prompt,
model,
sandbox,
approvalMode,
yolo,
allFiles,
debug,
codeMode,
reviewMode,
optimize,
explain,
onProgress
});
return result;
},
prompt: {
name: "ask-rovodev",
description: "Interact with Rovodev AI for code analysis, file exploration, and general queries. Supports @file or #file references for including file contents.",
arguments: [
{
name: "prompt",
description: "Your question or instruction. Use @filename or #filename to reference files.",
required: true
},
{
name: "model",
description: `Optional model selection (${ROVODEV_MODELS.PRIMARY}, ${ROVODEV_MODELS.BASIC}, etc.)`,
required: false
},
{
name: "sandbox",
description: "Enable sandbox mode for safe code execution",
required: false
},
{
name: "approvalMode",
description: "Control approval for tool execution (plan/default/auto-edit/yolo)",
required: false
},
{
name: "codeMode",
description: "Enable code-specific analysis mode",
required: false
},
{
name: "reviewMode",
description: "Enable detailed code review mode",
required: false
},
{
name: "optimize",
description: "Request optimization suggestions",
required: false
},
{
name: "explain",
description: "Request detailed explanations",
required: false
}
]
}
};
//# sourceMappingURL=ask-rovodev.tool.js.map