Skip to main content
Glama
Skynotdie

MCP Localization Project

by Skynotdie
models.py2.74 kB
#!/usr/bin/env python3 """ Edit File Lines Models - 라인 편집 데이터 모델 파일 편집에 필요한 모든 데이터 클래스와 enum 정의 """ import uuid from datetime import datetime from typing import Dict, List, Optional, Any from dataclasses import dataclass from enum import Enum class EditStatus(Enum): """편집 상태""" PENDING = "pending" # 대기 중 (dryRun 완료, approve 대기) APPLIED = "applied" # 적용 완료 EXPIRED = "expired" # 만료됨 CANCELLED = "cancelled" # 취소됨 FAILED = "failed" # 실패 class EditMode(Enum): """편집 모드""" REPLACE = "replace" # 라인 범위 교체 INSERT = "insert" # 특정 위치에 삽입 DELETE = "delete" # 라인 삭제 STRING_MATCH = "string_match" # 문자열 매칭 교체 REGEX_MATCH = "regex_match" # 정규식 매칭 교체 class ConflictType(Enum): """충돌 유형""" FILE_INTEGRITY = "file_integrity" # 파일 무결성 RANGE_OVERLAP = "range_overlap" # 편집 범위 겹침 CONTENT_CONFLICT = "content_conflict" # 콘텐츠 충돌 CONCURRENT_EDIT = "concurrent_edit" # 동시 편집 @dataclass class EditOperation: """편집 작업 정보""" start_line: int end_line: int content: str str_match: Optional[str] = None regex_match: Optional[str] = None operation_id: str = None def __post_init__(self): if self.operation_id is None: self.operation_id = str(uuid.uuid4())[:8] @property def edit_mode(self) -> EditMode: """편집 모드 결정""" if self.regex_match: return EditMode.REGEX_MATCH elif self.str_match: return EditMode.STRING_MATCH elif self.end_line == 0: return EditMode.INSERT elif self.content == "": return EditMode.DELETE else: return EditMode.REPLACE @dataclass class ConflictInfo: """충돌 정보""" line_number: int original_content: str current_content: str edit_content: str conflict_type: ConflictType suggested_resolution: str @dataclass class EditSession: """편집 세션 정보""" session_id: str file_path: str operations: List[EditOperation] status: EditStatus created_at: datetime expires_at: datetime file_hash: str preview_diff: Optional[str] = None conflicts: List[ConflictInfo] = None @dataclass class EditPreview: """편집 미리보기 정보""" session_id: str preview_diff: str conflicts: List[ConflictInfo] total_lines_changed: int is_safe: bool warnings: List[str]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Skynotdie/mky'

If you have feedback or need assistance with the MCP directory API, please join our Discord server