svn_add
Add files or directories to version control, optionally forcing addition, ignoring exclusion rules, creating parent directories, or applying auto-properties, using the SVN MCP Server.
Instructions
Añadir archivos al control de versiones
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| autoProps | No | Aplicar auto-propiedades | |
| force | No | Forzar adición | |
| noAutoProps | No | No aplicar auto-propiedades | |
| noIgnore | No | No respetar reglas de ignore | |
| parents | No | Crear directorios padre si es necesario | |
| paths | Yes | Archivo(s) o directorio(s) a añadir |
Implementation Reference
- tools/svn-service.ts:434-486 (handler)The core handler function `add` in SvnService class that builds the `svn add` command arguments based on options, validates paths, executes the command via `executeSvnCommand`, and returns the result.async add( paths: string | string[], options: SvnAddOptions = {} ): Promise<SvnResponse<string>> { try { const pathArray = Array.isArray(paths) ? paths : [paths]; // Validar todas las rutas for (const path of pathArray) { if (!validatePath(path)) { throw new SvnError(`Invalid path: ${path}`); } } const args = ['add']; if (options.force) { args.push('--force'); } if (options.noIgnore) { args.push('--no-ignore'); } if (options.autoProps) { args.push('--auto-props'); } if (options.noAutoProps) { args.push('--no-auto-props'); } if (options.parents) { args.push('--parents'); } // Añadir rutas normalizadas args.push(...pathArray.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 add files: ${error.message}`); } }
- common/types.ts:156-162 (schema)TypeScript interface defining the input options for the svn_add tool, used by the handler.export interface SvnAddOptions { force?: boolean; noIgnore?: boolean; autoProps?: boolean; noAutoProps?: boolean; parents?: boolean; }
- index.ts:361-400 (registration)MCP server tool registration for 'svn_add', including Zod input schema validation and thin wrapper handler that delegates to SvnService.add and formats the response.server.tool( "svn_add", "Añadir archivos al control de versiones", { paths: z.union([z.string(), z.array(z.string())]).describe("Archivo(s) o directorio(s) a añadir"), force: z.boolean().optional().default(false).describe("Forzar adición"), noIgnore: z.boolean().optional().default(false).describe("No respetar reglas de ignore"), parents: z.boolean().optional().default(false).describe("Crear directorios padre si es necesario"), autoProps: z.boolean().optional().describe("Aplicar auto-propiedades"), noAutoProps: z.boolean().optional().describe("No aplicar auto-propiedades") }, async (args) => { try { const options = { force: args.force, noIgnore: args.noIgnore, parents: args.parents, autoProps: args.autoProps, noAutoProps: args.noAutoProps }; const result = await getSvnService().add(args.paths, options); const pathsArray = Array.isArray(args.paths) ? args.paths : [args.paths]; const addText = `➕ **Archivos Añadidos**\n\n` + `**Archivos:** ${pathsArray.join(', ')}\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: addText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );