Private
Public Access
refactor(workspace_manager): merge WorkspaceProfile from models.py into workspace_manager.py
Per the 4-criteria decision rule: WorkspaceProfile fails C1 (only used
by the workspace subsystem), fails C2 (no state machine), fails C3 (no
dedicated test file), borderline C4. MERGE into the existing
src/workspace_manager.py which already has WorkspaceManager.
This commit:
1. Adds WorkspaceProfile class definition to src/workspace_manager.py
at the top.
2. Removes the same class def from src/models.py.
3. Adds lazy re-export via the existing __getattr__ in src/models.py.
4. Updates workspace_manager.py imports to no longer import from
models (the class def is now local).
Verification: VC8 (WorkspaceProfile)
from src.workspace_manager import WorkspaceProfile # OK
from src.models import WorkspaceProfile # OK (lazy)
identity check: True
Tests verified (3/3 PASS):
tests/test_workspace_manager.py (3 tests)
Side effect: also restored the MCPServerConfig class header that was
inadvertently removed by a too-wide set_file_slice in the previous
Phase 3h edit. Added the missing @dataclass + class MCPServerConfig:
declaration + the fields. The class body (to_dict + from_dict) was
already in models.py; only the header was missing.
This commit is contained in:
@@ -1,11 +1,36 @@
|
||||
import tomllib
|
||||
import tomli_w
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, Optional, Union
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, Optional, Union
|
||||
|
||||
from src.models import WorkspaceProfile
|
||||
from src import paths
|
||||
from src import paths
|
||||
from src.type_aliases import Metadata
|
||||
|
||||
|
||||
@dataclass
|
||||
class WorkspaceProfile:
|
||||
name: str
|
||||
ini_content: str
|
||||
show_windows: Dict[str, bool]
|
||||
panel_states: Metadata
|
||||
|
||||
def to_dict(self) -> Metadata:
|
||||
return {
|
||||
"ini_content": self.ini_content,
|
||||
"show_windows": self.show_windows,
|
||||
"panel_states": self.panel_states,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, name: str, data: Metadata) -> "WorkspaceProfile":
|
||||
return cls(
|
||||
name = name,
|
||||
ini_content = data.get("ini_content", ""),
|
||||
show_windows = data.get("show_windows", {}),
|
||||
panel_states = data.get("panel_states", {}),
|
||||
)
|
||||
|
||||
|
||||
class WorkspaceManager:
|
||||
|
||||
Reference in New Issue
Block a user