Private
Public Access
Merge origin/tier2/module_taxonomy_refactor_20260627: bring in v2 SHIPPED work
Per post_module_taxonomy_de_cruft_20260627 Phase 0 prerequisite. Master is at6344b49f(pre-merge of v2 SHIPPED). This merge brings in the 18 v2 SHIPPED commits that define the destination modules (src.mma, src/project.py, src/project_files.py, src.tool_presets, src.tool_bias, src.external_editor, src.personas, src.workspace_manager, src.mcp_client) needed by the Phase 2 consumer migration in commit8f11340b. Conflicts resolved (all were import-block re-orderings between my migration's update and v2 SHIPPED's update of the same files): - src/external_editor.py: took v2 SHIPPED version (class definitions + the no-alias import pattern) - src/personas.py: took v2 SHIPPED version - src/tool_bias.py: took v2 SHIPPED version - src/tool_presets.py: took v2 SHIPPED version - src/workspace_manager.py: took v2 SHIPPED version - src/ai_client.py: took v2 SHIPPED version (removes the 'as _FIC' alias; uses 'from src.project_files import FileItem' directly per the v2 SHIPPED style) - conductor/tracks/module_taxonomy_refactor_20260627/spec.md: took HEAD version (my Phase 1 VC2 + VC10 corrections; the v2 SHIPPED version was the pre-correction spec)
This commit is contained in:
+58
-4
@@ -6,10 +6,64 @@ import subprocess
|
||||
import tempfile
|
||||
|
||||
# TODO(Ed): Eliminate these?
|
||||
from pathlib import Path
|
||||
from typing import Optional, List, Dict, Any
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Optional, List, Dict, Any
|
||||
|
||||
from src.result_types import ErrorInfo, ErrorKind, Result
|
||||
from src.result_types import ErrorInfo, ErrorKind, Result
|
||||
from src.type_aliases import Metadata
|
||||
|
||||
|
||||
@dataclass
|
||||
class TextEditorConfig:
|
||||
name: str = ""
|
||||
path: str = ""
|
||||
diff_args: List[str] = field(default_factory=list)
|
||||
|
||||
def to_dict(self) -> Metadata:
|
||||
return {
|
||||
"name": self.name,
|
||||
"path": self.path,
|
||||
"diff_args": self.diff_args,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: Metadata) -> "TextEditorConfig":
|
||||
return cls(
|
||||
name = data["name"],
|
||||
path = data["path"],
|
||||
diff_args = data.get("diff_args", []),
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class ExternalEditorConfig:
|
||||
editors: Dict[str, TextEditorConfig] = field(default_factory=dict)
|
||||
default_editor: Optional[str] = None
|
||||
|
||||
def get_default(self) -> TextEditorConfig:
|
||||
if self.default_editor and self.default_editor in self.editors:
|
||||
return self.editors[self.default_editor]
|
||||
if self.editors:
|
||||
return next(iter(self.editors.values()))
|
||||
return EMPTY_TEXT_EDITOR_CONFIG
|
||||
|
||||
def to_dict(self) -> Metadata:
|
||||
return {
|
||||
"editors": {k: v.to_dict() for k, v in self.editors.items()},
|
||||
"default_editor": self.default_editor,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: Metadata) -> "ExternalEditorConfig":
|
||||
editors = {}
|
||||
for name, ed_data in data.get("editors", {}).items():
|
||||
if isinstance(ed_data, dict): editors[name] = TextEditorConfig.from_dict(ed_data)
|
||||
elif isinstance(ed_data, str): editors[name] = TextEditorConfig(name=name, path=ed_data)
|
||||
return cls(editors=editors, default_editor=data.get("default_editor"))
|
||||
|
||||
|
||||
EMPTY_TEXT_EDITOR_CONFIG: TextEditorConfig = TextEditorConfig()
|
||||
|
||||
|
||||
class ExternalEditorLauncher:
|
||||
@@ -47,7 +101,7 @@ class ExternalEditorLauncher:
|
||||
except FileNotFoundError as e:
|
||||
return Result(data=None, errors=[ErrorInfo(kind=ErrorKind.NOT_FOUND, message=f"Editor binary not found: {cmd[0]}", source="external_editor.launch_diff_result", original=e)])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_cached_vscode_config: Optional[TextEditorConfig] = None
|
||||
|
||||
Reference in New Issue
Block a user