svn_status
Check the status of files in your SVN working copy to see modifications, additions, or deletions before committing changes.
Instructions
Ver el estado de archivos en el working copy
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Ruta específica a consultar | |
| showAll | No | Mostrar estado remoto también |
Implementation Reference
- tools/svn-service.ts:161-201 (handler)Core handler function that executes 'svn status' command (with optional --show-updates for remote status), parses the output using parseStatusOutput, and returns structured SvnStatus[]async getStatus(path?: string, showAll: boolean = false): Promise<SvnResponse<SvnStatus[]>> { try { const args = ['status']; if (path) { if (!validatePath(path)) { throw new SvnError(`Invalid path: ${path}`); } args.push(normalizePath(path)); } let response; // Si showAll es true, intentar primero con --show-updates if (showAll) { try { const argsWithUpdates = [...args, '--show-updates']; response = await executeSvnCommand(this.config, argsWithUpdates); } catch (error: any) { // Si falla con --show-updates, intentar sin él console.warn(`Warning: --show-updates failed, falling back to local status only: ${error.message}`); response = await executeSvnCommand(this.config, args); } } else { response = await executeSvnCommand(this.config, args); } const statusList = parseStatusOutput(cleanOutput(response.data as string)); return { success: true, data: statusList, command: response.command, workingDirectory: response.workingDirectory, executionTime: response.executionTime }; } catch (error: any) { this.handleSvnError(error, 'get SVN status'); } }
- index.ts:152-201 (registration)MCP server registration of 'svn_status' tool, including Zod input schema (path?: string, showAll?: boolean) and wrapper handler that calls SvnService.getStatus and formats response with iconsserver.tool( "svn_status", "Ver el estado de archivos en el working copy", { path: z.string().optional().describe("Ruta específica a consultar"), showAll: z.boolean().optional().default(false).describe("Mostrar estado remoto también") }, async (args) => { try { const result = await getSvnService().getStatus(args.path, args.showAll); const statusList = result.data!; if (statusList.length === 0) { return { content: [{ type: "text", text: "✅ **No hay cambios en el working copy**" }], }; } const statusText = `📊 **Estado SVN** (${statusList.length} elementos)\n\n` + statusList.map(status => { const statusIcon: {[key: string]: string} = { 'added': '➕', 'deleted': '➖', 'modified': '✏️', 'replaced': '🔄', 'merged': '🔀', 'conflicted': '⚠️', 'ignored': '🙈', 'none': '⚪', 'normal': '✅', 'external': '🔗', 'incomplete': '⏸️', 'unversioned': '❓', 'missing': '❌' }; return `${statusIcon[status.status] || '📄'} **${status.status.toUpperCase()}** - ${status.path}`; }).join('\n') + `\n\n**Tiempo de Ejecución:** ${formatDuration(result.executionTime || 0)}`; return { content: [{ type: "text", text: statusText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- index.ts:155-158 (schema)Zod input schema validation for svn_status tool parameters{ path: z.string().optional().describe("Ruta específica a consultar"), showAll: z.boolean().optional().default(false).describe("Mostrar estado remoto también") },
- common/types.ts:50-57 (schema)TypeScript interface defining the structure of SVN status entries returned by the toolexport interface SvnStatus { path: string; status: 'unversioned' | 'added' | 'deleted' | 'modified' | 'replaced' | 'merged' | 'conflicted' | 'ignored' | 'none' | 'normal' | 'external' | 'incomplete'; revision?: number; changedRev?: number; changedAuthor?: string; changedDate?: string; }
- common/utils.ts:281-301 (helper)Utility function to parse raw 'svn status' command output into array of SvnStatus objects using SVN_STATUS_CODES mappingexport function parseStatusOutput(output: string): SvnStatus[] { const lines = output.split('\n').filter(line => line.trim()); const statusList: SvnStatus[] = []; for (const line of lines) { if (line.length < 8) continue; const statusCode = line[0]; const propStatusCode = line[1]; const path = line.substring(8).trim(); const status: SvnStatus = { path, status: (SVN_STATUS_CODES as any)[statusCode] || 'unknown' }; statusList.push(status); } return statusList; }