diff --git a/packages/types/src/global-settings.ts b/packages/types/src/global-settings.ts index 8916263d5d..9c506fdb35 100644 --- a/packages/types/src/global-settings.ts +++ b/packages/types/src/global-settings.ts @@ -145,6 +145,14 @@ export const globalSettingsSchema = z.object({ hasOpenedModeSelector: z.boolean().optional(), lastModeExportPath: z.string().optional(), lastModeImportPath: z.string().optional(), + rulesSettings: z + .object({ + selectedRuleTypes: z.array(z.string()), + addToGitignore: z.boolean(), + includeCustomRules: z.boolean(), + customRulesText: z.string(), + }) + .optional(), }) export type GlobalSettings = z.infer diff --git a/src/core/prompts/instructions/__tests__/generate-rules.test.ts b/src/core/prompts/instructions/__tests__/generate-rules.test.ts new file mode 100644 index 0000000000..80f647b08a --- /dev/null +++ b/src/core/prompts/instructions/__tests__/generate-rules.test.ts @@ -0,0 +1,138 @@ +import { describe, it, expect } from "vitest" +import { + generateRulesInstructions, + ruleTypeDefinitions, + RulesGenerationOptions, + RuleInstruction, +} from "../generate-rules" + +describe("generateRulesInstructions", () => { + it("should generate instructions with all options enabled", () => { + const ruleInstructions: RuleInstruction[] = [ruleTypeDefinitions.general, ruleTypeDefinitions.code] + + const options: RulesGenerationOptions = { + selectedRuleTypes: ["general", "code"], + addToGitignore: true, + alwaysAllowWriteProtected: true, + includeCustomRules: true, + customRulesText: "Always use TypeScript", + } + + const result = generateRulesInstructions(ruleInstructions, options) + + expect(result).toContain("Analyze this codebase and generate comprehensive rules") + expect(result).toContain("coding-standards.md") + expect(result).toContain("implementation-rules.md") + expect(result).toContain("The directory has already been created for you") + expect(result).toContain("Add the generated files to .gitignore") + expect(result).toContain("Always use TypeScript") + }) + + it("should generate instructions with minimal options", () => { + const ruleInstructions: RuleInstruction[] = [ruleTypeDefinitions.general] + + const options: RulesGenerationOptions = { + selectedRuleTypes: ["general"], + addToGitignore: false, + alwaysAllowWriteProtected: false, + includeCustomRules: false, + customRulesText: "", + } + + const result = generateRulesInstructions(ruleInstructions, options) + + expect(result).toContain("Analyze this codebase and generate comprehensive rules") + expect(result).toContain("coding-standards.md") + expect(result).toContain("Create the necessary directories if they don't exist") + expect(result).not.toContain("Add the generated files to .gitignore") + expect(result).not.toContain("Additional rules from User") + }) + + it("should handle all rule types", () => { + const allRuleTypes = Object.keys(ruleTypeDefinitions) + const ruleInstructions: RuleInstruction[] = allRuleTypes.map( + (type) => ruleTypeDefinitions[type as keyof typeof ruleTypeDefinitions], + ) + + const options: RulesGenerationOptions = { + selectedRuleTypes: allRuleTypes, + addToGitignore: false, + alwaysAllowWriteProtected: false, + includeCustomRules: false, + customRulesText: "", + } + + const result = generateRulesInstructions(ruleInstructions, options) + + expect(result).toContain("coding-standards.md") + expect(result).toContain("implementation-rules.md") + expect(result).toContain("architecture-rules.md") + expect(result).toContain("debugging-rules.md") + expect(result).toContain("documentation-rules.md") + }) +}) + +describe("ruleTypeDefinitions", () => { + it("should have all expected rule types", () => { + expect(ruleTypeDefinitions).toHaveProperty("general") + expect(ruleTypeDefinitions).toHaveProperty("code") + expect(ruleTypeDefinitions).toHaveProperty("architect") + expect(ruleTypeDefinitions).toHaveProperty("debug") + expect(ruleTypeDefinitions).toHaveProperty("docs-extractor") + }) + + it("should have proper structure for each rule type", () => { + Object.values(ruleTypeDefinitions).forEach((rule) => { + expect(rule).toHaveProperty("path") + expect(rule).toHaveProperty("focus") + expect(rule).toHaveProperty("analysisSteps") + expect(Array.isArray(rule.analysisSteps)).toBe(true) + expect(rule.analysisSteps.length).toBeGreaterThan(0) + }) + }) + + it("should have correct paths for each rule type", () => { + expect(ruleTypeDefinitions.general.path).toBe(".roo/rules/coding-standards.md") + expect(ruleTypeDefinitions.code.path).toBe(".roo/rules-code/implementation-rules.md") + expect(ruleTypeDefinitions.architect.path).toBe(".roo/rules-architect/architecture-rules.md") + expect(ruleTypeDefinitions.debug.path).toBe(".roo/rules-debug/debugging-rules.md") + expect(ruleTypeDefinitions["docs-extractor"].path).toBe(".roo/rules-docs-extractor/documentation-rules.md") + }) + + it("should include proper instructions for existing rule files", () => { + const ruleInstructions: RuleInstruction[] = [ruleTypeDefinitions.general] + const options: RulesGenerationOptions = { + selectedRuleTypes: ["general"], + addToGitignore: false, + alwaysAllowWriteProtected: false, + includeCustomRules: false, + customRulesText: "", + } + + const result = generateRulesInstructions(ruleInstructions, options) + + expect(result).toContain("Look for existing rule files") + expect(result).toContain("CLAUDE.md, .cursorrules, .cursor/rules, or .github/copilot-instructions.md") + expect(result).toContain("If found, incorporate and improve upon their content") + }) + + it("should include proper formatting instructions", () => { + const ruleInstructions: RuleInstruction[] = [ruleTypeDefinitions.general] + const options: RulesGenerationOptions = { + selectedRuleTypes: ["general"], + addToGitignore: false, + alwaysAllowWriteProtected: false, + includeCustomRules: false, + customRulesText: "", + } + + const result = generateRulesInstructions(ruleInstructions, options) + + expect(result).toContain("Make the rules actionable and specific") + expect(result).toContain("Build/lint/test commands") + expect(result).toContain("Code style guidelines") + expect(result).toContain("Error handling patterns") + expect(result).toContain("Keep rules concise") + expect(result).toContain("aim for 20 lines per file") + }) +}) diff --git a/src/core/prompts/instructions/generate-rules.ts b/src/core/prompts/instructions/generate-rules.ts new file mode 100644 index 0000000000..7a7546b8b6 --- /dev/null +++ b/src/core/prompts/instructions/generate-rules.ts @@ -0,0 +1,125 @@ +export interface RuleInstruction { + path: string + focus: string + analysisSteps: string[] +} + +export interface RulesGenerationOptions { + selectedRuleTypes: string[] + addToGitignore: boolean + alwaysAllowWriteProtected: boolean + includeCustomRules: boolean + customRulesText: string +} + +export function generateRulesInstructions( + ruleInstructions: RuleInstruction[], + options: RulesGenerationOptions, +): string { + const { addToGitignore, alwaysAllowWriteProtected, includeCustomRules, customRulesText } = options + + return `Analyze this codebase and generate comprehensive rules for AI agents working in this repository. + +Your task is to: + +1. **Analyze the project structure** by: +${ruleInstructions.map((rule) => ` - For ${rule.path.split("/").pop()}: ${rule.analysisSteps.join("; ")}`).join("\n")} + +2. **Look for existing rule files** that might provide guidance: + - Check for CLAUDE.md, .cursorrules, .cursor/rules, or .github/copilot-instructions.md + - If found, incorporate and improve upon their content + +3. **Generate and save the following rule files**: +${ruleInstructions + .map( + (rule, index) => ` + ${index + 1}. **${rule.path}** + - Focus: ${rule.focus}${alwaysAllowWriteProtected ? "\n - The directory has already been created for you" : "\n - Create the necessary directories if they don't exist"} + - Always overwrite the existing file if it exists + - Use the \`write_to_file\` tool to save the content${alwaysAllowWriteProtected ? "\n - Note: Auto-approval for protected file writes is enabled, so you can write to .roo directories without manual approval" : "\n - Note: You will need to approve the creation of protected directories and files"}`, + ) + .join("\n")} + +4. **Make the rules actionable and specific** by including: + - Build/lint/test commands (especially for running single tests) + - Code style guidelines including imports, formatting, types, naming conventions + - Error handling patterns specific to this project + - Project-specific conventions and best practices + - File organization patterns + +5. **Keep rules concise** - aim for 20 lines per file, focusing on the most important guidelines + +${ + addToGitignore + ? `6. **Add the generated files to .gitignore**: + - After generating all rule files, add entries to .gitignore to prevent them from being committed + - Add each generated file path to .gitignore (e.g., .roo/rules/coding-standards.md) + - If .gitignore doesn't exist, create it + - If the entries already exist in .gitignore, don't duplicate them` + : "" +} + +${ + includeCustomRules && customRulesText + ? `\n**Additional rules from User to add to the rules file:**\n${customRulesText}` + : "" +}` +} + +export const ruleTypeDefinitions = { + general: { + path: ".roo/rules/coding-standards.md", + focus: "General coding standards that apply to all modes, including naming conventions, file organization, and general best practices", + analysisSteps: [ + "Examine the project structure and file organization patterns", + "Identify naming conventions for files, functions, variables, and classes", + "Look for general coding patterns and conventions used throughout the codebase", + "Check for any existing documentation or README files that describe project standards", + ], + }, + code: { + path: ".roo/rules-code/implementation-rules.md", + focus: "Specific rules for code implementation, focusing on syntax patterns, code structure, error handling, testing approaches, and detailed implementation guidelines", + analysisSteps: [ + "Analyze package.json or equivalent files to identify dependencies and build tools", + "Check for linting and formatting tools (ESLint, Prettier, etc.) and their configurations", + "Examine test files to understand testing patterns and frameworks used", + "Look for error handling patterns and logging strategies", + "Identify code style preferences and import/export patterns", + "Check for TypeScript usage and type definition patterns if applicable", + ], + }, + architect: { + path: ".roo/rules-architect/architecture-rules.md", + focus: "High-level system design rules, focusing on file layout, module organization, architectural patterns, and system-wide design principles", + analysisSteps: [ + "Analyze the overall directory structure and module organization", + "Identify architectural patterns (MVC, microservices, monorepo, etc.)", + "Look for separation of concerns and layering patterns", + "Check for API design patterns and service boundaries", + "Examine how different parts of the system communicate", + ], + }, + debug: { + path: ".roo/rules-debug/debugging-rules.md", + focus: "Debugging workflow rules, including error investigation approaches, logging strategies, troubleshooting patterns, and debugging best practices", + analysisSteps: [ + "Identify logging frameworks and patterns used in the codebase", + "Look for error handling and exception patterns", + "Check for debugging tools or scripts in the project", + "Analyze test structure for debugging approaches", + "Look for monitoring or observability patterns", + ], + }, + "docs-extractor": { + path: ".roo/rules-docs-extractor/documentation-rules.md", + focus: "Documentation extraction and formatting rules, including documentation style guides, API documentation patterns, and content organization", + analysisSteps: [ + "Check for existing documentation files and their formats", + "Analyze code comments and documentation patterns", + "Look for API documentation tools or generators", + "Identify documentation structure and organization patterns", + "Check for examples or tutorials in the codebase", + ], + }, +} diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index b1b62229c9..dbb3b74d9c 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -1931,6 +1931,112 @@ export const webviewMessageHandler = async ( }) } break + case "generateRules": + // Generate rules for the current workspace by spawning a new task + try { + // Import the rules generation service + const { handleGenerateRules } = await import("../../services/rules/rulesGenerator") + + // Call the refactored function with all necessary parameters + await handleGenerateRules( + provider, + { + selectedRuleTypes: message.selectedRuleTypes, + addToGitignore: message.addToGitignore, + alwaysAllowWriteProtected: message.alwaysAllowWriteProtected, + apiConfigName: message.apiConfigName, + includeCustomRules: message.includeCustomRules, + customRulesText: message.customRulesText, + }, + getGlobalState, + updateGlobalState, + ) + } catch (error) { + // Show error message to user + const errorMessage = error instanceof Error ? error.message : String(error) + vscode.window.showErrorMessage(`Failed to generate rules: ${errorMessage}`) + } + break + case "checkExistingRuleFiles": + // Check which rule files already exist and count source files + try { + const workspacePath = getWorkspacePath() + if (!workspacePath) { + break + } + + const { fileExistsAtPath } = await import("../../utils/fs") + const path = await import("path") + const fs = await import("fs/promises") + + const ruleTypeToPath: Record = { + general: path.join(workspacePath, ".roo", "rules", "coding-standards.md"), + code: path.join(workspacePath, ".roo", "rules-code", "implementation-rules.md"), + architect: path.join(workspacePath, ".roo", "rules-architect", "architecture-rules.md"), + debug: path.join(workspacePath, ".roo", "rules-debug", "debugging-rules.md"), + "docs-extractor": path.join( + workspacePath, + ".roo", + "rules-docs-extractor", + "documentation-rules.md", + ), + } + + const existingFiles: string[] = [] + for (const [type, filePath] of Object.entries(ruleTypeToPath)) { + if (await fileExistsAtPath(filePath)) { + existingFiles.push(type) + } + } + + // Count all files in the workspace + let sourceFileCount = 0 + try { + // Use VS Code API to count all files + const vscode = await import("vscode") + + // Find all files (excluding common non-project files) + const pattern = "**/*" + const excludePattern = + "**/node_modules/**,**/.git/**,**/dist/**,**/build/**,**/.next/**,**/.nuxt/**,**/coverage/**,**/.cache/**" + + const files = await vscode.workspace.findFiles(pattern, excludePattern) + sourceFileCount = files.length + } catch (error) { + // If counting fails, set to -1 to indicate unknown + sourceFileCount = -1 + } + + await provider.postMessageToWebview({ + type: "existingRuleFiles", + files: existingFiles, + sourceFileCount, + }) + } catch (error) { + // Silently fail - not critical + } + break + case "updateRulesSettings": + // Save rules settings to global state + await updateGlobalState("rulesSettings", { + selectedRuleTypes: message.selectedRuleTypes || ["general", "code"], + addToGitignore: message.addToGitignore !== undefined ? message.addToGitignore : true, + includeCustomRules: message.includeCustomRules || false, + customRulesText: message.customRulesText || "", + }) + break + case "getRulesSettings": + // Send current rules settings to webview + const rulesSettings = getGlobalState("rulesSettings") || { + selectedRuleTypes: ["general", "code"], + addToGitignore: true, + } + await provider.postMessageToWebview({ + type: "rulesSettings", + selectedRuleTypes: rulesSettings.selectedRuleTypes, + addToGitignore: rulesSettings.addToGitignore, + }) + break case "humanRelayResponse": if (message.requestId && message.text) { vscode.commands.executeCommand(getCommand("handleHumanRelayResponse"), { diff --git a/src/services/rules/__tests__/rulesGenerator.test.ts b/src/services/rules/__tests__/rulesGenerator.test.ts new file mode 100644 index 0000000000..ee051ac3c0 --- /dev/null +++ b/src/services/rules/__tests__/rulesGenerator.test.ts @@ -0,0 +1,301 @@ +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest" +import * as fs from "fs/promises" +import * as path from "path" +import * as vscode from "vscode" +import { createRulesGenerationTaskMessage, handleGenerateRules } from "../rulesGenerator" +import { ClineProvider } from "../../../core/webview/ClineProvider" + +// Mock fs module +vi.mock("fs/promises", () => ({ + mkdir: vi.fn(), +})) + +// Mock vscode module +vi.mock("vscode", () => ({ + window: { + showErrorMessage: vi.fn(), + }, +})) + +// Mock getWorkspacePath +vi.mock("../../../utils/path", () => ({ + getWorkspacePath: vi.fn(), +})) + +describe("rulesGenerator", () => { + const mockWorkspacePath = "/test/workspace" + + beforeEach(() => { + vi.clearAllMocks() + }) + + afterEach(() => { + vi.restoreAllMocks() + }) + + describe("createRulesGenerationTaskMessage", () => { + it("should create directories when alwaysAllowWriteProtected is true", async () => { + await createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], false, true) + + // Verify mkdir was called for each directory + expect(fs.mkdir).toHaveBeenCalledWith(path.join(mockWorkspacePath, ".roo", "rules"), { recursive: true }) + expect(fs.mkdir).toHaveBeenCalledWith(path.join(mockWorkspacePath, ".roo", "rules-code"), { + recursive: true, + }) + expect(fs.mkdir).toHaveBeenCalledWith(path.join(mockWorkspacePath, ".roo", "rules-architect"), { + recursive: true, + }) + expect(fs.mkdir).toHaveBeenCalledWith(path.join(mockWorkspacePath, ".roo", "rules-debug"), { + recursive: true, + }) + expect(fs.mkdir).toHaveBeenCalledWith(path.join(mockWorkspacePath, ".roo", "rules-docs-extractor"), { + recursive: true, + }) + }) + + it("should NOT create directories when alwaysAllowWriteProtected is false", async () => { + await createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], false, false) + + // Verify mkdir was NOT called + expect(fs.mkdir).not.toHaveBeenCalled() + }) + + it("should include auto-approval note in message when alwaysAllowWriteProtected is true", async () => { + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], false, true) + + expect(message).toContain("The directory has already been created for you") + expect(message).toContain("Auto-approval for protected file writes is enabled") + }) + + it("should include manual approval note in message when alwaysAllowWriteProtected is false", async () => { + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], false, false) + + expect(message).toContain("Create the necessary directories if they don't exist") + expect(message).toContain("You will need to approve the creation of protected directories and files") + }) + + it("should handle multiple rule types", async () => { + const message = await createRulesGenerationTaskMessage( + mockWorkspacePath, + ["general", "code", "architect"], + false, + true, + ) + + expect(message).toContain(".roo/rules/coding-standards.md") + expect(message).toContain(".roo/rules-code/implementation-rules.md") + expect(message).toContain(".roo/rules-architect/architecture-rules.md") + }) + + it("should include gitignore instructions when addToGitignore is true", async () => { + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], true, false) + + expect(message).toContain("Add the generated files to .gitignore") + }) + + it("should include analysis steps for each rule type", async () => { + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, ["code"], false, false) + + // Check that code-specific analysis steps are included + expect(message).toContain("Analyze package.json or equivalent files") + expect(message).toContain("Check for linting and formatting tools") + expect(message).toContain("Examine test files to understand testing patterns") + }) + + it("should include different analysis steps for different rule types", async () => { + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, ["architect"], false, false) + + // Check that architect-specific analysis steps are included + expect(message).toContain("Analyze the overall directory structure") + expect(message).toContain("Identify architectural patterns") + expect(message).toContain("separation of concerns") + }) + + it("should include custom rules when includeCustomRules is true", async () => { + const customRulesText = "Always use TypeScript interfaces instead of types" + const message = await createRulesGenerationTaskMessage( + mockWorkspacePath, + ["general"], + false, + false, + true, + customRulesText, + ) + + expect(message).toContain("Additional rules from User to add to the rules file:") + expect(message).toContain(customRulesText) + }) + + it("should not include custom rules when includeCustomRules is false", async () => { + const customRulesText = "Always use TypeScript interfaces instead of types" + const message = await createRulesGenerationTaskMessage( + mockWorkspacePath, + ["general"], + false, + false, + false, + customRulesText, + ) + + expect(message).not.toContain("Additional rules from User to add to the rules file:") + expect(message).not.toContain(customRulesText) + }) + + it("should handle empty custom rules text", async () => { + const message = await createRulesGenerationTaskMessage( + mockWorkspacePath, + ["general"], + false, + false, + true, + "", + ) + + expect(message).not.toContain("Additional rules from User to add to the rules file:") + }) + + it("should handle mkdir errors gracefully", async () => { + // Mock mkdir to throw an error + vi.mocked(fs.mkdir).mockRejectedValueOnce(new Error("Permission denied")) + + // Should not throw even if mkdir fails + await expect( + createRulesGenerationTaskMessage(mockWorkspacePath, ["general"], false, true), + ).resolves.toBeDefined() + }) + + it("should filter out invalid rule types", async () => { + const message = await createRulesGenerationTaskMessage( + mockWorkspacePath, + ["general", "invalid-type", "code"], + false, + false, + ) + + // Should include valid types + expect(message).toContain(".roo/rules/coding-standards.md") + expect(message).toContain(".roo/rules-code/implementation-rules.md") + + // Should not include invalid type + expect(message).not.toContain("invalid-type") + }) + + it("should handle all rule types", async () => { + const allRuleTypes = ["general", "code", "architect", "debug", "docs-extractor"] + const message = await createRulesGenerationTaskMessage(mockWorkspacePath, allRuleTypes, false, false) + + // Check all rule files are mentioned + expect(message).toContain(".roo/rules/coding-standards.md") + expect(message).toContain(".roo/rules-code/implementation-rules.md") + expect(message).toContain(".roo/rules-architect/architecture-rules.md") + expect(message).toContain(".roo/rules-debug/debugging-rules.md") + expect(message).toContain(".roo/rules-docs-extractor/documentation-rules.md") + }) + }) + + describe("handleGenerateRules", () => { + let mockProvider: ClineProvider + let mockGetGlobalState: any + let mockUpdateGlobalState: any + let mockGetWorkspacePath: any + + beforeEach(async () => { + // Mock provider + mockProvider = { + activateProviderProfile: vi.fn(), + initClineWithTask: vi.fn(), + postMessageToWebview: vi.fn(), + } as any + + // Mock global state functions + mockGetGlobalState = vi.fn() + mockUpdateGlobalState = vi.fn() + + // Import and mock getWorkspacePath + const pathModule = await import("../../../utils/path") + mockGetWorkspacePath = vi.spyOn(pathModule, "getWorkspacePath") + mockGetWorkspacePath.mockReturnValue(mockWorkspacePath) + }) + + it("should show error when no workspace is open", async () => { + mockGetWorkspacePath.mockReturnValue(undefined) + + await handleGenerateRules(mockProvider, {}, mockGetGlobalState, mockUpdateGlobalState) + + expect(vscode.window.showErrorMessage).toHaveBeenCalledWith( + "No workspace folder open. Please open a folder to generate rules.", + ) + expect(mockProvider.initClineWithTask).not.toHaveBeenCalled() + }) + + it("should switch API config when different from current", async () => { + mockGetGlobalState.mockReturnValue("current-config") + + await handleGenerateRules( + mockProvider, + { apiConfigName: "new-config" }, + mockGetGlobalState, + mockUpdateGlobalState, + ) + + expect(mockUpdateGlobalState).toHaveBeenCalledWith("currentApiConfigName", "new-config") + expect(mockProvider.activateProviderProfile).toHaveBeenCalledWith({ name: "new-config" }) + }) + + it("should not switch API config when same as current", async () => { + mockGetGlobalState.mockReturnValue("current-config") + + await handleGenerateRules( + mockProvider, + { apiConfigName: "current-config" }, + mockGetGlobalState, + mockUpdateGlobalState, + ) + + expect(mockUpdateGlobalState).not.toHaveBeenCalled() + expect(mockProvider.activateProviderProfile).not.toHaveBeenCalled() + }) + + it("should create task and switch to chat tab", async () => { + await handleGenerateRules( + mockProvider, + { selectedRuleTypes: ["general"] }, + mockGetGlobalState, + mockUpdateGlobalState, + ) + + expect(mockProvider.initClineWithTask).toHaveBeenCalled() + expect(mockProvider.postMessageToWebview).toHaveBeenCalledWith({ + type: "action", + action: "switchTab", + tab: "chat", + }) + }) + + it("should pass all options to createRulesGenerationTaskMessage", async () => { + const options = { + selectedRuleTypes: ["general", "code"], + addToGitignore: true, + alwaysAllowWriteProtected: true, + includeCustomRules: true, + customRulesText: "Custom rules text", + } + + await handleGenerateRules(mockProvider, options, mockGetGlobalState, mockUpdateGlobalState) + + // Verify the task was created with the correct message + expect(mockProvider.initClineWithTask).toHaveBeenCalled() + const taskMessage = vi.mocked(mockProvider.initClineWithTask).mock.calls[0][0] + expect(taskMessage).toContain("Custom rules text") + }) + + it("should use default values when options are not provided", async () => { + await handleGenerateRules(mockProvider, {}, mockGetGlobalState, mockUpdateGlobalState) + + expect(mockProvider.initClineWithTask).toHaveBeenCalled() + // The default selectedRuleTypes should be ["general"] + const taskMessage = vi.mocked(mockProvider.initClineWithTask).mock.calls[0][0] + expect(taskMessage).toContain(".roo/rules/coding-standards.md") + }) + }) +}) diff --git a/src/services/rules/rulesGenerator.ts b/src/services/rules/rulesGenerator.ts new file mode 100644 index 0000000000..cebc72f4fb --- /dev/null +++ b/src/services/rules/rulesGenerator.ts @@ -0,0 +1,127 @@ +import * as fs from "fs/promises" +import * as path from "path" +import * as vscode from "vscode" +import { GlobalState } from "@roo-code/types" +import { + generateRulesInstructions, + ruleTypeDefinitions, + RulesGenerationOptions, + RuleInstruction, +} from "../../core/prompts/instructions/generate-rules" +import { getWorkspacePath } from "../../utils/path" +import { ClineProvider } from "../../core/webview/ClineProvider" + +/** + * Creates a comprehensive task message for rules generation that can be used with initClineWithTask + */ +export async function createRulesGenerationTaskMessage( + workspacePath: string, + selectedRuleTypes: string[], + addToGitignore: boolean, + alwaysAllowWriteProtected: boolean = false, + includeCustomRules: boolean = false, + customRulesText: string = "", +): Promise { + // Only create directories if auto-approve is enabled + if (alwaysAllowWriteProtected) { + const directoriesToCreate = [ + path.join(workspacePath, ".roo", "rules"), + path.join(workspacePath, ".roo", "rules-code"), + path.join(workspacePath, ".roo", "rules-architect"), + path.join(workspacePath, ".roo", "rules-debug"), + path.join(workspacePath, ".roo", "rules-docs-extractor"), + ] + + for (const dir of directoriesToCreate) { + try { + await fs.mkdir(dir, { recursive: true }) + } catch (error) { + // Directory might already exist, which is fine + } + } + } + + // Create rule-specific instructions based on selected types + const ruleInstructions: RuleInstruction[] = selectedRuleTypes + .map((type) => { + const definition = ruleTypeDefinitions[type as keyof typeof ruleTypeDefinitions] + return definition || null + }) + .filter((rule): rule is RuleInstruction => rule !== null) + + const options: RulesGenerationOptions = { + selectedRuleTypes, + addToGitignore, + alwaysAllowWriteProtected, + includeCustomRules, + customRulesText, + } + + return generateRulesInstructions(ruleInstructions, options) +} + +/** + * Options for generating rules + */ +export interface GenerateRulesOptions { + selectedRuleTypes?: string[] + addToGitignore?: boolean + alwaysAllowWriteProtected?: boolean + apiConfigName?: string + includeCustomRules?: boolean + customRulesText?: string +} + +/** + * Handles the complete rules generation process including API config switching, + * task creation, and UI navigation + */ +export async function handleGenerateRules( + provider: ClineProvider, + options: GenerateRulesOptions, + getGlobalState: (key: K) => GlobalState[K], + updateGlobalState: (key: K, value: GlobalState[K]) => Promise, +): Promise { + const workspacePath = getWorkspacePath() + if (!workspacePath) { + vscode.window.showErrorMessage("No workspace folder open. Please open a folder to generate rules.") + return + } + + // Extract options with defaults + const selectedRuleTypes = options.selectedRuleTypes || ["general"] + const addToGitignore = options.addToGitignore || false + const alwaysAllowWriteProtected = options.alwaysAllowWriteProtected || false + const apiConfigName = options.apiConfigName + const includeCustomRules = options.includeCustomRules || false + const customRulesText = options.customRulesText || "" + + // Switch to the selected API config if provided + if (apiConfigName) { + const currentApiConfig = getGlobalState("currentApiConfigName") + if (apiConfigName !== currentApiConfig) { + await updateGlobalState("currentApiConfigName", apiConfigName) + await provider.activateProviderProfile({ name: apiConfigName }) + } + } + + // Create a comprehensive message for the rules generation task + const rulesGenerationMessage = await createRulesGenerationTaskMessage( + workspacePath, + selectedRuleTypes, + addToGitignore, + alwaysAllowWriteProtected, + includeCustomRules, + customRulesText, + ) + + // Spawn a new task in code mode to generate the rules + await provider.initClineWithTask(rulesGenerationMessage) + + // Automatically navigate to the chat tab to show the new task + await provider.postMessageToWebview({ + type: "action", + action: "switchTab", + tab: "chat", + }) +} diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 1e562bb9ee..c73b6fda8d 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -116,12 +116,19 @@ export interface ExtensionMessage { | "shareTaskSuccess" | "codeIndexSettingsSaved" | "codeIndexSecretStatus" + | "rulesGenerationStatus" + | "existingRuleFiles" | "showDeleteMessageDialog" | "showEditMessageDialog" + | "rulesSettings" | "commands" | "insertTextIntoTextarea" text?: string payload?: any // Add a generic payload for now, can refine later + files?: string[] // For existingRuleFiles + sourceFileCount?: number // For existingRuleFiles to show warning for small repos + selectedRuleTypes?: string[] // For rulesSettings + addToGitignore?: boolean // For rulesSettings action?: | "chatButtonClicked" | "mcpButtonClicked" @@ -224,6 +231,7 @@ export type ExtensionState = Pick< | "allowedMaxRequests" | "browserToolEnabled" | "browserViewportSize" + | "rulesSettings" | "screenshotQuality" | "remoteBrowserEnabled" | "remoteBrowserHost" diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index 0b0cc06880..d56478b437 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -204,6 +204,10 @@ export interface WebviewMessage { | "checkRulesDirectoryResult" | "saveCodeIndexSettingsAtomic" | "requestCodeIndexSecretStatus" + | "generateRules" + | "checkExistingRuleFiles" + | "updateRulesSettings" + | "getRulesSettings" | "requestCommands" | "openCommandFile" | "deleteCommand" @@ -252,6 +256,13 @@ export interface WebviewMessage { visibility?: ShareVisibility // For share visibility hasContent?: boolean // For checkRulesDirectoryResult checkOnly?: boolean // For deleteCustomMode check + selectedRuleTypes?: string[] // For generateRules + addToGitignore?: boolean // For generateRules + alwaysAllowWriteProtected?: boolean // For generateRules + apiConfigName?: string // For generateRules + includeCustomRules?: boolean // For generateRules + customRulesText?: string // For generateRules + files?: string[] // For existingRuleFiles response codeIndexSettings?: { // Global state settings codebaseIndexEnabled: boolean diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index a52902f1e5..b42a2458ae 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -105,6 +105,7 @@ const ChatTextArea = forwardRef( const [fileSearchResults, setFileSearchResults] = useState([]) const [searchLoading, setSearchLoading] = useState(false) const [searchRequestId, setSearchRequestId] = useState("") + const [waitingForRulesSettings, setWaitingForRulesSettings] = useState(false) // Close dropdown when clicking outside. useEffect(() => { @@ -191,12 +192,26 @@ const ChatTextArea = forwardRef( if (message.requestId === searchRequestId) { setFileSearchResults(message.results || []) } + } else if (message.type === "rulesSettings") { + // Only trigger generation if we're waiting for it (user used /make-rules command) + if (waitingForRulesSettings) { + setWaitingForRulesSettings(false) + // Received rules settings, now trigger generation + vscode.postMessage({ + type: "generateRules", + selectedRuleTypes: message.selectedRuleTypes || ["general", "code"], + addToGitignore: message.addToGitignore !== undefined ? message.addToGitignore : true, + alwaysAllowWriteProtected: false, + includeCustomRules: message.includeCustomRules || false, + customRulesText: message.customRulesText || "", + }) + } } } window.addEventListener("message", messageHandler) return () => window.removeEventListener("message", messageHandler) - }, [setInputValue, searchRequestId, inputValue]) + }, [setInputValue, searchRequestId, waitingForRulesSettings, inputValue]) const [isDraggingOver, setIsDraggingOver] = useState(false) const [textAreaBaseHeight, setTextAreaBaseHeight] = useState(undefined) @@ -302,6 +317,18 @@ const ChatTextArea = forwardRef( return } + if (type === ContextMenuOptionType.Rules) { + // Handle rules generation command + setInputValue("") + setShowContextMenu(false) + // Set flag to indicate we're waiting for settings + setWaitingForRulesSettings(true) + // First get the saved settings + vscode.postMessage({ type: "getRulesSettings" }) + // The actual generation will be triggered when we receive the settings + return + } + if (type === ContextMenuOptionType.Command && value) { // Handle command selection. setSelectedMenuIndex(-1) diff --git a/webview-ui/src/components/settings/ExperimentalSettings.tsx b/webview-ui/src/components/settings/ExperimentalSettings.tsx index 53801232ec..3de36bfdd4 100644 --- a/webview-ui/src/components/settings/ExperimentalSettings.tsx +++ b/webview-ui/src/components/settings/ExperimentalSettings.tsx @@ -8,19 +8,31 @@ import { EXPERIMENT_IDS, experimentConfigsMap } from "@roo/experiments" import { useAppTranslation } from "@src/i18n/TranslationContext" import { cn } from "@src/lib/utils" -import { SetExperimentEnabled } from "./types" +import { SetExperimentEnabled, SetCachedStateField } from "./types" import { SectionHeader } from "./SectionHeader" import { Section } from "./Section" import { ExperimentalFeature } from "./ExperimentalFeature" +import { RulesSettings } from "./RulesSettings" type ExperimentalSettingsProps = HTMLAttributes & { experiments: Experiments setExperimentEnabled: SetExperimentEnabled + hasUnsavedChanges?: boolean + rulesSettings?: { + selectedRuleTypes: string[] + addToGitignore: boolean + includeCustomRules: boolean + customRulesText: string + } + setCachedStateField: SetCachedStateField<"rulesSettings"> } export const ExperimentalSettings = ({ experiments, setExperimentEnabled, + hasUnsavedChanges, + rulesSettings, + setCachedStateField, className, ...props }: ExperimentalSettingsProps) => { @@ -66,6 +78,8 @@ export const ExperimentalSettings = ({ ) })} + + ) } diff --git a/webview-ui/src/components/settings/RulesSettings.tsx b/webview-ui/src/components/settings/RulesSettings.tsx new file mode 100644 index 0000000000..4d5ccefa95 --- /dev/null +++ b/webview-ui/src/components/settings/RulesSettings.tsx @@ -0,0 +1,327 @@ +import { HTMLAttributes, useState, useEffect } from "react" +import { VSCodeTextArea } from "@vscode/webview-ui-toolkit/react" +import { useAppTranslation } from "@/i18n/TranslationContext" +import { FileText, AlertTriangle, Terminal } from "lucide-react" +import { vscode } from "@/utils/vscode" +import { cn } from "@/lib/utils" + +import { SectionHeader } from "./SectionHeader" +import { Section } from "./Section" +import { SetCachedStateField } from "./types" + +type RulesSettingsProps = HTMLAttributes & { + rulesSettings?: { + selectedRuleTypes: string[] + addToGitignore: boolean + includeCustomRules: boolean + customRulesText: string + } + setCachedStateField: SetCachedStateField<"rulesSettings"> +} + +interface RuleType { + id: string + label: string + description: string + checked: boolean + exists?: boolean +} + +export const RulesSettings = ({ rulesSettings, setCachedStateField, className, ...props }: RulesSettingsProps) => { + const { t } = useAppTranslation() + const [sourceFileCount, setSourceFileCount] = useState(null) + + const allRuleTypes = [ + { + id: "general", + label: t("settings:rules.types.general.label"), + description: t("settings:rules.types.general.description"), + }, + { + id: "code", + label: t("settings:rules.types.code.label"), + description: t("settings:rules.types.code.description"), + }, + { + id: "architect", + label: t("settings:rules.types.architect.label"), + description: t("settings:rules.types.architect.description"), + }, + { + id: "debug", + label: t("settings:rules.types.debug.label"), + description: t("settings:rules.types.debug.description"), + }, + { + id: "docs-extractor", + label: t("settings:rules.types.docsExtractor.label"), + description: t("settings:rules.types.docsExtractor.description"), + }, + ] + + const [ruleTypes, setRuleTypes] = useState( + allRuleTypes.map((ruleType) => ({ + ...ruleType, + checked: rulesSettings?.selectedRuleTypes.includes(ruleType.id) ?? true, + exists: false, + })), + ) + + // Update rule types when rulesSettings prop changes + useEffect(() => { + if (rulesSettings) { + setRuleTypes((prev) => + prev.map((ruleType) => ({ + ...ruleType, + checked: rulesSettings.selectedRuleTypes.includes(ruleType.id), + })), + ) + } + }, [rulesSettings]) + + const handleRuleTypeToggle = (id: string) => { + setRuleTypes((prev) => prev.map((rule) => (rule.id === id ? { ...rule, checked: !rule.checked } : rule))) + + // Update the cached state using the proper pattern + const updatedRules = ruleTypes.map((rule) => (rule.id === id ? { ...rule, checked: !rule.checked } : rule)) + const selectedRuleTypes = updatedRules.filter((rule) => rule.checked).map((rule) => rule.id) + + setCachedStateField("rulesSettings", { + selectedRuleTypes, + addToGitignore: rulesSettings?.addToGitignore ?? true, + includeCustomRules: rulesSettings?.includeCustomRules ?? false, + customRulesText: rulesSettings?.customRulesText ?? "", + }) + } + + const handleGitignoreToggle = (checked: boolean) => { + setCachedStateField("rulesSettings", { + selectedRuleTypes: rulesSettings?.selectedRuleTypes ?? [ + "general", + "code", + "architect", + "debug", + "docs-extractor", + ], + addToGitignore: checked, + includeCustomRules: rulesSettings?.includeCustomRules ?? false, + customRulesText: rulesSettings?.customRulesText ?? "", + }) + } + + const handleIncludeCustomRulesToggle = (checked: boolean) => { + setCachedStateField("rulesSettings", { + selectedRuleTypes: rulesSettings?.selectedRuleTypes ?? [ + "general", + "code", + "architect", + "debug", + "docs-extractor", + ], + addToGitignore: rulesSettings?.addToGitignore ?? true, + includeCustomRules: checked, + customRulesText: rulesSettings?.customRulesText ?? "", + }) + } + + const handleCustomRulesTextChange = (text: string) => { + setCachedStateField("rulesSettings", { + selectedRuleTypes: rulesSettings?.selectedRuleTypes ?? [ + "general", + "code", + "architect", + "debug", + "docs-extractor", + ], + addToGitignore: rulesSettings?.addToGitignore ?? true, + includeCustomRules: rulesSettings?.includeCustomRules ?? false, + customRulesText: text, + }) + } + + // Check for existing files when component mounts + useEffect(() => { + vscode.postMessage({ + type: "checkExistingRuleFiles", + }) + + // Request current rules settings + vscode.postMessage({ type: "getRulesSettings" }) + }, []) + + useEffect(() => { + const handleMessage = (event: MessageEvent) => { + const message = event.data + if (message.type === "existingRuleFiles") { + // Update rule types with existence information + setRuleTypes((prev) => + prev.map((rule) => ({ + ...rule, + exists: message.files?.includes(rule.id) || false, + })), + ) + // Set source file count if provided + if (message.sourceFileCount !== undefined) { + setSourceFileCount(message.sourceFileCount) + } + } else if (message.type === "rulesSettings") { + // Update settings from saved preferences - this is now handled by props + // The component will re-render when rulesSettings prop changes + } + } + + window.addEventListener("message", handleMessage) + return () => window.removeEventListener("message", handleMessage) + }, []) + + const existingRules = ruleTypes.filter((rule) => rule.checked && rule.exists) + const hasExistingFiles = existingRules.length > 0 + + return ( +
+ +
+ +
{t("settings:rules.title")}
+
+
+ +
+
+ {/* Command Line Instructions */} +
+ +
+
+ {t("settings:rules.commandTitle")}{" "} + + /make-rules + +
+
+ {t("settings:rules.commandDescription")} +
+
+
+ + {/* Settings Content */} +
+ {/* Add to .gitignore option */} + + + {/* Rule Type Selection */} +
+

{t("settings:rules.selectTypes")}

+
+ {ruleTypes.map((ruleType) => ( +
handleRuleTypeToggle(ruleType.id)} + className={cn( + "relative p-3 rounded-md border cursor-pointer transition-all", + "hover:border-vscode-focusBorder", + ruleType.checked + ? "bg-vscode-list-activeSelectionBackground border-vscode-focusBorder" + : "bg-vscode-editor-background border-vscode-panel-border", + )}> +
+
+ {ruleType.label} + {ruleType.exists && ( + + • + + )} +
+
+ {ruleType.description} +
+
+
+ ))} +
+
+ + {/* Custom Rules Section */} +
+ + + {rulesSettings?.includeCustomRules && ( +
+ + { + const value = + (e as unknown as CustomEvent)?.detail?.target?.value || + ((e as any).target as HTMLTextAreaElement).value + handleCustomRulesTextChange(value) + }} + placeholder={t("settings:rules.customRulesPlaceholder")} + rows={6} + className="w-full" + /> +
+ {t("settings:rules.customRulesHint")} +
+
+ )} +
+
+ + {/* Small repository warning */} + {sourceFileCount !== null && sourceFileCount > 0 && sourceFileCount < 20 && ( +
+ +
+ {t("settings:rules.smallRepoWarning", { count: sourceFileCount })} +
+
+ )} + + {/* Existing files warning */} + {hasExistingFiles && ( +
+ +
+
{t("settings:rules.overwriteWarning")}
+
    + {existingRules.map((rule) => ( +
  • {rule.label}
  • + ))} +
+
+
+ )} +
+
+
+ ) +} diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 9cfd9b64e5..e80eec7488 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -179,6 +179,7 @@ const SettingsView = forwardRef(({ onDone, t alwaysAllowFollowupQuestions, alwaysAllowUpdateTodoList, followupAutoApproveTimeoutMs, + rulesSettings, includeDiagnosticMessages, maxDiagnosticMessages, includeTaskHistoryInEnhance, @@ -716,7 +717,13 @@ const SettingsView = forwardRef(({ onDone, t {/* Experimental Section */} {activeTab === "experimental" && ( - + )} {/* Language Section */} diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 33537b58ac..61da05aff5 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -244,6 +244,12 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode }, codebaseIndexModels: { ollama: {}, openai: {} }, alwaysAllowUpdateTodoList: true, + rulesSettings: { + selectedRuleTypes: ["general", "code", "architect", "debug", "docs-extractor"], + addToGitignore: true, + includeCustomRules: false, + customRulesText: "", + }, includeDiagnosticMessages: true, maxDiagnosticMessages: 50, }) diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 3da1f5e50e..77e3ecb498 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -641,6 +641,53 @@ "description": "Quan està habilitat, Roo pot crear i gestionar llistes de tasques per fer el seguiment del progrés de les tasques. Això ajuda a organitzar tasques complexes en passos manejables." } }, + "rules": { + "title": "Regles", + "description": "Les regles ajuden els agents d'IA a entendre les convencions i millors pràctiques del teu projecte!", + "magicGeneration": { + "title": "Generació màgica de regles", + "description": "Analitza automàticament la teva base de codi i genera regles completes adaptades a les necessitats específiques del teu projecte." + }, + "generateButton": "Generar regles", + "generateButtonTooltip": "Crear una nova tasca per analitzar la base de codi i generar regles automàticament", + "selectTypes": "Selecciona els tipus de regles a generar:", + "noRulesSelected": "Si us plau, selecciona almenys un tipus de regla per generar", + "unsavedChangesError": "Si us plau, desa la teva configuració abans de generar regles", + "types": { + "general": { + "label": "Regles generals", + "description": "Estàndards de codificació generals aplicats a tots els modes" + }, + "code": { + "label": "Regles del mode Codi", + "description": "Regles específiques per a sintaxi de codi, detalls d'implementació i millors pràctiques" + }, + "architect": { + "label": "Regles del mode Arquitecte", + "description": "Regles per al disseny de sistemes d'alt nivell, organització d'arxius i patrons arquitectònics" + }, + "debug": { + "label": "Regles del mode Depuració", + "description": "Regles per a fluxos de treball de depuració, gestió d'errors i enfocaments de resolució de problemes" + }, + "docsExtractor": { + "label": "Regles de documentació", + "description": "Regles per a l'extracció de documentació i estàndards de format" + } + }, + "fileExists": "L'arxiu existeix", + "overwriteWarning": "Advertència: Els següents arxius de regles ja existeixen i seran sobreescrits:", + "addToGitignore": "Afegir a .gitignore", + "addToGitignoreDescription": "Afegir automàticament els arxius de regles generats a .gitignore per evitar que es facin commit al control de versions", + "autoApproveProtected": "Aprovar automàticament l'escriptura d'arxius protegits", + "autoApproveProtectedDescription": "Permetre que Roo creï i escrigui al directori .roo sense requerir aprovació manual", + "selectApiConfig": "Seleccionar configuració d'API", + "includeCustomRules": "Incloure les meves regles personalitzades", + "includeCustomRulesDescription": "Afegir instruccions personalitzades al prompt de generació de regles", + "customRulesPlaceholder": "Introdueix les teves regles o instruccions personalitzades aquí...", + "customRulesHint": "Aquestes s'inclouran al prompt quan es generin regles per al teu projecte", + "smallRepoWarning": "Aquest repositori només conté {{count}} arxius. Amb exemples de codi limitats, les regles generades poden ser massa específiques per a la teva implementació actual. Considera regenerar regles a mesura que el teu projecte creixi." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Utilitzar estratègia diff unificada experimental", diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index a96b41f0c3..cd1e9ef584 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -641,6 +641,53 @@ "description": "Wenn aktiviert, kann Roo Todo-Listen erstellen und verwalten, um den Aufgabenfortschritt zu verfolgen. Dies hilft, komplexe Aufgaben in überschaubare Schritte zu organisieren." } }, + "rules": { + "title": "Regeln", + "description": "Regeln helfen KI-Agenten dabei, die Konventionen und bewährten Praktiken deines Projekts zu verstehen!", + "magicGeneration": { + "title": "Magische Regelgenerierung", + "description": "Analysiere automatisch deine Codebasis und generiere umfassende Regeln, die auf die spezifischen Bedürfnisse deines Projekts zugeschnitten sind." + }, + "generateButton": "Regeln generieren", + "generateButtonTooltip": "Erstelle eine neue Aufgabe, um die Codebasis zu analysieren und automatisch Regeln zu generieren", + "selectTypes": "Wähle Regeltypen zum Generieren:", + "noRulesSelected": "Bitte wähle mindestens einen Regeltyp zum Generieren aus", + "unsavedChangesError": "Bitte speichere deine Einstellungen, bevor du Regeln generierst", + "types": { + "general": { + "label": "Allgemeine Regeln", + "description": "Allgemeine Codierungsstandards, die auf alle Modi angewendet werden" + }, + "code": { + "label": "Code-Modus-Regeln", + "description": "Spezifische Regeln für Code-Syntax, Implementierungsdetails und bewährte Praktiken" + }, + "architect": { + "label": "Architekt-Modus-Regeln", + "description": "Regeln für High-Level-Systemdesign, Dateiorganisation und Architekturmuster" + }, + "debug": { + "label": "Debug-Modus-Regeln", + "description": "Regeln für Debugging-Workflows, Fehlerbehandlung und Problemlösungsansätze" + }, + "docsExtractor": { + "label": "Dokumentationsregeln", + "description": "Regeln für Dokumentationsextraktion und Formatierungsstandards" + } + }, + "fileExists": "Datei existiert", + "overwriteWarning": "Warnung: Die folgenden Regeldateien existieren bereits und werden überschrieben:", + "addToGitignore": "Zu .gitignore hinzufügen", + "addToGitignoreDescription": "Füge die generierten Regeldateien automatisch zu .gitignore hinzu, um zu verhindern, dass sie in die Versionskontrolle übernommen werden", + "autoApproveProtected": "Geschützte Dateischreibvorgänge automatisch genehmigen", + "autoApproveProtectedDescription": "Erlaube Roo, das .roo-Verzeichnis zu erstellen und zu beschreiben, ohne manuelle Genehmigung zu benötigen", + "selectApiConfig": "API-Konfiguration auswählen", + "includeCustomRules": "Meine eigenen Regeln einbeziehen", + "includeCustomRulesDescription": "Füge benutzerdefinierte Anweisungen zur Regelgenerierungsaufforderung hinzu", + "customRulesPlaceholder": "Gib hier deine benutzerdefinierten Regeln oder Anweisungen ein...", + "customRulesHint": "Diese werden in die Aufforderung einbezogen, wenn Regeln für dein Projekt generiert werden", + "smallRepoWarning": "Dieses Repository enthält nur {{count}} Dateien. Mit begrenzten Codebeispielen können die generierten Regeln zu spezifisch für deine aktuelle Implementierung sein. Erwäge, Regeln zu regenerieren, wenn dein Projekt wächst." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Experimentelle einheitliche Diff-Strategie verwenden", diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 5f67268bd9..651e2a7966 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -678,6 +678,55 @@ "description": "Prevent editor focus disruption when enabled. File edits happen in the background without opening diff views or stealing focus. You can continue working uninterrupted while Roo makes changes. Files can be opened without focus to capture diagnostics or kept closed entirely." } }, + "rules": { + "title": "Rules", + "description": "Rules help AI agents understand your project's conventions and best practices!", + "magicGeneration": { + "title": "Magic Rules Generation", + "description": "Automatically analyze your codebase and generate comprehensive rules tailored to your project's specific needs." + }, + "generateButton": "Generate Rules", + "generateButtonTooltip": "Create a new task to analyze the codebase and generate rules automatically", + "selectTypes": "Select rule types to generate:", + "noRulesSelected": "Please select at least one rule type to generate", + "unsavedChangesError": "Please save your settings before generating rules", + "types": { + "general": { + "label": "General Rules", + "description": "General coding standards applied to all modes" + }, + "code": { + "label": "Code Mode Rules", + "description": "Specific rules for code syntax, implementation details, and best practices" + }, + "architect": { + "label": "Architect Mode Rules", + "description": "Rules for high-level system design, file organization, and architecture patterns" + }, + "debug": { + "label": "Debug Mode Rules", + "description": "Rules for debugging workflows, error handling, and troubleshooting approaches" + }, + "docsExtractor": { + "label": "Documentation Rules", + "description": "Rules for documentation extraction and formatting standards" + } + }, + "fileExists": "File exists", + "overwriteWarning": "Warning: The following rule files already exist and will be overwritten:", + "addToGitignore": "Add to .gitignore", + "addToGitignoreDescription": "Automatically add the generated rule files to .gitignore to prevent them from being committed to version control", + "autoApproveProtected": "Auto-approve protected file writes", + "autoApproveProtectedDescription": "Allow Roo to make and write to .roo directory without requiring manual approval", + "selectApiConfig": "Select API configuration", + "includeCustomRules": "Include my own rules", + "includeCustomRulesDescription": "Add custom instructions to the rule generation prompt", + "customRulesPlaceholder": "Enter your custom rules or instructions here...", + "customRulesHint": "These will be included in the prompt when generating rules for your project", + "smallRepoWarning": "This repository contains only {{count}} files. With limited code examples, the generated rules may be overly specific to your current implementation. Consider regenerating rules as your project grows.", + "commandTitle": "Initialize rules using the chat command:", + "commandDescription": "Type this command in the chat to generate AI rules based on your selected preferences below." + }, "promptCaching": { "label": "Disable prompt caching", "description": "When checked, Roo will not use prompt caching for this model." diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index c4c7fb39c0..232a52ce5d 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -641,6 +641,53 @@ "description": "Cuando está habilitado, Roo puede crear y gestionar listas de tareas para hacer seguimiento del progreso. Esto ayuda a organizar tareas complejas en pasos manejables." } }, + "rules": { + "title": "Reglas", + "description": "¡Las reglas ayudan a los agentes de IA a entender las convenciones y mejores prácticas de tu proyecto!", + "magicGeneration": { + "title": "Generación mágica de reglas", + "description": "Analiza automáticamente tu base de código y genera reglas completas adaptadas a las necesidades específicas de tu proyecto." + }, + "generateButton": "Generar reglas", + "generateButtonTooltip": "Crear una nueva tarea para analizar la base de código y generar reglas automáticamente", + "selectTypes": "Selecciona los tipos de reglas a generar:", + "noRulesSelected": "Por favor selecciona al menos un tipo de regla para generar", + "unsavedChangesError": "Por favor guarda tu configuración antes de generar reglas", + "types": { + "general": { + "label": "Reglas generales", + "description": "Estándares de codificación generales aplicados a todos los modos" + }, + "code": { + "label": "Reglas del modo Código", + "description": "Reglas específicas para sintaxis de código, detalles de implementación y mejores prácticas" + }, + "architect": { + "label": "Reglas del modo Arquitecto", + "description": "Reglas para diseño de sistemas de alto nivel, organización de archivos y patrones de arquitectura" + }, + "debug": { + "label": "Reglas del modo Debug", + "description": "Reglas para flujos de trabajo de depuración, manejo de errores y enfoques de resolución de problemas" + }, + "docsExtractor": { + "label": "Reglas de documentación", + "description": "Reglas para extracción de documentación y estándares de formato" + } + }, + "fileExists": "El archivo existe", + "overwriteWarning": "Advertencia: Los siguientes archivos de reglas ya existen y serán sobrescritos:", + "addToGitignore": "Añadir a .gitignore", + "addToGitignoreDescription": "Añadir automáticamente los archivos de reglas generados a .gitignore para evitar que se confirmen en el control de versiones", + "autoApproveProtected": "Aprobar automáticamente escrituras de archivos protegidos", + "autoApproveProtectedDescription": "Permitir a Roo crear y escribir en el directorio .roo sin requerir aprobación manual", + "selectApiConfig": "Seleccionar configuración de API", + "includeCustomRules": "Incluir mis propias reglas", + "includeCustomRulesDescription": "Añadir instrucciones personalizadas al prompt de generación de reglas", + "customRulesPlaceholder": "Introduce tus reglas o instrucciones personalizadas aquí...", + "customRulesHint": "Estas se incluirán en el prompt al generar reglas para tu proyecto", + "smallRepoWarning": "Este repositorio contiene solo {{count}} archivos. Con ejemplos de código limitados, las reglas generadas pueden ser demasiado específicas para tu implementación actual. Considera regenerar reglas a medida que tu proyecto crezca." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Usar estrategia de diff unificada experimental", diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index e00b0c0559..a97bf4d727 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -641,6 +641,53 @@ "description": "Lorsqu'activé, Roo peut créer et gérer des listes de tâches pour suivre la progression. Cela aide à organiser les tâches complexes en étapes gérables." } }, + "rules": { + "title": "Règles", + "description": "Les règles aident les agents IA à comprendre les conventions et les meilleures pratiques de ton projet !", + "magicGeneration": { + "title": "Génération magique de règles", + "description": "Analyse automatiquement ta base de code et génère des règles complètes adaptées aux besoins spécifiques de ton projet." + }, + "generateButton": "Générer les règles", + "generateButtonTooltip": "Créer une nouvelle tâche pour analyser la base de code et générer automatiquement les règles", + "selectTypes": "Sélectionne les types de règles à générer :", + "noRulesSelected": "Veuillez sélectionner au moins un type de règle à générer", + "unsavedChangesError": "Veuillez enregistrer tes paramètres avant de générer les règles", + "types": { + "general": { + "label": "Règles générales", + "description": "Standards de codage généraux appliqués à tous les modes" + }, + "code": { + "label": "Règles du mode Code", + "description": "Règles spécifiques pour la syntaxe du code, les détails d'implémentation et les meilleures pratiques" + }, + "architect": { + "label": "Règles du mode Architecte", + "description": "Règles pour la conception de systèmes de haut niveau, l'organisation des fichiers et les modèles d'architecture" + }, + "debug": { + "label": "Règles du mode Debug", + "description": "Règles pour les flux de travail de débogage, la gestion des erreurs et les approches de dépannage" + }, + "docsExtractor": { + "label": "Règles de documentation", + "description": "Règles pour l'extraction de documentation et les standards de formatage" + } + }, + "fileExists": "Le fichier existe", + "overwriteWarning": "Attention : Les fichiers de règles suivants existent déjà et seront écrasés :", + "addToGitignore": "Ajouter à .gitignore", + "addToGitignoreDescription": "Ajouter automatiquement les fichiers de règles générés à .gitignore pour éviter qu'ils soient validés dans le contrôle de version", + "autoApproveProtected": "Approuver automatiquement les écritures de fichiers protégés", + "autoApproveProtectedDescription": "Permettre à Roo de créer et d'écrire dans le répertoire .roo sans nécessiter d'approbation manuelle", + "selectApiConfig": "Sélectionner la configuration API", + "includeCustomRules": "Inclure mes propres règles", + "includeCustomRulesDescription": "Ajouter des instructions personnalisées à l'invite de génération de règles", + "customRulesPlaceholder": "Saisis tes règles ou instructions personnalisées ici...", + "customRulesHint": "Celles-ci seront incluses dans l'invite lors de la génération de règles pour ton projet", + "smallRepoWarning": "Ce dépôt ne contient que {{count}} fichiers. Avec des exemples de code limités, les règles générées peuvent être trop spécifiques à ton implémentation actuelle. Considère régénérer les règles à mesure que ton projet grandit." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Utiliser la stratégie diff unifiée expérimentale", diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index 2497ffe6da..baacd0fcd9 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -642,6 +642,53 @@ "description": "जब सक्षम हो, तो Roo कार्य प्रगति को ट्रैक करने के लिए टूडू सूचियाँ बना और प्रबंधित कर सकता है। यह जटिल कार्यों को प्रबंधनीय चरणों में व्यवस्थित करने में मदद करता है।" } }, + "rules": { + "title": "नियम", + "description": "नियम AI एजेंट्स को तुम्हारे प्रोजेक्ट के कन्वेंशन्स और बेस्ट प्रैक्टिसेज समझने में मदद करते हैं!", + "magicGeneration": { + "title": "मैजिक रूल जेनेरेशन", + "description": "अपने कोडबेस का ऑटोमेटिक एनालिसिस करो और अपने प्रोजेक्ट की स्पेसिफिक जरूरतों के लिए कस्टमाइज़्ड कॉम्प्रिहेंसिव रूल्स जेनेरेट करो।" + }, + "generateButton": "रूल्स जेनेरेट करो", + "generateButtonTooltip": "कोडबेस एनालाइज़ करने और ऑटोमेटिकली रूल्स जेनेरेट करने के लिए नया टास्क बनाओ", + "selectTypes": "जेनेरेट करने के लिए रूल टाइप्स सेलेक्ट करो:", + "noRulesSelected": "कृपया जेनेरेट करने के लिए कम से कम एक रूल टाइप सेलेक्ट करो", + "unsavedChangesError": "कृपया रूल्स जेनेरेट करने से पहले अपनी सेटिंग्स सेव करो", + "types": { + "general": { + "label": "जेनेरल रूल्स", + "description": "सभी मोड्स पर लागू होने वाले जेनेरल कोडिंग स्टैंडर्ड्स" + }, + "code": { + "label": "कोड मोड रूल्स", + "description": "कोड सिंटैक्स, इम्प्लीमेंटेशन डिटेल्स और बेस्ट प्रैक्टिसेज के लिए स्पेसिफिक रूल्स" + }, + "architect": { + "label": "आर्किटेक्ट मोड रूल्स", + "description": "हाई-लेवल सिस्टम डिज़ाइन, फाइल ऑर्गनाइज़ेशन और आर्किटेक्चरल पैटर्न्स के लिए रूल्स" + }, + "debug": { + "label": "डिबग मोड रूल्स", + "description": "डिबगिंग वर्कफ़्लो, एरर हैंडलिंग और ट्रबलशूटिंग अप्रोचेज के लिए रूल्स" + }, + "docsExtractor": { + "label": "डॉक्यूमेंटेशन रूल्स", + "description": "डॉक्यूमेंटेशन एक्सट्रैक्शन और फॉर्मेटिंग स्टैंडर्ड्स के लिए रूल्स" + } + }, + "fileExists": "फाइल मौजूद है", + "overwriteWarning": "चेतावनी: निम्नलिखित रूल फाइलें पहले से मौजूद हैं और ओवरराइट हो जाएंगी:", + "addToGitignore": ".gitignore में ऐड करो", + "addToGitignoreDescription": "जेनेरेटेड रूल फाइलों को ऑटोमेटिकली .gitignore में ऐड करो ताकि वे वर्जन कंट्रोल में कमिट न हों", + "autoApproveProtected": "प्रोटेक्टेड फाइल राइटिंग को ऑटो अप्रूव करो", + "autoApproveProtectedDescription": "Roo को मैन्युअल अप्रूवल की जरूरत के बिना .roo डायरेक्टरी में क्रिएट और राइट करने की अनुमति दो", + "selectApiConfig": "API कॉन्फ़िगरेशन सेलेक्ट करो", + "includeCustomRules": "मेरे कस्टम रूल्स इंक्लूड करो", + "includeCustomRulesDescription": "रूल जेनेरेशन प्रॉम्प्ट में कस्टम इंस्ट्रक्शन्स ऐड करो", + "customRulesPlaceholder": "अपने कस्टम रूल्स या इंस्ट्रक्शन्स यहाँ एंटर करो...", + "customRulesHint": "ये तुम्हारे प्रोजेक्ट के लिए रूल्स जेनेरेट करते समय प्रॉम्प्ट में इंक्लूड होंगे", + "smallRepoWarning": "इस रिपॉज़िटरी में केवल {{count}} फाइलें हैं। लिमिटेड कोड एग्जाम्पल्स के साथ, जेनेरेटेड रूल्स तुम्हारे करंट इम्प्लीमेंटेशन के लिए बहुत स्पेसिफिक हो सकते हैं। अपने प्रोजेक्ट के बढ़ने पर रूल्स को रीजेनेरेट करने पर विचार करो।" + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "प्रायोगिक एकीकृत diff रणनीति का उपयोग करें", diff --git a/webview-ui/src/i18n/locales/id/settings.json b/webview-ui/src/i18n/locales/id/settings.json index 3665c99c1b..14ca952007 100644 --- a/webview-ui/src/i18n/locales/id/settings.json +++ b/webview-ui/src/i18n/locales/id/settings.json @@ -646,6 +646,53 @@ "description": "Saat diaktifkan, Roo dapat membuat dan mengelola daftar tugas untuk melacak kemajuan tugas. Ini membantu mengatur tugas kompleks menjadi langkah-langkah yang dapat dikelola." } }, + "rules": { + "title": "Aturan", + "description": "Aturan membantu agen AI memahami konvensi dan praktik terbaik proyek kamu!", + "magicGeneration": { + "title": "Generasi Aturan Ajaib", + "description": "Secara otomatis menganalisis codebase kamu dan menghasilkan aturan komprehensif yang disesuaikan dengan kebutuhan spesifik proyek." + }, + "generateButton": "Buat Aturan", + "generateButtonTooltip": "Buat tugas baru untuk menganalisis codebase dan secara otomatis menghasilkan aturan", + "selectTypes": "Pilih jenis aturan yang akan dibuat:", + "noRulesSelected": "Silakan pilih setidaknya satu jenis aturan untuk dibuat", + "unsavedChangesError": "Silakan simpan pengaturan kamu sebelum membuat aturan", + "types": { + "general": { + "label": "Aturan Umum", + "description": "Standar coding umum yang diterapkan ke semua mode" + }, + "code": { + "label": "Aturan Mode Code", + "description": "Aturan spesifik untuk sintaks kode, detail implementasi, dan praktik terbaik" + }, + "architect": { + "label": "Aturan Mode Architect", + "description": "Aturan untuk desain sistem tingkat tinggi, organisasi file, dan pola arsitektur" + }, + "debug": { + "label": "Aturan Mode Debug", + "description": "Aturan untuk alur kerja debugging, penanganan error, dan pendekatan troubleshooting" + }, + "docsExtractor": { + "label": "Aturan Dokumentasi", + "description": "Aturan untuk ekstraksi dokumentasi dan standar formatting" + } + }, + "fileExists": "File ada", + "overwriteWarning": "Peringatan: File aturan berikut sudah ada dan akan ditimpa:", + "addToGitignore": "Tambahkan ke .gitignore", + "addToGitignoreDescription": "Secara otomatis menambahkan file aturan yang dihasilkan ke .gitignore untuk mencegah mereka di-commit ke version control", + "autoApproveProtected": "Otomatis setujui penulisan file yang dilindungi", + "autoApproveProtectedDescription": "Izinkan Roo untuk membuat dan menulis ke direktori .roo tanpa memerlukan persetujuan manual", + "selectApiConfig": "Pilih Konfigurasi API", + "includeCustomRules": "Sertakan aturan kustom saya", + "includeCustomRulesDescription": "Tambahkan instruksi kustom ke prompt generasi aturan", + "customRulesPlaceholder": "Masukkan aturan atau instruksi kustom kamu di sini...", + "customRulesHint": "Ini akan disertakan dalam prompt saat menghasilkan aturan untuk proyek kamu", + "smallRepoWarning": "Repository ini hanya berisi {{count}} file. Dengan contoh kode yang terbatas, aturan yang dihasilkan mungkin terlalu spesifik untuk implementasi saat ini. Pertimbangkan untuk menghasilkan ulang aturan seiring berkembangnya proyek kamu." + }, "experimental": { "warning": "⚠️", "autoCondenseContextPercent": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 056b0f9124..df66398156 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -642,6 +642,53 @@ "description": "Quando abilitato, Roo può creare e gestire liste di cose da fare per tracciare il progresso delle attività. Questo aiuta a organizzare attività complesse in passaggi gestibili." } }, + "rules": { + "title": "Regole", + "description": "Le regole aiutano gli agenti IA a comprendere le convenzioni e le migliori pratiche del tuo progetto!", + "magicGeneration": { + "title": "Generazione magica delle regole", + "description": "Analizza automaticamente la tua base di codice e genera regole complete su misura per le esigenze specifiche del tuo progetto." + }, + "generateButton": "Genera regole", + "generateButtonTooltip": "Crea una nuova attività per analizzare la base di codice e generare automaticamente le regole", + "selectTypes": "Seleziona i tipi di regole da generare:", + "noRulesSelected": "Seleziona almeno un tipo di regola da generare", + "unsavedChangesError": "Salva le tue impostazioni prima di generare le regole", + "types": { + "general": { + "label": "Regole generali", + "description": "Standard di codifica generali applicati a tutte le modalità" + }, + "code": { + "label": "Regole modalità Codice", + "description": "Regole specifiche per sintassi del codice, dettagli di implementazione e migliori pratiche" + }, + "architect": { + "label": "Regole modalità Architetto", + "description": "Regole per progettazione di sistemi di alto livello, organizzazione dei file e pattern architetturali" + }, + "debug": { + "label": "Regole modalità Debug", + "description": "Regole per flussi di lavoro di debug, gestione degli errori e approcci di risoluzione dei problemi" + }, + "docsExtractor": { + "label": "Regole documentazione", + "description": "Regole per estrazione della documentazione e standard di formattazione" + } + }, + "fileExists": "Il file esiste", + "overwriteWarning": "Attenzione: I seguenti file di regole esistono già e verranno sovrascritti:", + "addToGitignore": "Aggiungi a .gitignore", + "addToGitignoreDescription": "Aggiungi automaticamente i file di regole generati a .gitignore per evitare che vengano committati nel controllo versione", + "autoApproveProtected": "Approva automaticamente scritture file protetti", + "autoApproveProtectedDescription": "Consenti a Roo di creare e scrivere nella directory .roo senza richiedere approvazione manuale", + "selectApiConfig": "Seleziona configurazione API", + "includeCustomRules": "Includi le mie regole", + "includeCustomRulesDescription": "Aggiungi istruzioni personalizzate al prompt di generazione regole", + "customRulesPlaceholder": "Inserisci qui le tue regole o istruzioni personalizzate...", + "customRulesHint": "Queste verranno incluse nel prompt durante la generazione di regole per il tuo progetto", + "smallRepoWarning": "Questo repository contiene solo {{count}} file. Con esempi di codice limitati, le regole generate potrebbero essere troppo specifiche per la tua implementazione attuale. Considera di rigenerare le regole man mano che il tuo progetto cresce." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Usa strategia diff unificata sperimentale", diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 3b38277b86..2e39a420b0 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -642,6 +642,53 @@ "description": "有効にすると、Rooはタスクの進捗を追跡するためのToDoリストを作成・管理できます。これにより、複雑なタスクを管理しやすいステップに整理できます。" } }, + "rules": { + "title": "ルール", + "description": "ルールはAIエージェントがあなたのプロジェクトの規約とベストプラクティスを理解するのに役立ちます!", + "magicGeneration": { + "title": "マジックルール生成", + "description": "コードベースを自動的に分析し、プロジェクトの特定のニーズに合わせた包括的なルールを生成します。" + }, + "generateButton": "ルールを生成", + "generateButtonTooltip": "コードベースを分析してルールを自動生成する新しいタスクを作成", + "selectTypes": "生成するルールタイプを選択:", + "noRulesSelected": "生成するルールタイプを少なくとも1つ選択してください", + "unsavedChangesError": "ルールを生成する前に設定を保存してください", + "types": { + "general": { + "label": "一般ルール", + "description": "すべてのモードに適用される一般的なコーディング標準" + }, + "code": { + "label": "コードモードルール", + "description": "コード構文、実装詳細、ベストプラクティスの具体的なルール" + }, + "architect": { + "label": "アーキテクトモードルール", + "description": "高レベルシステム設計、ファイル構成、アーキテクチャパターンのルール" + }, + "debug": { + "label": "デバッグモードルール", + "description": "デバッグワークフロー、エラー処理、トラブルシューティングアプローチのルール" + }, + "docsExtractor": { + "label": "ドキュメントルール", + "description": "ドキュメント抽出とフォーマット標準のルール" + } + }, + "fileExists": "ファイルが存在します", + "overwriteWarning": "警告:以下のルールファイルは既に存在し、上書きされます:", + "addToGitignore": ".gitignoreに追加", + "addToGitignoreDescription": "生成されたルールファイルを自動的に.gitignoreに追加して、バージョン管理にコミットされないようにします", + "autoApproveProtected": "保護されたファイル書き込みを自動承認", + "autoApproveProtectedDescription": "Rooが手動承認を必要とせずに.rooディレクトリを作成・書き込みできるようにします", + "selectApiConfig": "API設定を選択", + "includeCustomRules": "独自のルールを含める", + "includeCustomRulesDescription": "ルール生成プロンプトにカスタム指示を追加", + "customRulesPlaceholder": "ここにカスタムルールや指示を入力してください...", + "customRulesHint": "これらはプロジェクトのルールを生成する際にプロンプトに含まれます", + "smallRepoWarning": "このリポジトリには{{count}}個のファイルしか含まれていません。コード例が限られているため、生成されるルールは現在の実装に対して過度に特化している可能性があります。プロジェクトが成長するにつれてルールを再生成することを検討してください。" + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "実験的な統合diff戦略を使用する", diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 89739f4c4a..55bc169088 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -642,6 +642,53 @@ "description": "활성화하면 Roo가 작업 진행 상황을 추적하기 위한 할 일 목록을 만들고 관리할 수 있습니다. 이는 복잡한 작업을 관리 가능한 단계로 구성하는 데 도움이 됩니다." } }, + "rules": { + "title": "규칙", + "description": "규칙은 AI 에이전트가 당신의 프로젝트 관례와 모범 사례를 이해하는 데 도움이 됩니다!", + "magicGeneration": { + "title": "마법 규칙 생성", + "description": "코드베이스를 자동으로 분석하고 프로젝트의 특정 요구사항에 맞춘 포괄적인 규칙을 생성합니다." + }, + "generateButton": "규칙 생성", + "generateButtonTooltip": "코드베이스를 분석하고 자동으로 규칙을 생성하는 새 작업 생성", + "selectTypes": "생성할 규칙 유형 선택:", + "noRulesSelected": "생성할 규칙 유형을 최소 하나 선택해주세요", + "unsavedChangesError": "규칙을 생성하기 전에 설정을 저장해주세요", + "types": { + "general": { + "label": "일반 규칙", + "description": "모든 모드에 적용되는 일반적인 코딩 표준" + }, + "code": { + "label": "코드 모드 규칙", + "description": "코드 구문, 구현 세부사항 및 모범 사례에 대한 구체적인 규칙" + }, + "architect": { + "label": "아키텍트 모드 규칙", + "description": "고수준 시스템 설계, 파일 구성 및 아키텍처 패턴에 대한 규칙" + }, + "debug": { + "label": "디버그 모드 규칙", + "description": "디버깅 워크플로우, 오류 처리 및 문제 해결 접근법에 대한 규칙" + }, + "docsExtractor": { + "label": "문서 규칙", + "description": "문서 추출 및 형식 표준에 대한 규칙" + } + }, + "fileExists": "파일이 존재합니다", + "overwriteWarning": "경고: 다음 규칙 파일들이 이미 존재하며 덮어쓰여집니다:", + "addToGitignore": ".gitignore에 추가", + "addToGitignoreDescription": "생성된 규칙 파일을 자동으로 .gitignore에 추가하여 버전 관리에 커밋되지 않도록 합니다", + "autoApproveProtected": "보호된 파일 쓰기 자동 승인", + "autoApproveProtectedDescription": "Roo가 수동 승인 없이 .roo 디렉토리를 생성하고 쓸 수 있도록 허용", + "selectApiConfig": "API 구성 선택", + "includeCustomRules": "내 규칙 포함", + "includeCustomRulesDescription": "규칙 생성 프롬프트에 사용자 정의 지침 추가", + "customRulesPlaceholder": "여기에 사용자 정의 규칙이나 지침을 입력하세요...", + "customRulesHint": "이것들은 프로젝트에 대한 규칙을 생성할 때 프롬프트에 포함됩니다", + "smallRepoWarning": "이 저장소는 {{count}}개의 파일만 포함하고 있습니다. 제한된 코드 예제로 인해 생성된 규칙이 현재 구현에 지나치게 특화될 수 있습니다. 프로젝트가 성장함에 따라 규칙을 재생성하는 것을 고려해보세요." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "실험적 통합 diff 전략 사용", diff --git a/webview-ui/src/i18n/locales/nl/settings.json b/webview-ui/src/i18n/locales/nl/settings.json index 7d8721ffd8..9815390ecb 100644 --- a/webview-ui/src/i18n/locales/nl/settings.json +++ b/webview-ui/src/i18n/locales/nl/settings.json @@ -642,6 +642,53 @@ "description": "Wanneer ingeschakeld, kan Roo takenlijsten maken en beheren om de voortgang van taken bij te houden. Dit helpt complexe taken te organiseren in beheersbare stappen." } }, + "rules": { + "title": "Regels", + "description": "Regels helpen AI-agenten de conventies en best practices van je project te begrijpen!", + "magicGeneration": { + "title": "Magische regelgeneratie", + "description": "Analyseer automatisch je codebase en genereer uitgebreide regels die zijn afgestemd op de specifieke behoeften van je project." + }, + "generateButton": "Regels genereren", + "generateButtonTooltip": "Maak een nieuwe taak om de codebase te analyseren en automatisch regels te genereren", + "selectTypes": "Selecteer regeltypen om te genereren:", + "noRulesSelected": "Selecteer alsjeblieft minstens één regeltype om te genereren", + "unsavedChangesError": "Sla je instellingen op voordat je regels genereert", + "types": { + "general": { + "label": "Algemene regels", + "description": "Algemene codeerstandaarden toegepast op alle modi" + }, + "code": { + "label": "Code modus regels", + "description": "Specifieke regels voor codesyntax, implementatiedetails en best practices" + }, + "architect": { + "label": "Architect modus regels", + "description": "Regels voor high-level systeemontwerp, bestandsorganisatie en architecturale patronen" + }, + "debug": { + "label": "Debug modus regels", + "description": "Regels voor debugging workflows, foutafhandeling en troubleshooting benaderingen" + }, + "docsExtractor": { + "label": "Documentatieregels", + "description": "Regels voor documentatie-extractie en opmaakstandaarden" + } + }, + "fileExists": "Bestand bestaat", + "overwriteWarning": "Waarschuwing: De volgende regelbestanden bestaan al en worden overschreven:", + "addToGitignore": "Toevoegen aan .gitignore", + "addToGitignoreDescription": "Voeg gegenereerde regelbestanden automatisch toe aan .gitignore om te voorkomen dat ze worden gecommit naar versiebeheer", + "autoApproveProtected": "Automatisch goedkeuren van schrijven naar beschermde bestanden", + "autoApproveProtectedDescription": "Sta Roo toe om te maken en schrijven naar de .roo directory zonder handmatige goedkeuring te vereisen", + "selectApiConfig": "Selecteer API-configuratie", + "includeCustomRules": "Mijn aangepaste regels opnemen", + "includeCustomRulesDescription": "Voeg aangepaste instructies toe aan de regelgeneratie prompt", + "customRulesPlaceholder": "Voer hier je aangepaste regels of instructies in...", + "customRulesHint": "Deze worden opgenomen in de prompt bij het genereren van regels voor je project", + "smallRepoWarning": "Deze repository bevat slechts {{count}} bestanden. Met beperkte codevoorbeelden kunnen de gegenereerde regels te specifiek zijn voor je huidige implementatie. Overweeg om regels opnieuw te genereren naarmate je project groeit." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Experimentele unified diff-strategie gebruiken", diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 5a23d2137d..457dda7d84 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -642,6 +642,53 @@ "description": "Po włączeniu Roo może tworzyć i zarządzać listami zadań do śledzenia postępu zadań. Pomaga to organizować złożone zadania w łatwe do zarządzania kroki." } }, + "rules": { + "title": "Zasady", + "description": "Zasady pomagają agentom AI zrozumieć konwencje i najlepsze praktyki twojego projektu!", + "magicGeneration": { + "title": "Magiczne generowanie zasad", + "description": "Automatycznie analizuj swoją bazę kodu i generuj kompleksowe zasady dostosowane do specyficznych potrzeb twojego projektu." + }, + "generateButton": "Generuj zasady", + "generateButtonTooltip": "Utwórz nowe zadanie do analizy bazy kodu i automatycznego generowania zasad", + "selectTypes": "Wybierz typy zasad do wygenerowania:", + "noRulesSelected": "Proszę wybrać co najmniej jeden typ zasad do wygenerowania", + "unsavedChangesError": "Proszę zapisać swoje ustawienia przed generowaniem zasad", + "types": { + "general": { + "label": "Zasady ogólne", + "description": "Ogólne standardy kodowania stosowane do wszystkich trybów" + }, + "code": { + "label": "Zasady trybu Code", + "description": "Specyficzne zasady dla składni kodu, szczegółów implementacji i najlepszych praktyk" + }, + "architect": { + "label": "Zasady trybu Architect", + "description": "Zasady dla projektowania systemów wysokiego poziomu, organizacji plików i wzorców architektonicznych" + }, + "debug": { + "label": "Zasady trybu Debug", + "description": "Zasady dla przepływów pracy debugowania, obsługi błędów i podejść do rozwiązywania problemów" + }, + "docsExtractor": { + "label": "Zasady dokumentacji", + "description": "Zasady dla ekstrakcji dokumentacji i standardów formatowania" + } + }, + "fileExists": "Plik istnieje", + "overwriteWarning": "Ostrzeżenie: Następujące pliki zasad już istnieją i zostaną nadpisane:", + "addToGitignore": "Dodaj do .gitignore", + "addToGitignoreDescription": "Automatycznie dodaj wygenerowane pliki zasad do .gitignore, aby zapobiec ich commitowaniu do kontroli wersji", + "autoApproveProtected": "Automatycznie zatwierdź pisanie chronionych plików", + "autoApproveProtectedDescription": "Pozwól Roo na tworzenie i pisanie do katalogu .roo bez wymagania ręcznego zatwierdzenia", + "selectApiConfig": "Wybierz konfigurację API", + "includeCustomRules": "Uwzględnij moje niestandardowe zasady", + "includeCustomRulesDescription": "Dodaj niestandardowe instrukcje do promptu generowania zasad", + "customRulesPlaceholder": "Wprowadź tutaj swoje niestandardowe zasady lub instrukcje...", + "customRulesHint": "Zostaną one uwzględnione w prompcie podczas generowania zasad dla twojego projektu", + "smallRepoWarning": "To repozytorium zawiera tylko {{count}} plików. Z ograniczonymi przykładami kodu, wygenerowane zasady mogą być zbyt specyficzne dla twojej obecnej implementacji. Rozważ ponowne generowanie zasad w miarę rozwoju twojego projektu." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Użyj eksperymentalnej ujednoliconej strategii diff", diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index 2e39982d27..2e6473ebcb 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -642,6 +642,53 @@ "description": "Quando habilitado, o Roo pode criar e gerenciar listas de tarefas para acompanhar o progresso das tarefas. Isso ajuda a organizar tarefas complexas em etapas gerenciáveis." } }, + "rules": { + "title": "Regras", + "description": "As regras ajudam os agentes de IA a entender as convenções e melhores práticas do seu projeto!", + "magicGeneration": { + "title": "Geração mágica de regras", + "description": "Analise automaticamente sua base de código e gere regras abrangentes adaptadas às necessidades específicas do seu projeto." + }, + "generateButton": "Gerar regras", + "generateButtonTooltip": "Criar uma nova tarefa para analisar a base de código e gerar regras automaticamente", + "selectTypes": "Selecione os tipos de regras para gerar:", + "noRulesSelected": "Por favor, selecione pelo menos um tipo de regra para gerar", + "unsavedChangesError": "Por favor, salve suas configurações antes de gerar regras", + "types": { + "general": { + "label": "Regras gerais", + "description": "Padrões de codificação gerais aplicados a todos os modos" + }, + "code": { + "label": "Regras do modo Código", + "description": "Regras específicas para sintaxe de código, detalhes de implementação e melhores práticas" + }, + "architect": { + "label": "Regras do modo Arquiteto", + "description": "Regras para design de sistemas de alto nível, organização de arquivos e padrões de arquitetura" + }, + "debug": { + "label": "Regras do modo Debug", + "description": "Regras para fluxos de trabalho de depuração, tratamento de erros e abordagens de solução de problemas" + }, + "docsExtractor": { + "label": "Regras de documentação", + "description": "Regras para extração de documentação e padrões de formatação" + } + }, + "fileExists": "O arquivo existe", + "overwriteWarning": "Aviso: Os seguintes arquivos de regras já existem e serão sobrescritos:", + "addToGitignore": "Adicionar ao .gitignore", + "addToGitignoreDescription": "Adicionar automaticamente os arquivos de regras gerados ao .gitignore para evitar que sejam commitados no controle de versão", + "autoApproveProtected": "Aprovar automaticamente gravações de arquivos protegidos", + "autoApproveProtectedDescription": "Permitir que o Roo crie e grave no diretório .roo sem exigir aprovação manual", + "selectApiConfig": "Selecionar configuração da API", + "includeCustomRules": "Incluir minhas próprias regras", + "includeCustomRulesDescription": "Adicionar instruções personalizadas ao prompt de geração de regras", + "customRulesPlaceholder": "Digite suas regras ou instruções personalizadas aqui...", + "customRulesHint": "Estas serão incluídas no prompt ao gerar regras para seu projeto", + "smallRepoWarning": "Este repositório contém apenas {{count}} arquivos. Com exemplos de código limitados, as regras geradas podem ser muito específicas para sua implementação atual. Considere regenerar regras conforme seu projeto cresce." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Usar estratégia diff unificada experimental", diff --git a/webview-ui/src/i18n/locales/ru/settings.json b/webview-ui/src/i18n/locales/ru/settings.json index 76c3877e10..e847c1a817 100644 --- a/webview-ui/src/i18n/locales/ru/settings.json +++ b/webview-ui/src/i18n/locales/ru/settings.json @@ -642,6 +642,53 @@ "description": "При включении Roo может создавать и управлять списками задач для отслеживания прогресса. Это помогает организовать сложные задачи в управляемые шаги." } }, + "rules": { + "title": "Правила", + "description": "Правила помогают ИИ-агентам понимать соглашения и лучшие практики твоего проекта!", + "magicGeneration": { + "title": "Магическая генерация правил", + "description": "Автоматически анализируй твою кодовую базу и генерируй комплексные правила, адаптированные к специфическим потребностям твоего проекта." + }, + "generateButton": "Генерировать правила", + "generateButtonTooltip": "Создать новую задачу для анализа кодовой базы и автоматической генерации правил", + "selectTypes": "Выбери типы правил для генерации:", + "noRulesSelected": "Пожалуйста, выбери хотя бы один тип правил для генерации", + "unsavedChangesError": "Пожалуйста, сохрани свои настройки перед генерацией правил", + "types": { + "general": { + "label": "Общие правила", + "description": "Общие стандарты кодирования, применяемые ко всем режимам" + }, + "code": { + "label": "Правила режима Код", + "description": "Специфические правила для синтаксиса кода, деталей реализации и лучших практик" + }, + "architect": { + "label": "Правила режима Архитектор", + "description": "Правила для высокоуровневого проектирования систем, организации файлов и архитектурных паттернов" + }, + "debug": { + "label": "Правила режима Отладка", + "description": "Правила для рабочих процессов отладки, обработки ошибок и подходов к устранению неполадок" + }, + "docsExtractor": { + "label": "Правила документации", + "description": "Правила для извлечения документации и стандартов форматирования" + } + }, + "fileExists": "Файл существует", + "overwriteWarning": "Предупреждение: Следующие файлы правил уже существуют и будут перезаписаны:", + "addToGitignore": "Добавить в .gitignore", + "addToGitignoreDescription": "Автоматически добавить сгенерированные файлы правил в .gitignore, чтобы предотвратить их коммит в систему контроля версий", + "autoApproveProtected": "Автоматически одобрять запись защищённых файлов", + "autoApproveProtectedDescription": "Разрешить Roo создавать и записывать в директорию .roo без требования ручного одобрения", + "selectApiConfig": "Выбрать конфигурацию API", + "includeCustomRules": "Включить мои собственные правила", + "includeCustomRulesDescription": "Добавить пользовательские инструкции в промпт генерации правил", + "customRulesPlaceholder": "Введи свои пользовательские правила или инструкции здесь...", + "customRulesHint": "Они будут включены в промпт при генерации правил для твоего проекта", + "smallRepoWarning": "Этот репозиторий содержит только {{count}} файлов. С ограниченными примерами кода сгенерированные правила могут быть слишком специфичными для твоей текущей реализации. Рассмотри возможность перегенерации правил по мере роста твоего проекта." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Использовать экспериментальную стратегию унифицированного диффа", diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 26a295ffae..3dfa94128a 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -642,6 +642,53 @@ "description": "Etkinleştirildiğinde, Roo görev ilerlemesini takip etmek için yapılacaklar listeleri oluşturabilir ve yönetebilir. Bu, karmaşık görevleri yönetilebilir adımlara organize etmeye yardımcı olur." } }, + "rules": { + "title": "Kurallar", + "description": "Kurallar, AI ajanlarının projenin konvansiyonlarını ve en iyi uygulamalarını anlamasına yardımcı olur!", + "magicGeneration": { + "title": "Sihirli Kural Üretimi", + "description": "Kod tabanını otomatik olarak analiz et ve projenin özel ihtiyaçlarına göre uyarlanmış kapsamlı kurallar üret." + }, + "generateButton": "Kuralları Üret", + "generateButtonTooltip": "Kod tabanını analiz etmek ve otomatik olarak kurallar üretmek için yeni bir görev oluştur", + "selectTypes": "Üretilecek kural türlerini seç:", + "noRulesSelected": "Lütfen üretim için en az bir kural türü seç", + "unsavedChangesError": "Lütfen kuralları üretmeden önce ayarlarını kaydet", + "types": { + "general": { + "label": "Genel Kurallar", + "description": "Tüm modlara uygulanan genel kodlama standartları" + }, + "code": { + "label": "Kod Modu Kuralları", + "description": "Kod sözdizimi, uygulama detayları ve en iyi uygulamalar için özel kurallar" + }, + "architect": { + "label": "Mimar Modu Kuralları", + "description": "Üst düzey sistem tasarımı, dosya organizasyonu ve mimari desenler için kurallar" + }, + "debug": { + "label": "Hata Ayıklama Modu Kuralları", + "description": "Hata ayıklama iş akışları, hata işleme ve sorun giderme yaklaşımları için kurallar" + }, + "docsExtractor": { + "label": "Dokümantasyon Kuralları", + "description": "Dokümantasyon çıkarma ve biçimlendirme standartları için kurallar" + } + }, + "fileExists": "Dosya mevcut", + "overwriteWarning": "Uyarı: Aşağıdaki kural dosyaları zaten mevcut ve üzerine yazılacak:", + "addToGitignore": ".gitignore'a ekle", + "addToGitignoreDescription": "Üretilen kural dosyalarını otomatik olarak .gitignore'a ekleyerek sürüm kontrolüne commit edilmesini önle", + "autoApproveProtected": "Korumalı dosya yazımını otomatik onayla", + "autoApproveProtectedDescription": "Roo'nun manuel onay gerektirmeden .roo dizininde oluşturma ve yazma yapmasına izin ver", + "selectApiConfig": "API Yapılandırması Seç", + "includeCustomRules": "Kendi kurallarımı dahil et", + "includeCustomRulesDescription": "Kural üretimi promptuna özel talimatlar ekle", + "customRulesPlaceholder": "Özel kurallarını veya talimatlarını buraya gir...", + "customRulesHint": "Bunlar projen için kurallar üretilirken prompta dahil edilecek", + "smallRepoWarning": "Bu depo sadece {{count}} dosya içeriyor. Sınırlı kod örnekleriyle, üretilen kurallar mevcut uygulamana çok özgü olabilir. Projen büyüdükçe kuralları yeniden üretmeyi düşün." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Deneysel birleştirilmiş diff stratejisini kullan", diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 48f63bdf42..b25142db5c 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -642,6 +642,53 @@ "description": "Khi được bật, Roo có thể tạo và quản lý danh sách việc cần làm để theo dõi tiến độ công việc. Điều này giúp tổ chức các tác vụ phức tạp thành các bước có thể quản lý được." } }, + "rules": { + "title": "Quy tắc", + "description": "Quy tắc giúp các AI agent hiểu các quy ước và thực hành tốt nhất của dự án bạn!", + "magicGeneration": { + "title": "Tạo quy tắc tự động", + "description": "Tự động phân tích codebase của bạn và tạo ra các quy tắc toàn diện được điều chỉnh theo nhu cầu cụ thể của dự án." + }, + "generateButton": "Tạo quy tắc", + "generateButtonTooltip": "Tạo một tác vụ mới để phân tích codebase và tự động tạo quy tắc", + "selectTypes": "Chọn các loại quy tắc để tạo:", + "noRulesSelected": "Vui lòng chọn ít nhất một loại quy tắc để tạo", + "unsavedChangesError": "Vui lòng lưu cài đặt của bạn trước khi tạo quy tắc", + "types": { + "general": { + "label": "Quy tắc chung", + "description": "Tiêu chuẩn mã hóa chung áp dụng cho tất cả các chế độ" + }, + "code": { + "label": "Quy tắc chế độ Code", + "description": "Quy tắc cụ thể cho cú pháp mã, chi tiết triển khai và thực hành tốt nhất" + }, + "architect": { + "label": "Quy tắc chế độ Architect", + "description": "Quy tắc cho thiết kế hệ thống cấp cao, tổ chức tệp và mẫu kiến trúc" + }, + "debug": { + "label": "Quy tắc chế độ Debug", + "description": "Quy tắc cho quy trình gỡ lỗi, xử lý lỗi và phương pháp khắc phục sự cố" + }, + "docsExtractor": { + "label": "Quy tắc tài liệu", + "description": "Quy tắc cho việc trích xuất tài liệu và tiêu chuẩn định dạng" + } + }, + "fileExists": "Tệp tồn tại", + "overwriteWarning": "Cảnh báo: Các tệp quy tắc sau đã tồn tại và sẽ bị ghi đè:", + "addToGitignore": "Thêm vào .gitignore", + "addToGitignoreDescription": "Tự động thêm các tệp quy tắc được tạo vào .gitignore để ngăn chúng được commit vào kiểm soát phiên bản", + "autoApproveProtected": "Tự động phê duyệt ghi tệp được bảo vệ", + "autoApproveProtectedDescription": "Cho phép Roo tạo và ghi vào thư mục .roo mà không cần phê duyệt thủ công", + "selectApiConfig": "Chọn cấu hình API", + "includeCustomRules": "Bao gồm quy tắc tùy chỉnh của tôi", + "includeCustomRulesDescription": "Thêm hướng dẫn tùy chỉnh vào prompt tạo quy tắc", + "customRulesPlaceholder": "Nhập quy tắc hoặc hướng dẫn tùy chỉnh của bạn ở đây...", + "customRulesHint": "Chúng sẽ được bao gồm trong prompt khi tạo quy tắc cho dự án của bạn", + "smallRepoWarning": "Kho lưu trữ này chỉ chứa {{count}} tệp. Với các ví dụ mã hạn chế, các quy tắc được tạo có thể quá cụ thể cho triển khai hiện tại của bạn. Hãy xem xét tạo lại quy tắc khi dự án của bạn phát triển." + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "Sử dụng chiến lược diff thống nhất thử nghiệm", diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index 6d46e337c5..3c64a33d9d 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -642,6 +642,53 @@ "description": "启用后,Roo 可以创建和管理任务清单来跟踪任务进度。这有助于将复杂任务组织成可管理的步骤。" } }, + "rules": { + "title": "规则", + "description": "规则帮助 AI 代理理解你项目的约定和最佳实践!", + "magicGeneration": { + "title": "智能规则生成", + "description": "自动分析你的代码库并生成针对项目特定需求的综合规则。" + }, + "generateButton": "生成规则", + "generateButtonTooltip": "创建新任务来分析代码库并自动生成规则", + "selectTypes": "选择要生成的规则类型:", + "noRulesSelected": "请至少选择一种规则类型来生成", + "unsavedChangesError": "生成规则前请先保存设置", + "types": { + "general": { + "label": "通用规则", + "description": "适用于所有模式的通用编码标准" + }, + "code": { + "label": "代码模式规则", + "description": "针对代码语法、实现细节和最佳实践的具体规则" + }, + "architect": { + "label": "架构师模式规则", + "description": "用于高级系统设计、文件组织和架构模式的规则" + }, + "debug": { + "label": "调试模式规则", + "description": "用于调试工作流、错误处理和故障排除方法的规则" + }, + "docsExtractor": { + "label": "文档规则", + "description": "用于文档提取和格式化标准的规则" + } + }, + "fileExists": "文件已存在", + "overwriteWarning": "警告:以下规则文件已存在,将被覆盖:", + "addToGitignore": "添加到 .gitignore", + "addToGitignoreDescription": "自动将生成的规则文件添加到 .gitignore 以防止提交到版本控制", + "autoApproveProtected": "自动批准受保护文件写入", + "autoApproveProtectedDescription": "允许 Roo 创建和写入 .roo 目录而无需手动批准", + "selectApiConfig": "选择 API 配置", + "includeCustomRules": "包含我的自定义规则", + "includeCustomRulesDescription": "向规则生成提示添加自定义指令", + "customRulesPlaceholder": "在此输入你的自定义规则或指令...", + "customRulesHint": "这些将在为你的项目生成规则时包含在提示中", + "smallRepoWarning": "此仓库仅包含 {{count}} 个文件。由于代码示例有限,生成的规则可能过于针对你当前的实现。建议随着项目增长重新生成规则。" + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "启用diff更新工具", diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index ffd852397f..5067968297 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -642,6 +642,53 @@ "description": "啟用後,Roo 可以建立和管理待辦事項清單來追蹤任務進度。這有助於將複雜任務組織成可管理的步驟。" } }, + "rules": { + "title": "規則", + "description": "規則幫助 AI 代理理解你專案的慣例和最佳實務!", + "magicGeneration": { + "title": "智慧規則產生", + "description": "自動分析你的程式碼庫並產生針對專案特定需求的綜合規則。" + }, + "generateButton": "產生規則", + "generateButtonTooltip": "建立新工作來分析程式碼庫並自動產生規則", + "selectTypes": "選擇要產生的規則類型:", + "noRulesSelected": "請至少選擇一種規則類型來產生", + "unsavedChangesError": "產生規則前請先儲存設定", + "types": { + "general": { + "label": "通用規則", + "description": "適用於所有模式的通用程式設計標準" + }, + "code": { + "label": "程式碼模式規則", + "description": "針對程式碼語法、實作細節和最佳實務的具體規則" + }, + "architect": { + "label": "架構師模式規則", + "description": "用於高階系統設計、檔案組織和架構模式的規則" + }, + "debug": { + "label": "除錯模式規則", + "description": "用於除錯工作流程、錯誤處理和故障排除方法的規則" + }, + "docsExtractor": { + "label": "文件規則", + "description": "用於文件擷取和格式化標準的規則" + } + }, + "fileExists": "檔案已存在", + "overwriteWarning": "警告:以下規則檔案已存在,將被覆寫:", + "addToGitignore": "新增到 .gitignore", + "addToGitignoreDescription": "自動將產生的規則檔案新增到 .gitignore 以防止提交到版本控制", + "autoApproveProtected": "自動核准受保護檔案寫入", + "autoApproveProtectedDescription": "允許 Roo 建立和寫入 .roo 目錄而無需手動核准", + "selectApiConfig": "選擇 API 設定", + "includeCustomRules": "包含我的自訂規則", + "includeCustomRulesDescription": "向規則產生提示新增自訂指令", + "customRulesPlaceholder": "在此輸入你的自訂規則或指令...", + "customRulesHint": "這些將在為你的專案產生規則時包含在提示中", + "smallRepoWarning": "此儲存庫僅包含 {{count}} 個檔案。由於程式碼範例有限,產生的規則可能過於針對你目前的實作。建議隨著專案成長重新產生規則。" + }, "experimental": { "DIFF_STRATEGY_UNIFIED": { "name": "使用實驗性統一差異比對策略", diff --git a/webview-ui/src/utils/context-mentions.ts b/webview-ui/src/utils/context-mentions.ts index 217373c21b..265f6d4216 100644 --- a/webview-ui/src/utils/context-mentions.ts +++ b/webview-ui/src/utils/context-mentions.ts @@ -107,6 +107,7 @@ export enum ContextMenuOptionType { Git = "git", NoResults = "noResults", Mode = "mode", // Add mode type + Rules = "rules", // Add rules type Command = "command", // Add command type SectionHeader = "sectionHeader", // Add section header type } @@ -136,7 +137,24 @@ export function getContextMenuOptions( const slashQuery = query.slice(1) const results: ContextMenuQueryItem[] = [] - // Add command suggestions first (prioritize commands at the top) + // Check if it's the make-rules command + const lowerSlashQuery = slashQuery.toLowerCase() + if (lowerSlashQuery === "" || "make-rules".startsWith(lowerSlashQuery)) { + const rulesCommand: ContextMenuQueryItem = { + type: ContextMenuOptionType.Rules, + value: "make-rules", + label: "Make Rules", + description: "Generate AI rules for your project", + icon: "$(book)", + } + + // Add rules command if it matches + if (lowerSlashQuery === "" || "make-rules".startsWith(lowerSlashQuery)) { + results.push(rulesCommand) + } + } + + // Add command suggestions (prioritize commands at the top) if (commands?.length) { // Create searchable strings array for fzf const searchableCommands = commands.map((command) => ({