svn_commit
Commit changes to an SVN repository with customizable options for message, files, locks, and force operations.
Instructions
Confirmar cambios al repositorio
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Mensaje del commit | |
| paths | No | Archivos específicos a confirmar | |
| file | No | Archivo con mensaje de commit | |
| force | No | Forzar commit | |
| keepLocks | No | Mantener locks después del commit | |
| noUnlock | No | No desbloquear archivos |
Implementation Reference
- tools/svn-service.ts:488-547 (handler)The core handler function that implements the svn_commit tool logic by constructing and executing the 'svn commit' command with options and paths./** * Confirmar cambios al repositorio */ async commit( options: SvnCommitOptions, paths?: string[] ): Promise<SvnResponse<string>> { try { if (!options.message && !options.file) { throw new SvnError('Commit message is required'); } const args = ['commit']; if (options.message) { args.push('--message', options.message); } if (options.file) { args.push('--file', normalizePath(options.file)); } if (options.force) { args.push('--force'); } if (options.keepLocks) { args.push('--keep-locks'); } if (options.noUnlock) { args.push('--no-unlock'); } // Añadir rutas específicas si se proporcionan if (paths && paths.length > 0) { for (const path of paths) { if (!validatePath(path)) { throw new SvnError(`Invalid path: ${path}`); } } args.push(...paths.map(p => normalizePath(p))); } else if (options.targets) { args.push(...options.targets.map(p => normalizePath(p))); } const response = await executeSvnCommand(this.config, args); return { success: true, data: cleanOutput(response.data as string), command: response.command, workingDirectory: response.workingDirectory, executionTime: response.executionTime }; } catch (error: any) { throw new SvnError(`Failed to commit: ${error.message}`); } }
- common/types.ts:164-171 (schema)TypeScript interface defining the input options for the svn_commit tool, used by the handler.export interface SvnCommitOptions { message: string; file?: string; force?: boolean; keepLocks?: boolean; noUnlock?: boolean; targets?: string[]; }
- index.ts:402-442 (registration)MCP server.tool registration for 'svn_commit', including Zod input schema and handler wrapper that delegates to SvnService.commit.// 9. Commit de cambios server.tool( "svn_commit", "Confirmar cambios al repositorio", { message: z.string().describe("Mensaje del commit"), paths: z.array(z.string()).optional().describe("Archivos específicos a confirmar"), file: z.string().optional().describe("Archivo con mensaje de commit"), force: z.boolean().optional().default(false).describe("Forzar commit"), keepLocks: z.boolean().optional().default(false).describe("Mantener locks después del commit"), noUnlock: z.boolean().optional().default(false).describe("No desbloquear archivos") }, async (args) => { try { const options = { message: args.message, file: args.file, force: args.force, keepLocks: args.keepLocks, noUnlock: args.noUnlock }; const result = await getSvnService().commit(options, args.paths); const commitText = `✅ **Commit Realizado**\n\n` + `**Mensaje:** ${args.message}\n` + `**Archivos:** ${args.paths?.join(', ') || 'Todos los cambios'}\n` + `**Comando:** ${result.command}\n` + `**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}\n\n` + `**Resultado:**\n\`\`\`\n${result.data}\n\`\`\``; return { content: [{ type: "text", text: commitText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );