diff --git a/Assets/Tests/Editor/OnionAssemblyDependencyTests.cs b/Assets/Tests/Editor/OnionAssemblyDependencyTests.cs index 048ea72128..e82677bb72 100644 --- a/Assets/Tests/Editor/OnionAssemblyDependencyTests.cs +++ b/Assets/Tests/Editor/OnionAssemblyDependencyTests.cs @@ -212,12 +212,12 @@ public void ToolSettings_WhenLoaded_CompileUnderDomainAssembly() string toolSettingsDataAssemblyName = typeof(ToolSettingsData).Assembly.GetName().Name; string editorSettingsDataAssemblyName = typeof(UnityCliLoopEditorSettingsData).Assembly.GetName().Name; string toolSettingsPortAssemblyName = typeof(IToolSettingsPort).Assembly.GetName().Name; - string editorSettingsServiceAssemblyName = typeof(UnityCliLoopEditorSettingsService).Assembly.GetName().Name; + string editorSettingsPortAssemblyName = typeof(IUnityCliLoopEditorSettingsPort).Assembly.GetName().Name; Assert.That(toolSettingsDataAssemblyName, Is.EqualTo(DomainAssemblyName)); Assert.That(editorSettingsDataAssemblyName, Is.EqualTo(DomainAssemblyName)); Assert.That(toolSettingsPortAssemblyName, Is.EqualTo(DomainAssemblyName)); - Assert.That(editorSettingsServiceAssemblyName, Is.EqualTo(DomainAssemblyName)); + Assert.That(editorSettingsPortAssemblyName, Is.EqualTo(DomainAssemblyName)); } [Test] @@ -818,7 +818,7 @@ public void InfrastructureEditorStartup_WhenLoaded_SchedulesSettingsRecoveryInst Assert.That( startupSource, - Does.Contain("UnityCliLoopEditorSettingsRecoveryScheduler.ScheduleForEditorStartup(editorSettingsService);")); + Does.Contain("UnityCliLoopEditorSettingsRecoveryScheduler.ScheduleForEditorStartup(editorSettingsPort);")); Assert.That(startupSource, Does.Not.Contain("RecoverSettingsFileForEditorStartup")); } diff --git a/Assets/Tests/Editor/SetupWizardWindowTests.cs b/Assets/Tests/Editor/SetupWizardWindowTests.cs index 6fcc5febbc..114ca5ad89 100644 --- a/Assets/Tests/Editor/SetupWizardWindowTests.cs +++ b/Assets/Tests/Editor/SetupWizardWindowTests.cs @@ -24,7 +24,7 @@ public class SetupWizardWindowTests private bool _settingsFileExisted; private string _settingsFileContent; - private UnityCliLoopEditorSettingsService _editorSettingsService; + private IUnityCliLoopEditorSettingsPort _editorSettingsPort; private UnityCliLoopEditorSettingsRepository _editorSettingsRepository; private UnityCliLoopEditorSessionStateService _sessionStateService; private UnityCliLoopEditorSessionStateSnapshot _originalSessionState; @@ -41,12 +41,12 @@ public void SetUp() } DeleteIfExists(SettingsFilePath); - _editorSettingsService = - UnityCliLoopEditorSettingsTestFactory.CreateServiceWithRepository(out _editorSettingsRepository); + _editorSettingsPort = + UnityCliLoopEditorSettingsTestFactory.CreatePortWithRepository(out _editorSettingsRepository); _sessionStateService = UnityCliLoopEditorSessionStateTestFactory.CreateService(); _originalSessionState = UnityCliLoopEditorSessionStateTestFactory.CaptureSnapshot(_sessionStateService); _sessionStateService.ClearAll(); - SetupWizardWindow.InitializeEditorServices(_editorSettingsService, _sessionStateService); + SetupWizardWindow.InitializeEditorServices(_editorSettingsPort, _sessionStateService); _editorSettingsRepository.InvalidateCache(); } @@ -201,7 +201,7 @@ public void MaybeMarkThirdPartyToolMigrationAutoScan_WhenDisabled_KeepsSessionFl [Test] public void MaybeRecordLastSeenSetupWizardState_WhenAutoShow_UpdatesStoredState() { - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -209,16 +209,16 @@ public void MaybeRecordLastSeenSetupWizardState_WhenAutoShow_UpdatesStoredState( SetupWizardWindow.MaybeRecordLastSeenSetupWizardState(true, "1.7.3", "3.0.2"); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.2")); } [Test] public void MaybeRecordLastSeenSetupWizardState_WhenManualShow_KeepsStoredState() { - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -226,16 +226,16 @@ public void MaybeRecordLastSeenSetupWizardState_WhenManualShow_KeepsStoredState( SetupWizardWindow.MaybeRecordLastSeenSetupWizardState(false, "1.7.3", "3.0.2"); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.1")); } [Test] public void MaybeRecordSuppressedSetupWizardState_WhenAutoShowSuppressed_UpdatesStoredState() { - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -243,16 +243,16 @@ public void MaybeRecordSuppressedSetupWizardState_WhenAutoShowSuppressed_Updates SetupWizardWindow.MaybeRecordSuppressedSetupWizardState(true, "1.7.3", "3.0.2"); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.2")); } [Test] public void MaybeRecordSuppressedSetupWizardState_WhenAutoShowAllowed_KeepsStoredState() { - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -260,9 +260,9 @@ public void MaybeRecordSuppressedSetupWizardState_WhenAutoShowAllowed_KeepsStore SetupWizardWindow.MaybeRecordSuppressedSetupWizardState(false, "1.7.3", "3.0.2"); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.1")); } @@ -270,7 +270,7 @@ public void MaybeRecordSuppressedSetupWizardState_WhenAutoShowAllowed_KeepsStore public void TryReuseOpenWindow_WhenExistingWindowAndAutoShow_FocusesWindowAndRecordsVersion() { bool focusedExistingWindow = false; - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -285,9 +285,9 @@ public void TryReuseOpenWindow_WhenExistingWindowAndAutoShow_FocusesWindowAndRec Assert.That(reused, Is.True); Assert.That(focusedExistingWindow, Is.True); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.3")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.2")); } @@ -295,7 +295,7 @@ public void TryReuseOpenWindow_WhenExistingWindowAndAutoShow_FocusesWindowAndRec public void TryReuseOpenWindow_WhenExistingWindowAndManualShow_FocusesWindowWithoutRecordingVersion() { bool focusedExistingWindow = false; - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -310,9 +310,9 @@ public void TryReuseOpenWindow_WhenExistingWindowAndManualShow_FocusesWindowWith Assert.That(reused, Is.True); Assert.That(focusedExistingWindow, Is.True); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.1")); } @@ -320,7 +320,7 @@ public void TryReuseOpenWindow_WhenExistingWindowAndManualShow_FocusesWindowWith public void TryReuseOpenWindow_WhenNoExistingWindow_DoesNotFocusOrRecordVersion() { bool focusedExistingWindow = false; - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { lastSeenSetupWizardVersion = "1.7.2", lastSeenSetupWizardMinimumDispatcherVersion = "3.0.1" @@ -335,9 +335,9 @@ public void TryReuseOpenWindow_WhenNoExistingWindow_DoesNotFocusOrRecordVersion( Assert.That(reused, Is.False); Assert.That(focusedExistingWindow, Is.False); - Assert.That(_editorSettingsService.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); + Assert.That(_editorSettingsPort.GetLastSeenSetupWizardVersion(), Is.EqualTo("1.7.2")); Assert.That( - _editorSettingsService.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, + _editorSettingsPort.GetSettings().lastSeenSetupWizardMinimumDispatcherVersion, Is.EqualTo("3.0.1")); } diff --git a/Assets/Tests/Editor/StaticFacadeStateGuardTests.cs b/Assets/Tests/Editor/StaticFacadeStateGuardTests.cs index 2829704d54..8a3778630e 100644 --- a/Assets/Tests/Editor/StaticFacadeStateGuardTests.cs +++ b/Assets/Tests/Editor/StaticFacadeStateGuardTests.cs @@ -48,7 +48,6 @@ public sealed class StaticFacadeStateGuardTests { "Packages/src/Editor/Application/SessionRecoveryService.cs", "Packages/src/Editor/Application/UseCases/SkillSetupUseCase.cs", - "Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs", "Packages/src/Editor/Domain/UnityCliLoopEditorSessionStateService.cs", "Packages/src/Editor/Infrastructure/Server/DomainReloadDetectionFileService.cs" }; diff --git a/Assets/Tests/Editor/UnityCliLoopEditorSettingsRecoveryTests.cs b/Assets/Tests/Editor/UnityCliLoopEditorSettingsRecoveryTests.cs index aa383f2d83..3baf8a64ad 100644 --- a/Assets/Tests/Editor/UnityCliLoopEditorSettingsRecoveryTests.cs +++ b/Assets/Tests/Editor/UnityCliLoopEditorSettingsRecoveryTests.cs @@ -32,7 +32,7 @@ public class UnityCliLoopEditorSettingsRecoveryTests private string _backupFileContent; private bool _tempFileExisted; private string _tempFileContent; - private UnityCliLoopEditorSettingsService _editorSettingsService; + private IUnityCliLoopEditorSettingsPort _editorSettingsPort; private UnityCliLoopEditorSettingsRepository _editorSettingsRepository; private UnityCliLoopEditorSessionStateService _sessionStateService; private UnityCliLoopEditorSessionStateSnapshot _originalSessionState; @@ -61,8 +61,8 @@ public void SetUp() DeleteIfExists(LegacySettingsFilePath); DeleteIfExists(BackupFilePath); DeleteIfExists(TempFilePath); - _editorSettingsService = - UnityCliLoopEditorSettingsTestFactory.CreateServiceWithRepository(out _editorSettingsRepository); + _editorSettingsPort = + UnityCliLoopEditorSettingsTestFactory.CreatePortWithRepository(out _editorSettingsRepository); _editorSettingsRepository.InvalidateCache(); _sessionStateService = UnityCliLoopEditorSessionStateTestFactory.CreateService(); _originalSessionState = UnityCliLoopEditorSessionStateTestFactory.CaptureSnapshot(_sessionStateService); @@ -86,7 +86,7 @@ public void RecoverSettingsFileIfNeeded_WhenPrimaryMissingAndBackupExists_Should UnityCliLoopEditorSettingsData backupData = new() { showDeveloperTools = true }; File.WriteAllText(BackupFilePath, JsonUtility.ToJson(backupData, true)); - _editorSettingsService.RecoverSettingsFileIfNeeded(); + _editorSettingsPort.RecoverSettingsFileIfNeeded(); Assert.IsTrue(File.Exists(SettingsFilePath), "Primary settings file should be restored from backup"); Assert.IsFalse(File.Exists(BackupFilePath), "Backup should be consumed after recovery"); @@ -104,7 +104,7 @@ public void RecoverSettingsFileIfNeeded_WhenPrimaryMissingAndTempExists_ShouldPr File.WriteAllText(BackupFilePath, JsonUtility.ToJson(oldData, true)); File.WriteAllText(TempFilePath, JsonUtility.ToJson(newData, true)); - _editorSettingsService.RecoverSettingsFileIfNeeded(); + _editorSettingsPort.RecoverSettingsFileIfNeeded(); Assert.IsTrue(File.Exists(SettingsFilePath), "Primary settings file should be restored from temp"); Assert.IsFalse(File.Exists(BackupFilePath), "Backup should be removed after temp recovery"); @@ -123,7 +123,7 @@ public void RecoverSettingsFileIfNeeded_WhenPrimaryExists_ShouldCleanStaleSideca File.WriteAllText(BackupFilePath, JsonUtility.ToJson(new UnityCliLoopEditorSettingsData { showDeveloperTools = false }, true)); File.WriteAllText(TempFilePath, JsonUtility.ToJson(new UnityCliLoopEditorSettingsData { showDeveloperTools = false }, true)); - _editorSettingsService.RecoverSettingsFileIfNeeded(); + _editorSettingsPort.RecoverSettingsFileIfNeeded(); Assert.IsFalse(File.Exists(BackupFilePath), "Backup should not linger once primary exists"); Assert.IsFalse(File.Exists(TempFilePath), "Temp should not linger once primary exists"); @@ -144,8 +144,8 @@ public void GetSettings_WhenLegacySetupWizardStateExists_ShouldMigrateVersionSta }; File.WriteAllText(LegacySettingsFilePath, JsonUtility.ToJson(legacyData, true)); - string lastSeenVersion = _editorSettingsService.GetLastSeenSetupWizardVersion(); - bool suppressAutoShow = _editorSettingsService.GetSuppressSetupWizardAutoShow(); + string lastSeenVersion = _editorSettingsPort.GetLastSeenSetupWizardVersion(); + bool suppressAutoShow = _editorSettingsPort.GetSuppressSetupWizardAutoShow(); Assert.That(lastSeenVersion, Is.EqualTo("2.1.1")); Assert.That(suppressAutoShow, Is.False); @@ -164,7 +164,7 @@ public void GetSettings_WhenLegacySetupWizardAutoShowWasSuppressed_ShouldMigrate }; File.WriteAllText(LegacySettingsFilePath, JsonUtility.ToJson(legacyData, true)); - bool suppressAutoShow = _editorSettingsService.GetSuppressSetupWizardAutoShow(); + bool suppressAutoShow = _editorSettingsPort.GetSuppressSetupWizardAutoShow(); Assert.That(suppressAutoShow, Is.True); Assert.That(File.Exists(LegacySettingsFilePath), Is.False); @@ -187,8 +187,8 @@ public void GetSettings_WhenCurrentSetupWizardVersionExistsBeforeMigration_Shoul File.WriteAllText(SettingsFilePath, JsonUtility.ToJson(currentData, true)); File.WriteAllText(LegacySettingsFilePath, JsonUtility.ToJson(legacyData, true)); - string lastSeenVersion = _editorSettingsService.GetLastSeenSetupWizardVersion(); - bool suppressAutoShow = _editorSettingsService.GetSuppressSetupWizardAutoShow(); + string lastSeenVersion = _editorSettingsPort.GetLastSeenSetupWizardVersion(); + bool suppressAutoShow = _editorSettingsPort.GetSuppressSetupWizardAutoShow(); Assert.That(lastSeenVersion, Is.EqualTo("2.1.1")); Assert.That(suppressAutoShow, Is.False); @@ -213,8 +213,8 @@ public void GetSettings_WhenLegacySetupWizardStateAlreadyMigrated_ShouldKeepCurr File.WriteAllText(SettingsFilePath, JsonUtility.ToJson(currentData, true)); File.WriteAllText(LegacySettingsFilePath, JsonUtility.ToJson(legacyData, true)); - string lastSeenVersion = _editorSettingsService.GetLastSeenSetupWizardVersion(); - bool suppressAutoShow = _editorSettingsService.GetSuppressSetupWizardAutoShow(); + string lastSeenVersion = _editorSettingsPort.GetLastSeenSetupWizardVersion(); + bool suppressAutoShow = _editorSettingsPort.GetSuppressSetupWizardAutoShow(); Assert.That(lastSeenVersion, Is.EqualTo("3.0.0-beta.3")); Assert.That(suppressAutoShow, Is.False); @@ -227,7 +227,7 @@ public void GetInstallSkillsFlat_WhenMissingFromSettings_DefaultsToTrue() File.WriteAllText(SettingsFilePath, "{\"showDeveloperTools\":true}"); _editorSettingsRepository.InvalidateCache(); - bool installSkillsFlat = _editorSettingsService.GetSettings().installSkillsFlat; + bool installSkillsFlat = _editorSettingsPort.GetSettings().installSkillsFlat; Assert.IsTrue(installSkillsFlat); } @@ -252,7 +252,7 @@ public void RecoverSettingsFileIfNeeded_WhenLegacyPortFieldsExist_ShouldRemoveTh "\"connectedLLMTools\":[{\"Name\":\"codex\",\"Endpoint\":\"/tmp/uloop/test.sock#1\",\"Port\":18449}]" + "}"); - _editorSettingsService.RecoverSettingsFileIfNeeded(); + _editorSettingsPort.RecoverSettingsFileIfNeeded(); string recoveredJson = File.ReadAllText(SettingsFilePath); StringAssert.DoesNotContain("customPort", recoveredJson); @@ -275,16 +275,16 @@ public void RecoverSettingsFileIfNeeded_WhenSettingsFileExceedsSizeLimit_ShouldT { File.WriteAllText(SettingsFilePath, new string(' ', UnityCliLoopConstants.MAX_SETTINGS_SIZE_BYTES + 1)); - Assert.Throws(() => _editorSettingsService.RecoverSettingsFileIfNeeded()); + Assert.Throws(() => _editorSettingsPort.RecoverSettingsFileIfNeeded()); } [Test] public void SetInstallSkillsFlat_PersistsValue() { - _editorSettingsService.SetInstallSkillsFlat(true); + _editorSettingsPort.SetInstallSkillsFlat(true); _editorSettingsRepository.InvalidateCache(); - bool installSkillsFlat = _editorSettingsService.GetSettings().installSkillsFlat; + bool installSkillsFlat = _editorSettingsPort.GetSettings().installSkillsFlat; Assert.IsTrue(installSkillsFlat); } @@ -292,7 +292,7 @@ public void SetInstallSkillsFlat_PersistsValue() [Test] public void UpdateSessionState_WhenStartingServer_ShouldNotPersistRuntimeIdentity() { - _editorSettingsService.SaveSettings(new UnityCliLoopEditorSettingsData { showDeveloperTools = true }); + _editorSettingsPort.SaveSettings(new UnityCliLoopEditorSettingsData { showDeveloperTools = true }); UnityCliLoopServerStartupService service = new UnityCliLoopServerStartupService( new TestServerInstanceFactory(), diff --git a/Assets/Tests/Editor/UnityCliLoopEditorSettingsTestFactory.cs b/Assets/Tests/Editor/UnityCliLoopEditorSettingsTestFactory.cs index 73730146c2..eb0f756289 100644 --- a/Assets/Tests/Editor/UnityCliLoopEditorSettingsTestFactory.cs +++ b/Assets/Tests/Editor/UnityCliLoopEditorSettingsTestFactory.cs @@ -4,20 +4,20 @@ namespace io.github.hatayama.UnityCliLoop.Tests.Editor { /// - /// Creates editor settings services backed by the real test project settings files. + /// Creates editor settings ports backed by the real test project settings files. /// internal static class UnityCliLoopEditorSettingsTestFactory { - internal static UnityCliLoopEditorSettingsService CreateService() + internal static IUnityCliLoopEditorSettingsPort CreatePort() { - return new UnityCliLoopEditorSettingsService(new UnityCliLoopEditorSettingsRepository()); + return new UnityCliLoopEditorSettingsRepository(); } - internal static UnityCliLoopEditorSettingsService CreateServiceWithRepository( + internal static IUnityCliLoopEditorSettingsPort CreatePortWithRepository( out UnityCliLoopEditorSettingsRepository repository) { repository = new UnityCliLoopEditorSettingsRepository(); - return new UnityCliLoopEditorSettingsService(repository); + return repository; } } } diff --git a/Assets/Tests/Editor/UnityCliLoopPackageRemovalSettingsResetterTests.cs b/Assets/Tests/Editor/UnityCliLoopPackageRemovalSettingsResetterTests.cs index 430658ad57..ef9b713871 100644 --- a/Assets/Tests/Editor/UnityCliLoopPackageRemovalSettingsResetterTests.cs +++ b/Assets/Tests/Editor/UnityCliLoopPackageRemovalSettingsResetterTests.cs @@ -17,7 +17,7 @@ public sealed class UnityCliLoopPackageRemovalSettingsResetterTests private bool _settingsFileExisted; private string _settingsFileContent; - private UnityCliLoopEditorSettingsService _editorSettingsService; + private IUnityCliLoopEditorSettingsPort _editorSettingsPort; private UnityCliLoopEditorSettingsRepository _editorSettingsRepository; [SetUp] @@ -32,8 +32,8 @@ public void SetUp() } DeleteIfExists(SettingsFilePath); - _editorSettingsService = - UnityCliLoopEditorSettingsTestFactory.CreateServiceWithRepository(out _editorSettingsRepository); + _editorSettingsPort = + UnityCliLoopEditorSettingsTestFactory.CreatePortWithRepository(out _editorSettingsRepository); _editorSettingsRepository.InvalidateCache(); } @@ -108,14 +108,14 @@ public void ResetSetupWizardStateIfPackageRemoved_WhenOwnPackageRemoved_ClearsSt { // Verifies that the removal handler persists the setup wizard reset. UnityCliLoopEditorSettingsData settings = CreateSettingsWithNonWizardPreferences(); - _editorSettingsService.SaveSettings(settings); + _editorSettingsPort.SaveSettings(settings); UnityCliLoopPackageRemovalSettingsResetter.ResetSetupWizardStateIfPackageRemoved( - _editorSettingsService, + _editorSettingsPort, new List { UnityCliLoopConstants.PACKAGE_NAME }, UnityCliLoopConstants.PACKAGE_NAME); - UnityCliLoopEditorSettingsData updatedSettings = _editorSettingsService.GetSettings(); + UnityCliLoopEditorSettingsData updatedSettings = _editorSettingsPort.GetSettings(); Assert.That(updatedSettings.lastSeenSetupWizardVersion, Is.Empty); Assert.That(updatedSettings.lastSeenSetupWizardMinimumDispatcherVersion, Is.Empty); Assert.That(updatedSettings.suppressSetupWizardAutoShow, Is.False); diff --git a/Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs b/Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs index 78e7d02fec..ebf32052ac 100644 --- a/Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs +++ b/Packages/src/Editor/CompositionRoot/UnityCliLoopApplicationRegistration.cs @@ -16,8 +16,7 @@ internal UnityCliLoopApplicationServices Register() { VibeLogger.InitializeForEditorStartup(); IToolSettingsPort toolSettingsPort = new ToolSettingsRepository(); - UnityCliLoopEditorSettingsRepository editorSettingsRepository = new(); - UnityCliLoopEditorSettingsService editorSettingsService = new(editorSettingsRepository); + IUnityCliLoopEditorSettingsPort editorSettingsPort = new UnityCliLoopEditorSettingsRepository(); UnityCliLoopEditorSessionStateRepository sessionStateRepository = new(); UnityCliLoopEditorSessionStateService sessionStateService = new(sessionStateRepository); UnityCliLoopEditorSessionStateFacade.RegisterService(sessionStateService); @@ -63,7 +62,7 @@ internal UnityCliLoopApplicationServices Register() return new UnityCliLoopApplicationServices( domainReloadDetectionService, - editorSettingsService, + editorSettingsPort, sessionStateService); } } @@ -72,16 +71,16 @@ internal sealed class UnityCliLoopApplicationServices { internal UnityCliLoopApplicationServices( IDomainReloadDetectionService domainReloadDetectionService, - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, UnityCliLoopEditorSessionStateService sessionStateService) { DomainReloadDetectionService = domainReloadDetectionService; - EditorSettingsService = editorSettingsService; + EditorSettingsPort = editorSettingsPort; SessionStateService = sessionStateService; } internal IDomainReloadDetectionService DomainReloadDetectionService { get; } - internal UnityCliLoopEditorSettingsService EditorSettingsService { get; } + internal IUnityCliLoopEditorSettingsPort EditorSettingsPort { get; } internal UnityCliLoopEditorSessionStateService SessionStateService { get; } } } diff --git a/Packages/src/Editor/CompositionRoot/UnityCliLoopEditorBootstrapper.cs b/Packages/src/Editor/CompositionRoot/UnityCliLoopEditorBootstrapper.cs index 31a29c7d42..366747b2f0 100644 --- a/Packages/src/Editor/CompositionRoot/UnityCliLoopEditorBootstrapper.cs +++ b/Packages/src/Editor/CompositionRoot/UnityCliLoopEditorBootstrapper.cs @@ -28,9 +28,9 @@ internal void Initialize() ApplicationEditorStartup.Initialize(applicationServices.DomainReloadDetectionService); EditorRuntimeStateSnapshotSubscriber.InitializeForEditorStartup(); FirstPartyToolsEditorStartup.Initialize(); - InfrastructureEditorStartup.Initialize(applicationServices.EditorSettingsService); + InfrastructureEditorStartup.Initialize(applicationServices.EditorSettingsPort); PresentationEditorStartup.Initialize( - applicationServices.EditorSettingsService, + applicationServices.EditorSettingsPort, applicationServices.SessionStateService); } } diff --git a/Packages/src/Editor/Domain/IUnityCliLoopEditorSettingsPort.cs b/Packages/src/Editor/Domain/IUnityCliLoopEditorSettingsPort.cs new file mode 100644 index 0000000000..8745fd0e03 --- /dev/null +++ b/Packages/src/Editor/Domain/IUnityCliLoopEditorSettingsPort.cs @@ -0,0 +1,22 @@ +using System; + +namespace io.github.hatayama.UnityCliLoop.Domain +{ + /// + /// Defines the persistence boundary for Unity CLI Loop editor settings, owned by Infrastructure. + /// + public interface IUnityCliLoopEditorSettingsPort + { + void RecoverSettingsFileIfNeeded(); + UnityCliLoopEditorSettingsData GetSettings(); + void SaveSettings(UnityCliLoopEditorSettingsData settings); + void UpdateSettings(Func transform); + string GetLastSeenSetupWizardVersion(); + void SetLastSeenSetupWizardVersion(string version); + bool GetSuppressSetupWizardAutoShow(); + void SetSuppressSetupWizardAutoShow(bool suppressAutoShow); + void SetShowUnityCliLoopSecuritySetting(bool showUnityCliLoopSecuritySetting); + void SetShowToolSettings(bool showToolSettings); + void SetInstallSkillsFlat(bool installSkillsFlat); + } +} diff --git a/Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs.meta b/Packages/src/Editor/Domain/IUnityCliLoopEditorSettingsPort.cs.meta similarity index 100% rename from Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs.meta rename to Packages/src/Editor/Domain/IUnityCliLoopEditorSettingsPort.cs.meta diff --git a/Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs b/Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs deleted file mode 100644 index e16a541f7f..0000000000 --- a/Packages/src/Editor/Domain/UnityCliLoopEditorSettingsService.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Diagnostics; - -namespace io.github.hatayama.UnityCliLoop.Domain -{ - public interface IUnityCliLoopEditorSettingsPort - { - void RecoverSettingsFileIfNeeded(); - UnityCliLoopEditorSettingsData GetSettings(); - void SaveSettings(UnityCliLoopEditorSettingsData settings); - void UpdateSettings(Func transform); - string GetLastSeenSetupWizardVersion(); - void SetLastSeenSetupWizardVersion(string version); - bool GetSuppressSetupWizardAutoShow(); - void SetSuppressSetupWizardAutoShow(bool suppressAutoShow); - void SetShowUnityCliLoopSecuritySetting(bool showUnityCliLoopSecuritySetting); - void SetShowToolSettings(bool showToolSettings); - void SetInstallSkillsFlat(bool installSkillsFlat); - } - - /// - /// Coordinates Unity CLI Loop editor settings through the storage port owned by Infrastructure. - /// - public sealed class UnityCliLoopEditorSettingsService - { - private readonly IUnityCliLoopEditorSettingsPort _settingsPort; - - public UnityCliLoopEditorSettingsService(IUnityCliLoopEditorSettingsPort settingsPort) - { - Debug.Assert(settingsPort != null, "settingsPort must not be null"); - - _settingsPort = settingsPort ?? throw new ArgumentNullException(nameof(settingsPort)); - } - - public void RecoverSettingsFileIfNeeded() - { - _settingsPort.RecoverSettingsFileIfNeeded(); - } - - public UnityCliLoopEditorSettingsData GetSettings() - { - return _settingsPort.GetSettings(); - } - - public void SaveSettings(UnityCliLoopEditorSettingsData settings) - { - _settingsPort.SaveSettings(settings); - } - - public void UpdateSettings(Func transform) - { - _settingsPort.UpdateSettings(transform); - } - - public string GetLastSeenSetupWizardVersion() - { - return _settingsPort.GetLastSeenSetupWizardVersion(); - } - - public void SetLastSeenSetupWizardVersion(string version) - { - _settingsPort.SetLastSeenSetupWizardVersion(version); - } - - public bool GetSuppressSetupWizardAutoShow() - { - return _settingsPort.GetSuppressSetupWizardAutoShow(); - } - - public void SetSuppressSetupWizardAutoShow(bool suppressAutoShow) - { - _settingsPort.SetSuppressSetupWizardAutoShow(suppressAutoShow); - } - - public void SetShowUnityCliLoopSecuritySetting(bool showUnityCliLoopSecuritySetting) - { - _settingsPort.SetShowUnityCliLoopSecuritySetting(showUnityCliLoopSecuritySetting); - } - - public void SetShowToolSettings(bool showToolSettings) - { - _settingsPort.SetShowToolSettings(showToolSettings); - } - - public void SetInstallSkillsFlat(bool installSkillsFlat) - { - _settingsPort.SetInstallSkillsFlat(installSkillsFlat); - } - } -} diff --git a/Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs b/Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs index 57121166f5..e04cc97158 100644 --- a/Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs +++ b/Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs @@ -8,11 +8,11 @@ namespace io.github.hatayama.UnityCliLoop.Infrastructure /// internal static class InfrastructureEditorStartup { - internal static void Initialize(UnityCliLoopEditorSettingsService editorSettingsService) + internal static void Initialize(IUnityCliLoopEditorSettingsPort editorSettingsPort) { - UnityCliLoopPackageRemovalSettingsResetter packageRemovalSettingsResetter = new(editorSettingsService); + UnityCliLoopPackageRemovalSettingsResetter packageRemovalSettingsResetter = new(editorSettingsPort); packageRemovalSettingsResetter.RegisterForEditorStartup(); - UnityCliLoopEditorSettingsRecoveryScheduler.ScheduleForEditorStartup(editorSettingsService); + UnityCliLoopEditorSettingsRecoveryScheduler.ScheduleForEditorStartup(editorSettingsPort); EditorMainThreadLivenessTracker.RegisterForEditorStartup(); } } diff --git a/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSettingsRecoveryScheduler.cs b/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSettingsRecoveryScheduler.cs index 7fb5661ec8..4376fd4dca 100644 --- a/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSettingsRecoveryScheduler.cs +++ b/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopEditorSettingsRecoveryScheduler.cs @@ -10,16 +10,16 @@ namespace io.github.hatayama.UnityCliLoop.Infrastructure /// internal static class UnityCliLoopEditorSettingsRecoveryScheduler { - internal static void ScheduleForEditorStartup(UnityCliLoopEditorSettingsService editorSettingsService) + internal static void ScheduleForEditorStartup(IUnityCliLoopEditorSettingsPort editorSettingsPort) { - System.Diagnostics.Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + System.Diagnostics.Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); if (AssetDatabase.IsAssetImportWorkerProcess()) { return; } - EditorApplication.delayCall += editorSettingsService.RecoverSettingsFileIfNeeded; + EditorApplication.delayCall += editorSettingsPort.RecoverSettingsFileIfNeeded; } } } diff --git a/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPackageRemovalSettingsResetter.cs b/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPackageRemovalSettingsResetter.cs index 68ffb5e782..43bd20fbfa 100644 --- a/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPackageRemovalSettingsResetter.cs +++ b/Packages/src/Editor/Infrastructure/Settings/UnityCliLoopPackageRemovalSettingsResetter.cs @@ -16,14 +16,14 @@ namespace io.github.hatayama.UnityCliLoop.Infrastructure /// internal sealed class UnityCliLoopPackageRemovalSettingsResetter { - private readonly UnityCliLoopEditorSettingsService _editorSettingsService; + private readonly IUnityCliLoopEditorSettingsPort _editorSettingsPort; - internal UnityCliLoopPackageRemovalSettingsResetter(UnityCliLoopEditorSettingsService editorSettingsService) + internal UnityCliLoopPackageRemovalSettingsResetter(IUnityCliLoopEditorSettingsPort editorSettingsPort) { - Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); - _editorSettingsService = editorSettingsService - ?? throw new ArgumentNullException(nameof(editorSettingsService)); + _editorSettingsPort = editorSettingsPort + ?? throw new ArgumentNullException(nameof(editorSettingsPort)); } internal void RegisterForEditorStartup() @@ -68,11 +68,11 @@ internal static UnityCliLoopEditorSettingsData ResetSetupWizardState(UnityCliLoo } internal static void ResetSetupWizardStateIfPackageRemoved( - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, IEnumerable removedPackageNames, string packageName) { - Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); Debug.Assert(removedPackageNames != null, "removedPackageNames must not be null"); Debug.Assert(!string.IsNullOrEmpty(packageName), "packageName must not be null or empty"); @@ -81,7 +81,7 @@ internal static void ResetSetupWizardStateIfPackageRemoved( return; } - editorSettingsService.UpdateSettings(ResetSetupWizardState); + editorSettingsPort.UpdateSettings(ResetSetupWizardState); } private void HandleRegisteringPackages(PackageRegistrationEventArgs args) @@ -90,7 +90,7 @@ private void HandleRegisteringPackages(PackageRegistrationEventArgs args) IEnumerable removedPackageNames = GetRemovedPackageNames(args); ResetSetupWizardStateIfPackageRemoved( - _editorSettingsService, + _editorSettingsPort, removedPackageNames, UnityCliLoopConstants.PACKAGE_NAME); } diff --git a/Packages/src/Editor/Presentation/PresentationEditorStartup.cs b/Packages/src/Editor/Presentation/PresentationEditorStartup.cs index 618e7bb0d7..867f76427c 100644 --- a/Packages/src/Editor/Presentation/PresentationEditorStartup.cs +++ b/Packages/src/Editor/Presentation/PresentationEditorStartup.cs @@ -8,12 +8,12 @@ namespace io.github.hatayama.UnityCliLoop.Presentation internal static class PresentationEditorStartup { internal static void Initialize( - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, UnityCliLoopEditorSessionStateService sessionStateService) { - UnityCliLoopSettingsWindow.InitializeEditorServices(editorSettingsService, sessionStateService); + UnityCliLoopSettingsWindow.InitializeEditorServices(editorSettingsPort, sessionStateService); ThirdPartyToolMigrationWizardWindow.InitializeEditorServices(sessionStateService); - SetupWizardWindow.InitializeForEditorStartup(editorSettingsService, sessionStateService); + SetupWizardWindow.InitializeForEditorStartup(editorSettingsPort, sessionStateService); } } } diff --git a/Packages/src/Editor/Presentation/Setup/SetupWizardWindow.cs b/Packages/src/Editor/Presentation/Setup/SetupWizardWindow.cs index e1fdffff50..4ce77fbf81 100644 --- a/Packages/src/Editor/Presentation/Setup/SetupWizardWindow.cs +++ b/Packages/src/Editor/Presentation/Setup/SetupWizardWindow.cs @@ -28,14 +28,14 @@ public class SetupWizardWindow : EditorWindow private const bool ForceFlatSkillInstall = true; private static readonly char[] VersionMajorSeparators = { '.', '-' }; private static readonly Vector2 MinimumWindowSize = new(360f, 380f); - private static UnityCliLoopEditorSettingsService RegisteredEditorSettingsService; + private static IUnityCliLoopEditorSettingsPort RegisteredEditorSettingsPort; private static UnityCliLoopEditorSessionStateService RegisteredSessionStateService; internal static void InitializeForEditorStartup( - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, UnityCliLoopEditorSessionStateService sessionStateService) { - InitializeEditorServices(editorSettingsService, sessionStateService); + InitializeEditorServices(editorSettingsPort, sessionStateService); if (AssetDatabase.IsAssetImportWorkerProcess()) return; if (UnityEngine.Application.isBatchMode) return; @@ -44,14 +44,14 @@ internal static void InitializeForEditorStartup( } internal static void InitializeEditorServices( - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, UnityCliLoopEditorSessionStateService sessionStateService) { - Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); Debug.Assert(sessionStateService != null, "sessionStateService must not be null"); - RegisteredEditorSettingsService = editorSettingsService - ?? throw new System.ArgumentNullException(nameof(editorSettingsService)); + RegisteredEditorSettingsPort = editorSettingsPort + ?? throw new System.ArgumentNullException(nameof(editorSettingsPort)); RegisteredSessionStateService = sessionStateService ?? throw new System.ArgumentNullException(nameof(sessionStateService)); } @@ -126,7 +126,7 @@ internal static void MaybeRecordLastSeenSetupWizardState( !string.IsNullOrEmpty(minimumDispatcherVersion), "minimumDispatcherVersion must not be null or empty"); - GetEditorSettingsService().UpdateSettings((UnityCliLoopEditorSettingsData settings) => settings with + GetEditorSettingsPort().UpdateSettings((UnityCliLoopEditorSettingsData settings) => settings with { lastSeenSetupWizardVersion = version, lastSeenSetupWizardMinimumDispatcherVersion = minimumDispatcherVersion @@ -152,8 +152,8 @@ private static async void EvaluateVersionChange(CancellationToken ct) { string currentVersion = UnityCliLoopConstants.PackageInfo.version; string currentMinimumDispatcherVersion = GetMinimumRequiredCliVersion(); - UnityCliLoopEditorSettingsService editorSettingsService = GetEditorSettingsService(); - UnityCliLoopEditorSettingsData settings = editorSettingsService.GetSettings(); + IUnityCliLoopEditorSettingsPort editorSettingsPort = GetEditorSettingsPort(); + UnityCliLoopEditorSettingsData settings = editorSettingsPort.GetSettings(); bool suppressAutoShow = settings.suppressSetupWizardAutoShow; string lastSeenVersion = settings.lastSeenSetupWizardVersion ?? string.Empty; string lastSeenMinimumDispatcherVersion = @@ -284,7 +284,7 @@ private static void ShowWindowInternal(bool shouldRecordVersion) } string lastSeenSetupWizardVersionBeforeOpen = - GetEditorSettingsService().GetLastSeenSetupWizardVersion(); + GetEditorSettingsPort().GetLastSeenSetupWizardVersion(); Rect windowPosition = CreateCenteredRect(EditorGUIUtility.GetMainWindowPosition(), MinimumWindowSize); SetupWizardWindow window = CreateInstance(); PrepareForOpen( @@ -361,14 +361,14 @@ private static void FocusExistingWindow() FocusWindowIfItsOpen(); } - private static UnityCliLoopEditorSettingsService GetEditorSettingsService() + private static IUnityCliLoopEditorSettingsPort GetEditorSettingsPort() { - if (RegisteredEditorSettingsService == null) + if (RegisteredEditorSettingsPort == null) { - throw new System.InvalidOperationException("Unity CLI Loop editor settings service is not registered."); + throw new System.InvalidOperationException("Unity CLI Loop editor settings port is not registered."); } - return RegisteredEditorSettingsService; + return RegisteredEditorSettingsPort; } private static UnityCliLoopEditorSessionStateService GetSessionStateService() @@ -452,7 +452,7 @@ private static bool TryGetMajorVersion(string version, out int majorVersion) private CancellationTokenSource _skillInstallStateRefreshCts; private SkillsTarget _skillsTarget = SkillsTarget.Claude; private SkillSetupUseCase _skillSetupUseCase; - private UnityCliLoopEditorSettingsService _editorSettingsService; + private IUnityCliLoopEditorSettingsPort _editorSettingsPort; private void CreateGUI() { @@ -471,7 +471,7 @@ private void CreateGUI() private void InitializeApplicationServices() { _skillSetupUseCase = SkillSetupUseCaseRegistry.GetRegisteredUseCase(); - _editorSettingsService = GetEditorSettingsService(); + _editorSettingsPort = GetEditorSettingsPort(); } private void InitializeFirstInstallSkillsUiState() @@ -610,7 +610,7 @@ private void BindSizeUpdates() private void RefreshAutoShowToggle() { - _suppressAutoShowToggle.SetValueWithoutNotify(_editorSettingsService.GetSuppressSetupWizardAutoShow()); + _suppressAutoShowToggle.SetValueWithoutNotify(_editorSettingsPort.GetSuppressSetupWizardAutoShow()); } private void ApplyInitialCheckingState() @@ -1354,7 +1354,7 @@ private void HandleOpenSettings() private void HandleSuppressAutoShowChanged(bool suppressAutoShow) { - _editorSettingsService.SetSuppressSetupWizardAutoShow(suppressAutoShow); + _editorSettingsPort.SetSuppressSetupWizardAutoShow(suppressAutoShow); MaybeRecordSuppressedSetupWizardState( suppressAutoShow, UnityCliLoopConstants.PackageInfo.version, @@ -1402,7 +1402,7 @@ private void ApplyFlatSkillInstallPreference() { // Claude Code does not resolve nested skill folders, so setup keeps every editor target on the flat layout. _installSkillsFlat = ForceFlatSkillInstall; - _editorSettingsService.SetInstallSkillsFlat(_installSkillsFlat); + _editorSettingsPort.SetInstallSkillsFlat(_installSkillsFlat); } private void ScheduleResizeToContent() diff --git a/Packages/src/Editor/Presentation/UnityCliLoopSettingsModel.cs b/Packages/src/Editor/Presentation/UnityCliLoopSettingsModel.cs index fa002c5efe..585b37b0e2 100644 --- a/Packages/src/Editor/Presentation/UnityCliLoopSettingsModel.cs +++ b/Packages/src/Editor/Presentation/UnityCliLoopSettingsModel.cs @@ -13,26 +13,26 @@ namespace io.github.hatayama.UnityCliLoop.Presentation /// - UnityCliLoopSettingsWindowState: State objects managed by this model /// - UnityCliLoopSettingsWindow: Presenter that uses this model /// - UnityCliLoopSettingsWindowUI: View layer for UI rendering - /// - UnityCliLoopEditorSettingsService: Persistent settings storage boundary + /// - IUnityCliLoopEditorSettingsPort: Persistent settings storage boundary /// public class UnityCliLoopSettingsModel { public UIState UI { get; private set; } public RuntimeState Runtime { get; private set; } private readonly ToolSettingsUseCase _toolSettingsUseCase; - private readonly UnityCliLoopEditorSettingsService _editorSettingsService; + private readonly IUnityCliLoopEditorSettingsPort _editorSettingsPort; internal UnityCliLoopSettingsModel( ToolSettingsUseCase toolSettingsUseCase, - UnityCliLoopEditorSettingsService editorSettingsService) + IUnityCliLoopEditorSettingsPort editorSettingsPort) { System.Diagnostics.Debug.Assert(toolSettingsUseCase != null, "toolSettingsUseCase must not be null"); - System.Diagnostics.Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + System.Diagnostics.Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); _toolSettingsUseCase = toolSettingsUseCase ?? throw new ArgumentNullException(nameof(toolSettingsUseCase)); - _editorSettingsService = editorSettingsService - ?? throw new ArgumentNullException(nameof(editorSettingsService)); + _editorSettingsPort = editorSettingsPort + ?? throw new ArgumentNullException(nameof(editorSettingsPort)); UI = new UIState(); Runtime = new RuntimeState(); } @@ -60,7 +60,7 @@ public void UpdateRuntimeState(Func updater) /// public void LoadFromSettings() { - UnityCliLoopEditorSettingsData settings = _editorSettingsService.GetSettings(); + UnityCliLoopEditorSettingsData settings = _editorSettingsPort.GetSettings(); UpdateUIState(ui => new UIState( mainScrollPosition: ui.MainScrollPosition, @@ -164,7 +164,7 @@ public void UpdateShowUnityCliLoopSecuritySetting(bool show) showUnityCliLoopSecuritySetting: show, showToolSettings: ui.ShowToolSettings, showConfiguration: ui.ShowConfiguration)); - _editorSettingsService.SetShowUnityCliLoopSecuritySetting(show); + _editorSettingsPort.SetShowUnityCliLoopSecuritySetting(show); } public void UpdateShowToolSettings(bool show) @@ -174,7 +174,7 @@ public void UpdateShowToolSettings(bool show) showUnityCliLoopSecuritySetting: ui.ShowUnityCliLoopSecuritySetting, showToolSettings: show, showConfiguration: ui.ShowConfiguration)); - _editorSettingsService.SetShowToolSettings(show); + _editorSettingsPort.SetShowToolSettings(show); } public void UpdateToolEnabled(string toolName, bool enabled) diff --git a/Packages/src/Editor/Presentation/UnityCliLoopSettingsWindow.cs b/Packages/src/Editor/Presentation/UnityCliLoopSettingsWindow.cs index 58fb8aa72a..48ebdb4b80 100644 --- a/Packages/src/Editor/Presentation/UnityCliLoopSettingsWindow.cs +++ b/Packages/src/Editor/Presentation/UnityCliLoopSettingsWindow.cs @@ -31,7 +31,7 @@ internal enum CliPrimaryButtonAction private const double ToolSettingsRegistryWarmupMaxDelaySeconds = 0.8; private const int ToolSettingsRegistryWarmupMaxAttempts = 5; - private static UnityCliLoopEditorSettingsService RegisteredEditorSettingsService; + private static IUnityCliLoopEditorSettingsPort RegisteredEditorSettingsPort; private static UnityCliLoopEditorSessionStateService RegisteredSessionStateService; private UnityCliLoopSettingsWindowUI _view; @@ -39,7 +39,7 @@ internal enum CliPrimaryButtonAction private UnityCliLoopSettingsWindowEventHandler _eventHandler; private SkillSetupUseCase _skillSetupUseCase; private ToolSettingsUseCase _toolSettingsUseCase; - private UnityCliLoopEditorSettingsService _editorSettingsService; + private IUnityCliLoopEditorSettingsPort _editorSettingsPort; private UnityCliLoopEditorSessionStateService _sessionStateService; private SkillsTarget _skillsTarget = SkillsTarget.Claude; @@ -67,14 +67,14 @@ public static void ShowWindow() } internal static void InitializeEditorServices( - UnityCliLoopEditorSettingsService editorSettingsService, + IUnityCliLoopEditorSettingsPort editorSettingsPort, UnityCliLoopEditorSessionStateService sessionStateService) { - System.Diagnostics.Debug.Assert(editorSettingsService != null, "editorSettingsService must not be null"); + System.Diagnostics.Debug.Assert(editorSettingsPort != null, "editorSettingsPort must not be null"); System.Diagnostics.Debug.Assert(sessionStateService != null, "sessionStateService must not be null"); - RegisteredEditorSettingsService = editorSettingsService - ?? throw new ArgumentNullException(nameof(editorSettingsService)); + RegisteredEditorSettingsPort = editorSettingsPort + ?? throw new ArgumentNullException(nameof(editorSettingsPort)); RegisteredSessionStateService = sessionStateService; } @@ -114,14 +114,14 @@ private void InitializeModel() { _model = new UnityCliLoopSettingsModel( _toolSettingsUseCase, - _editorSettingsService); + _editorSettingsPort); } private void InitializeApplicationServices() { _skillSetupUseCase = SkillSetupUseCaseRegistry.GetRegisteredUseCase(); _toolSettingsUseCase = ToolSettingsUseCaseRegistry.GetRegisteredUseCase(); - _editorSettingsService = GetEditorSettingsService(); + _editorSettingsPort = GetEditorSettingsPort(); _sessionStateService = GetSessionStateService(); } @@ -1085,17 +1085,17 @@ private void ApplyFlatSkillInstallPreference() { // Claude Code does not resolve nested skill folders, so editor-driven installs stay flat for every target. _installSkillsFlat = ForceFlatSkillInstall; - _editorSettingsService.SetInstallSkillsFlat(_installSkillsFlat); + _editorSettingsPort.SetInstallSkillsFlat(_installSkillsFlat); } - private static UnityCliLoopEditorSettingsService GetEditorSettingsService() + private static IUnityCliLoopEditorSettingsPort GetEditorSettingsPort() { - if (RegisteredEditorSettingsService == null) + if (RegisteredEditorSettingsPort == null) { - throw new InvalidOperationException("Unity CLI Loop editor settings service is not registered."); + throw new InvalidOperationException("Unity CLI Loop editor settings port is not registered."); } - return RegisteredEditorSettingsService; + return RegisteredEditorSettingsPort; } private static UnityCliLoopEditorSessionStateService GetSessionStateService()