svn_commit
Commit changes to a Subversion (SVN) repository by specifying files, adding a message, and managing locks. Streamline repository updates with structured inputs for efficient version control.
Instructions
Confirmar cambios al repositorio
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Archivo con mensaje de commit | |
| force | No | Forzar commit | |
| keepLocks | No | Mantener locks después del commit | |
| message | Yes | Mensaje del commit | |
| noUnlock | No | No desbloquear archivos | |
| paths | No | Archivos específicos a confirmar |
Implementation Reference
- tools/svn-service.ts:491-547 (handler)Core handler implementing the svn commit logic: validates options, builds svn command arguments, executes via executeSvnCommand, and returns formatted response.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}`); } }
- index.ts:403-442 (registration)MCP server.tool registration for 'svn_commit', including Zod input schema validation and thin async handler that formats response after delegating to SvnService.commit.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}` }], }; } } );
- common/types.ts:164-171 (schema)TypeScript interface SvnCommitOptions defining the structure for commit options, used in the handler signature.export interface SvnCommitOptions { message: string; file?: string; force?: boolean; keepLocks?: boolean; noUnlock?: boolean; targets?: string[]; }