@uofx/cli 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/README.md +159 -3
  2. package/THIRD-PARTY-NOTICES.txt +84 -2
  3. package/dist/application/dtos/config/index.js +22 -0
  4. package/dist/application/dtos/config/request/index.js +19 -0
  5. package/dist/application/dtos/config/request/set-config.request.dto.js +3 -0
  6. package/dist/application/dtos/config/response/get-config.response.dto.js +8 -0
  7. package/dist/application/dtos/config/response/index.js +21 -0
  8. package/dist/application/dtos/dev/index.js +24 -0
  9. package/dist/application/dtos/dev/request/generate-component.request.dto.js +3 -0
  10. package/dist/application/dtos/dev/request/index.js +25 -0
  11. package/dist/application/dtos/dev/request/install-template.request.dto.js +3 -0
  12. package/dist/application/dtos/dev/request/new-project.request.dto.js +3 -0
  13. package/dist/application/dtos/dev/request/publish-plugin.request.dto.js +3 -0
  14. package/dist/application/dtos/dev/request/uninstall-template.request.dto.js +3 -0
  15. package/dist/application/dtos/dev/response/generate-component.response.dto.js +3 -0
  16. package/dist/application/dtos/dev/response/index.js +24 -0
  17. package/dist/application/dtos/dev/response/new-project.response.dto.js +3 -0
  18. package/dist/application/dtos/dev/response/publish-plugin.response.dto.js +3 -0
  19. package/dist/application/dtos/dev/response/template-info.response.dto.js +3 -0
  20. package/dist/application/dtos/env/index.js +24 -0
  21. package/dist/application/dtos/{request → env/request}/index.js +1 -3
  22. package/dist/application/dtos/env/request/list-running-instances.request.dto.js +3 -0
  23. package/dist/application/dtos/{response → env/response}/index.js +1 -1
  24. package/dist/application/dtos/env/response/list-running-instances.response.dto.js +3 -0
  25. package/dist/application/dtos/index.js +9 -2
  26. package/dist/application/dtos/logs/index.js +22 -0
  27. package/dist/application/dtos/logs/request/index.js +18 -0
  28. package/dist/application/dtos/logs/response/index.js +18 -0
  29. package/dist/application/index.js +1 -0
  30. package/dist/application/services/env/environment-validator.service.js +120 -0
  31. package/dist/application/services/env/index.js +11 -0
  32. package/dist/application/services/env/instance-cleanup.service.js +79 -0
  33. package/dist/application/services/index.js +21 -0
  34. package/dist/application/use-cases/config/get-all-config.use-case.js +54 -0
  35. package/dist/application/use-cases/config/get-config.use-case.js +7 -17
  36. package/dist/application/use-cases/config/index.js +23 -0
  37. package/dist/application/use-cases/config/set-config.use-case.js +49 -3
  38. package/dist/application/use-cases/dev/generate-component.use-case.js +138 -0
  39. package/dist/application/use-cases/dev/index.js +28 -0
  40. package/dist/application/use-cases/dev/install-template.use-case.js +60 -0
  41. package/dist/application/use-cases/dev/list-templates.use-case.js +45 -0
  42. package/dist/application/use-cases/dev/new-project.use-case.js +130 -0
  43. package/dist/application/use-cases/dev/publish-plugin.use-case.js +243 -0
  44. package/dist/application/use-cases/dev/uninstall-template.use-case.js +50 -0
  45. package/dist/application/use-cases/{instance → env}/delete-instance.use-case.js +2 -2
  46. package/dist/application/use-cases/{credentials → env}/get-credentials.use-case.js +1 -1
  47. package/dist/application/use-cases/{instance → env}/index.js +11 -0
  48. package/dist/application/use-cases/{instance → env}/install-instance.use-case.js +25 -136
  49. package/dist/application/use-cases/env/list-running-instances.use-case.js +47 -0
  50. package/dist/application/use-cases/{setup → env}/setup-environment.use-case.js +35 -4
  51. package/dist/application/use-cases/{instance → env}/start-instance.use-case.js +53 -41
  52. package/dist/application/use-cases/index.js +9 -6
  53. package/dist/application/use-cases/logs/index.js +21 -0
  54. package/dist/cli.js +175 -26
  55. package/dist/constants/defaults.js +8 -1
  56. package/dist/constants/oci-artifacts.js +4 -0
  57. package/dist/constants/paths.js +0 -4
  58. package/dist/constants/timeouts.js +5 -0
  59. package/dist/di/modules/application.module.js +13 -44
  60. package/dist/di/modules/config.module.js +19 -0
  61. package/dist/di/modules/dev.module.js +45 -0
  62. package/dist/di/modules/env.module.js +42 -0
  63. package/dist/di/modules/index.js +30 -0
  64. package/dist/di/modules/infrastructure.module.js +65 -82
  65. package/dist/di/modules/logs.module.js +15 -0
  66. package/dist/di/modules/presentation.module.js +18 -7
  67. package/dist/di/tokens.js +42 -30
  68. package/dist/domain/entities/credentials-resolver.entity.js +4 -1
  69. package/dist/domain/entities/credentials.entity.js +2 -5
  70. package/dist/domain/entities/delete-instance-validation.entity.js +4 -1
  71. package/dist/domain/entities/deployment-parameters.entity.js +11 -8
  72. package/dist/domain/entities/index.js +5 -1
  73. package/dist/domain/entities/instance-list-aggregator.entity.js +2 -2
  74. package/dist/domain/entities/instance-metadata.entity.js +2 -3
  75. package/dist/domain/entities/instance.entity.js +2 -1
  76. package/dist/domain/entities/log-filter.entity.js +6 -6
  77. package/dist/domain/entities/template-info.entity.js +63 -0
  78. package/dist/{infrastructure/utils/error-formatter.util.js → domain/errors/error-utils.js} +1 -1
  79. package/dist/domain/errors/index.js +19 -0
  80. package/dist/domain/index.js +6 -0
  81. package/dist/domain/interfaces/index.js +21 -0
  82. package/dist/domain/ports/dotnet-publisher.port.js +9 -0
  83. package/dist/{infrastructure/http/interfaces/http-client.interface.js → domain/ports/file-system.port.js} +1 -1
  84. package/dist/domain/ports/http-client.port.js +3 -0
  85. package/dist/domain/ports/index.js +10 -0
  86. package/dist/domain/ports/logger.port.js +3 -3
  87. package/dist/domain/ports/progress.port.js +10 -0
  88. package/dist/domain/ports/project-scaffolder.port.js +9 -0
  89. package/dist/domain/ports/schematics-runner.port.js +9 -0
  90. package/dist/domain/ports/template-manager.port.js +9 -0
  91. package/dist/domain/ports/wsl-setup.port.js +3 -0
  92. package/dist/domain/types/index.js +1 -0
  93. package/dist/domain/value-objects/acr-credentials.value-object.js +13 -1
  94. package/dist/domain/value-objects/chart-version.value-object.js +20 -3
  95. package/dist/domain/value-objects/config-log-level.value-object.js +2 -1
  96. package/dist/domain/value-objects/index.js +3 -1
  97. package/dist/domain/value-objects/instance-name.value-object.js +6 -3
  98. package/dist/domain/value-objects/jwt-key.value-object.js +27 -5
  99. package/dist/domain/value-objects/mssql-password.value-object.js +27 -5
  100. package/dist/domain/value-objects/output-path.value-object.js +85 -0
  101. package/dist/domain/value-objects/rsa-key-pair.value-object.js +29 -3
  102. package/dist/index.js +6 -1
  103. package/dist/infrastructure/config/{app-config.service.js → app-config.adapter.js} +29 -17
  104. package/dist/infrastructure/config/{config-validator.js → config-validator.util.js} +1 -1
  105. package/dist/infrastructure/config/index.js +14 -0
  106. package/dist/infrastructure/config/interfaces/index.js +3 -0
  107. package/dist/infrastructure/config/{crypto.service.js → services/crypto.service.js} +4 -1
  108. package/dist/infrastructure/config/services/index.js +9 -0
  109. package/dist/infrastructure/deployment/deployment.adapter.js +5 -5
  110. package/dist/infrastructure/deployment/index.js +9 -0
  111. package/dist/infrastructure/deployment/interfaces/index.js +3 -0
  112. package/dist/infrastructure/deployment/services/acr-credential-manager.service.js +18 -7
  113. package/dist/infrastructure/deployment/services/app-manager.service.js +3 -3
  114. package/dist/infrastructure/deployment/services/base-helm-deployment.service.js +13 -5
  115. package/dist/infrastructure/deployment/services/helm-registry.service.js +10 -3
  116. package/dist/infrastructure/deployment/services/index.js +35 -0
  117. package/dist/infrastructure/deployment/services/infra-manager.service.js +19 -15
  118. package/dist/infrastructure/deployment/services/k8s-job-runner.service.js +24 -6
  119. package/dist/infrastructure/deployment/services/mssql-database-init.service.js +75 -11
  120. package/dist/infrastructure/deployment/services/mssql-helm-deployment.service.js +17 -5
  121. package/dist/infrastructure/deployment/services/mssql-storage.service.js +5 -1
  122. package/dist/infrastructure/deployment/services/mssql-user-manager.service.js +7 -3
  123. package/dist/infrastructure/deployment/services/oci-artifact.service.js +8 -3
  124. package/dist/infrastructure/deployment/services/secret-manager.service.js +14 -5
  125. package/dist/infrastructure/deployment/services/service-manager.service.js +1 -1
  126. package/dist/infrastructure/deployment/services/version-compatibility.service.js +9 -5
  127. package/dist/infrastructure/dotnet/dotnet-publisher.adapter.js +143 -0
  128. package/dist/infrastructure/dotnet/index.js +9 -0
  129. package/dist/infrastructure/environment/index.js +11 -0
  130. package/dist/infrastructure/environment/interfaces/index.js +3 -0
  131. package/dist/infrastructure/{platform-detector.js → environment/platform-detector.util.js} +1 -1
  132. package/dist/infrastructure/environment/services/hardware-info.service.js +8 -8
  133. package/dist/infrastructure/environment/services/index.js +11 -0
  134. package/dist/infrastructure/errors/{error-handler.js → error-handler.adapter.js} +17 -17
  135. package/dist/infrastructure/errors/index.js +5 -21
  136. package/dist/infrastructure/execution/builders/base-command.builder.js +32 -11
  137. package/dist/infrastructure/execution/builders/index.js +26 -0
  138. package/dist/infrastructure/execution/builders/wsl-command.builder.js +39 -1
  139. package/dist/infrastructure/execution/command-builder.util.js +94 -0
  140. package/dist/infrastructure/execution/environments/index.js +23 -0
  141. package/dist/infrastructure/execution/environments/wsl-execution.environment.js +22 -7
  142. package/dist/infrastructure/execution/index.js +1 -2
  143. package/dist/infrastructure/execution/services/command-executor.service.js +389 -0
  144. package/dist/infrastructure/execution/services/index.js +8 -0
  145. package/dist/infrastructure/execution/{script-executor.service.js → services/script-executor.service.js} +12 -15
  146. package/dist/infrastructure/filesystem/filesystem.adapter.js +86 -0
  147. package/dist/infrastructure/filesystem/index.js +23 -0
  148. package/dist/infrastructure/http/{http-client.service.js → http-client.adapter.js} +20 -13
  149. package/dist/infrastructure/http/index.js +1 -1
  150. package/dist/infrastructure/interceptors/decorators/index.js +23 -0
  151. package/dist/infrastructure/interceptors/index.js +2 -2
  152. package/dist/infrastructure/interceptors/interceptor.factory.js +3 -3
  153. package/dist/infrastructure/interceptors/interfaces/index.js +3 -0
  154. package/dist/infrastructure/interceptors/services/index.js +6 -0
  155. package/dist/infrastructure/interceptors/{logging.interceptor.js → services/logging-interceptor.service.js} +4 -4
  156. package/dist/infrastructure/logger/services/file-log-reader.repository.js +1 -1
  157. package/dist/infrastructure/logger/services/file-log-writer.repository.js +1 -1
  158. package/dist/infrastructure/persistence/instance-metadata.adapter.js +2 -1
  159. package/dist/infrastructure/persistence/services/file-system-config.repository.js +10 -4
  160. package/dist/infrastructure/persistence/services/file-system-instance.repository.js +2 -2
  161. package/dist/infrastructure/platforms/index.js +18 -0
  162. package/dist/infrastructure/platforms/windows/index.js +13 -0
  163. package/dist/infrastructure/platforms/windows/interfaces/index.js +3 -0
  164. package/dist/infrastructure/platforms/windows/parsers/index.js +9 -0
  165. package/dist/infrastructure/platforms/windows/services/index.js +33 -0
  166. package/dist/infrastructure/platforms/windows/services/microk8s.service.js +28 -10
  167. package/dist/infrastructure/platforms/windows/services/rootfs-manager.service.js +7 -3
  168. package/dist/infrastructure/platforms/windows/services/windows-features.service.js +22 -8
  169. package/dist/infrastructure/platforms/windows/services/windows-info.service.js +10 -6
  170. package/dist/infrastructure/platforms/windows/services/wsl-config.service.js +15 -6
  171. package/dist/infrastructure/platforms/windows/services/wsl-info.service.js +12 -12
  172. package/dist/infrastructure/platforms/windows/services/wsl-instance-inspection.service.js +3 -3
  173. package/dist/infrastructure/platforms/windows/services/wsl-instance-lifecycle.service.js +76 -22
  174. package/dist/infrastructure/platforms/windows/services/wsl-updater.service.js +20 -15
  175. package/dist/infrastructure/platforms/windows/services/wslconfig-parser.service.js +3 -3
  176. package/dist/infrastructure/platforms/windows/wsl-instance-manager.adapter.js +8 -3
  177. package/dist/infrastructure/platforms/windows/wsl-setup.adapter.js +100 -0
  178. package/dist/infrastructure/schematics/index.js +11 -0
  179. package/dist/infrastructure/schematics/project-scaffolder.adapter.js +314 -0
  180. package/dist/infrastructure/schematics/schematics-runner.adapter.js +175 -0
  181. package/dist/infrastructure/template/index.js +25 -0
  182. package/dist/infrastructure/template/interfaces/index.js +22 -0
  183. package/dist/infrastructure/template/interfaces/template-downloader.interface.js +6 -0
  184. package/dist/infrastructure/template/interfaces/template-registry.interface.js +6 -0
  185. package/dist/infrastructure/template/services/index.js +24 -0
  186. package/dist/infrastructure/template/services/template-downloader.service.js +319 -0
  187. package/dist/infrastructure/template/services/template-registry.service.js +175 -0
  188. package/dist/infrastructure/template/template-manager.adapter.js +196 -0
  189. package/dist/infrastructure/utils/index.js +23 -0
  190. package/dist/infrastructure/utils/input-validator.util.js +7 -6
  191. package/dist/presentation/controllers/base.controller.js +36 -0
  192. package/dist/presentation/controllers/{config.controller.js → config/config.controller.js} +17 -62
  193. package/dist/presentation/controllers/config/index.js +21 -0
  194. package/dist/presentation/controllers/dev/dev.controller.js +202 -0
  195. package/dist/presentation/controllers/dev/index.js +23 -0
  196. package/dist/presentation/controllers/dev/template.controller.js +158 -0
  197. package/dist/presentation/controllers/{credentials.controller.js → env/credentials.controller.js} +8 -14
  198. package/dist/presentation/controllers/env/index.js +23 -0
  199. package/dist/presentation/controllers/{instance.controller.js → env/instance.controller.js} +35 -92
  200. package/dist/presentation/controllers/{setup.controller.js → env/setup.controller.js} +33 -66
  201. package/dist/presentation/controllers/index.js +9 -5
  202. package/dist/presentation/controllers/logs/index.js +21 -0
  203. package/dist/presentation/controllers/{logs.controller.js → logs/logs.controller.js} +8 -14
  204. package/dist/presentation/interfaces/index.js +21 -0
  205. package/dist/presentation/prompts/acr-credentials.prompt.js +37 -9
  206. package/dist/presentation/ui/constants/index.js +23 -0
  207. package/dist/presentation/ui/interaction.service.js +4 -4
  208. package/dist/presentation/ui/interfaces/cli-progress.interface.js +0 -6
  209. package/dist/presentation/ui/interfaces/index.js +6 -0
  210. package/package.json +6 -1
  211. package/dist/application/dtos/request/set-config.request.dto.js +0 -16
  212. package/dist/infrastructure/errors/error-handler.interface.js +0 -3
  213. package/dist/infrastructure/execution/command-builder.js +0 -252
  214. package/dist/infrastructure/execution/command-executor.service.js +0 -230
  215. /package/dist/application/dtos/{request → config/request}/get-config.request.dto.js +0 -0
  216. /package/dist/application/dtos/{request → env/request}/delete-instance.request.dto.js +0 -0
  217. /package/dist/application/dtos/{request → env/request}/get-credentials.request.dto.js +0 -0
  218. /package/dist/application/dtos/{request → env/request}/install-instance.request.dto.js +0 -0
  219. /package/dist/application/dtos/{request → env/request}/list-charts.request.dto.js +0 -0
  220. /package/dist/application/dtos/{request → env/request}/setup-environment.request.dto.js +0 -0
  221. /package/dist/application/dtos/{request → env/request}/start-instance.request.dto.js +0 -0
  222. /package/dist/application/dtos/{request → env/request}/stop-instance.request.dto.js +0 -0
  223. /package/dist/application/dtos/{response → env/response}/credentials.response.dto.js +0 -0
  224. /package/dist/application/dtos/{response → env/response}/delete-instance.response.dto.js +0 -0
  225. /package/dist/application/dtos/{response → env/response}/install-instance.response.dto.js +0 -0
  226. /package/dist/application/dtos/{response → env/response}/instance-list.response.dto.js +0 -0
  227. /package/dist/application/dtos/{response → env/response}/instance-status.response.dto.js +0 -0
  228. /package/dist/application/dtos/{response → env/response}/setup-result.response.dto.js +0 -0
  229. /package/dist/application/dtos/{response → env/response}/start-instance.response.dto.js +0 -0
  230. /package/dist/application/dtos/{response → env/response}/stop-instance.response.dto.js +0 -0
  231. /package/dist/application/dtos/{request → logs/request}/show-logs.request.dto.js +0 -0
  232. /package/dist/application/dtos/{response → logs/response}/show-logs.response.dto.js +0 -0
  233. /package/dist/application/use-cases/{instance → env}/list-charts.use-case.js +0 -0
  234. /package/dist/application/use-cases/{instance → env}/list-instances.use-case.js +0 -0
  235. /package/dist/application/use-cases/{instance → env}/stop-instance.use-case.js +0 -0
  236. /package/dist/{infrastructure → domain}/errors/app-error.js +0 -0
  237. /package/dist/{infrastructure → domain}/errors/exit-codes.js +0 -0
  238. /package/dist/infrastructure/config/{app-config.interface.js → interfaces/app-config.interface.js} +0 -0
  239. /package/dist/{domain → infrastructure/interceptors}/decorators/sensitive.decorator.js +0 -0
  240. /package/dist/infrastructure/interceptors/{interceptor.interface.js → interfaces/interceptor.interface.js} +0 -0
@@ -3,70 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registerInfrastructureModule = registerInfrastructureModule;
4
4
  const tsyringe_1 = require("tsyringe");
5
5
  const tokens_1 = require("../tokens");
6
- const platform_detector_1 = require("../../infrastructure/platform-detector");
6
+ const errors_1 = require("../../domain/errors");
7
+ const platform_detector_util_1 = require("../../infrastructure/environment/platform-detector.util");
7
8
  // ===== Adapters (Domain Ports 實作) =====
8
9
  const wsl_instance_manager_adapter_1 = require("../../infrastructure/platforms/windows/wsl-instance-manager.adapter");
9
10
  const wsl_base_image_adapter_1 = require("../../infrastructure/platforms/windows/wsl-base-image.adapter");
11
+ const wsl_setup_adapter_1 = require("../../infrastructure/platforms/windows/wsl-setup.adapter");
10
12
  const deployment_adapter_1 = require("../../infrastructure/deployment/deployment.adapter");
11
13
  const user_settings_adapter_1 = require("../../infrastructure/persistence/user-settings.adapter");
12
14
  const instance_storage_adapter_1 = require("../../infrastructure/persistence/instance-storage.adapter");
13
15
  const logger_adapter_1 = require("../../infrastructure/logger/logger.adapter");
14
16
  const windows_environment_adapter_1 = require("../../infrastructure/environment/windows-environment.adapter");
15
17
  // ===== Internal Services - Windows/WSL =====
16
- const wsl_info_service_1 = require("../../infrastructure/platforms/windows/services/wsl-info.service");
17
- const wsl_config_service_1 = require("../../infrastructure/platforms/windows/services/wsl-config.service");
18
- const wsl_updater_service_1 = require("../../infrastructure/platforms/windows/services/wsl-updater.service");
19
- const rootfs_manager_service_1 = require("../../infrastructure/platforms/windows/services/rootfs-manager.service");
20
- const microk8s_service_1 = require("../../infrastructure/platforms/windows/services/microk8s.service");
21
- // ===== WSL 子服務 (取代 WslManagerService) =====
22
- const wsl_instance_naming_service_1 = require("../../infrastructure/platforms/windows/services/wsl-instance-naming.service");
23
- const wsl_instance_lifecycle_service_1 = require("../../infrastructure/platforms/windows/services/wsl-instance-lifecycle.service");
24
- const wsl_instance_inspection_service_1 = require("../../infrastructure/platforms/windows/services/wsl-instance-inspection.service");
18
+ const services_1 = require("../../infrastructure/platforms/windows/services");
25
19
  // ===== Internal Services - Persistence =====
26
20
  const instance_metadata_adapter_1 = require("../../infrastructure/persistence/instance-metadata.adapter");
27
21
  // ===== Internal Services - Environment (平台無關) =====
28
- const network_checker_service_1 = require("../../infrastructure/environment/services/network-checker.service");
29
- const hardware_info_service_1 = require("../../infrastructure/environment/services/hardware-info.service");
30
- // ===== Internal Services - Windows Platform =====
31
- const windows_info_service_1 = require("../../infrastructure/platforms/windows/services/windows-info.service");
32
- const windows_features_service_1 = require("../../infrastructure/platforms/windows/services/windows-features.service");
33
- const wslconfig_parser_service_1 = require("../../infrastructure/platforms/windows/services/wslconfig-parser.service");
22
+ const services_2 = require("../../infrastructure/environment/services");
34
23
  // ===== Internal Services - Deployment =====
35
- const helm_registry_service_1 = require("../../infrastructure/deployment/services/helm-registry.service");
36
- const secret_manager_service_1 = require("../../infrastructure/deployment/services/secret-manager.service");
37
- const version_compatibility_service_1 = require("../../infrastructure/deployment/services/version-compatibility.service");
38
- const oci_artifact_service_1 = require("../../infrastructure/deployment/services/oci-artifact.service");
39
- const infra_manager_service_1 = require("../../infrastructure/deployment/services/infra-manager.service");
40
- const service_manager_service_1 = require("../../infrastructure/deployment/services/service-manager.service");
41
- const app_manager_service_1 = require("../../infrastructure/deployment/services/app-manager.service");
42
- // ===== MSSQL 子服務 (取代 MssqlManagerService) =====
43
- const mssql_helm_deployment_service_1 = require("../../infrastructure/deployment/services/mssql-helm-deployment.service");
44
- const mssql_storage_service_1 = require("../../infrastructure/deployment/services/mssql-storage.service");
45
- const mssql_database_init_service_1 = require("../../infrastructure/deployment/services/mssql-database-init.service");
46
- const mssql_user_manager_service_1 = require("../../infrastructure/deployment/services/mssql-user-manager.service");
47
- const k8s_job_runner_service_1 = require("../../infrastructure/deployment/services/k8s-job-runner.service");
24
+ const services_3 = require("../../infrastructure/deployment/services");
48
25
  // ===== Internal Services - Persistence =====
49
- const file_system_instance_repository_1 = require("../../infrastructure/persistence/services/file-system-instance.repository");
50
- const file_system_config_repository_1 = require("../../infrastructure/persistence/services/file-system-config.repository");
26
+ const services_4 = require("../../infrastructure/persistence/services");
51
27
  // ===== Internal Services - Logger =====
52
- const file_log_writer_repository_1 = require("../../infrastructure/logger/services/file-log-writer.repository");
53
- const file_log_reader_repository_1 = require("../../infrastructure/logger/services/file-log-reader.repository");
28
+ const services_5 = require("../../infrastructure/logger/services");
54
29
  const correlation_id_adapter_1 = require("../../infrastructure/logger/correlation-id.adapter");
55
30
  // ===== Internal Services - Execution =====
56
- const command_executor_service_1 = require("../../infrastructure/execution/command-executor.service");
57
- const script_executor_service_1 = require("../../infrastructure/execution/script-executor.service");
31
+ const services_6 = require("../../infrastructure/execution/services");
58
32
  const execution_environment_factory_1 = require("../../infrastructure/execution/execution-environment.factory");
59
33
  const host_command_builder_1 = require("../../infrastructure/execution/builders/host-command.builder");
60
34
  const windows_host_command_builder_1 = require("../../infrastructure/execution/builders/windows-host-command.builder");
61
35
  const environments_1 = require("../../constants/environments");
62
36
  // ===== Internal Services - HTTP =====
63
- const http_client_service_1 = require("../../infrastructure/http/http-client.service");
37
+ const http_client_adapter_1 = require("../../infrastructure/http/http-client.adapter");
38
+ // ===== FileSystem Adapter =====
39
+ const filesystem_adapter_1 = require("../../infrastructure/filesystem/filesystem.adapter");
64
40
  // ===== Internal Services - Config =====
65
- const app_config_service_1 = require("../../infrastructure/config/app-config.service");
41
+ const app_config_adapter_1 = require("../../infrastructure/config/app-config.adapter");
66
42
  // ===== Internal Services - Error Handling =====
67
- const error_handler_1 = require("../../infrastructure/errors/error-handler");
68
- // ===== Internal Services - ACR Credentials (merged into Deployment) =====
69
- const acr_credential_manager_service_1 = require("../../infrastructure/deployment/services/acr-credential-manager.service");
43
+ const error_handler_adapter_1 = require("../../infrastructure/errors/error-handler.adapter");
70
44
  /**
71
45
  * 註冊 Infrastructure 模組
72
46
  *
@@ -77,19 +51,21 @@ const acr_credential_manager_service_1 = require("../../infrastructure/deploymen
77
51
  * - 特別是 VersionCompatibilityService 依賴 HttpClient, AppConfig, AcrCredentialManager
78
52
  */
79
53
  function registerInfrastructureModule() {
80
- const platform = (0, platform_detector_1.detectPlatform)();
54
+ const platform = (0, platform_detector_util_1.detectPlatform)();
81
55
  // =========================================================================
82
56
  // 第 1 層:基礎服務(無外部依賴或僅依賴 Node.js 內建模組)
83
57
  // =========================================================================
84
58
  // Node.js Process(用於信號處理)
85
59
  tsyringe_1.container.registerInstance(tokens_1.TOKENS.Internal.Process, process);
86
60
  // Logger 底層服務(無依賴)
87
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileLogWriter, file_log_writer_repository_1.FileLogWriterRepository);
88
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileLogReader, file_log_reader_repository_1.FileLogReaderRepository);
61
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileLogWriter, services_5.FileLogWriterRepository);
62
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileLogReader, services_5.FileLogReaderRepository);
89
63
  // HTTP 客戶端(無依賴)
90
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.HttpClientService, http_client_service_1.HttpClientService);
64
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHttpClient, http_client_adapter_1.HttpClientAdapter);
65
+ // Domain Port 映射
66
+ tsyringe_1.container.register(tokens_1.TOKENS.IHttpClientPort, { useToken: tokens_1.TOKENS.Internal.IHttpClient });
91
67
  // 執行器服務(無依賴)
92
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.CommandExecutorService, command_executor_service_1.CommandExecutorService);
68
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ICommandExecutor, services_6.CommandExecutorService);
93
69
  // 主機命令建構器(根據平台註冊對應實作)
94
70
  if (process.platform === environments_1.PLATFORM_TYPES.WINDOWS) {
95
71
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHostCommandBuilder, windows_host_command_builder_1.WindowsHostCommandBuilder);
@@ -97,7 +73,7 @@ function registerInfrastructureModule() {
97
73
  else {
98
74
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHostCommandBuilder, host_command_builder_1.HostCommandBuilder);
99
75
  }
100
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ExecutionEnvironmentFactory, execution_environment_factory_1.ExecutionEnvironmentFactory);
76
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IExecutionEnvironmentFactory, execution_environment_factory_1.ExecutionEnvironmentFactory);
101
77
  // =========================================================================
102
78
  // 第 2 層:Logger Port(依賴 FileLogWriter, FileLogReader)
103
79
  // =========================================================================
@@ -106,76 +82,78 @@ function registerInfrastructureModule() {
106
82
  // =========================================================================
107
83
  // 第 3 層:Config 服務(依賴 Logger)
108
84
  // =========================================================================
109
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.AppConfig, app_config_service_1.AppConfig);
110
- // 公開 token 映射
111
- tsyringe_1.container.register(tokens_1.TOKENS.IAppConfig, { useToken: tokens_1.TOKENS.Internal.AppConfig });
112
- // Domain Port 映射(AppConfig 同時實作 IAppConfig 和 IAppConfigPort)
85
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.AppConfig, app_config_adapter_1.AppConfigAdapter);
86
+ // Domain Port 映射
113
87
  tsyringe_1.container.register(tokens_1.TOKENS.IAppConfigPort, { useToken: tokens_1.TOKENS.Internal.AppConfig });
114
88
  // =========================================================================
115
89
  // 第 4 層:錯誤處理(依賴 Logger, Config)
116
90
  // =========================================================================
117
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ErrorHandler, error_handler_1.ErrorHandler);
91
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ErrorHandler, error_handler_adapter_1.ErrorHandlerAdapter);
118
92
  // Domain Port 映射
119
93
  tsyringe_1.container.register(tokens_1.TOKENS.IErrorHandlerPort, { useToken: tokens_1.TOKENS.Internal.ErrorHandler });
120
94
  // =========================================================================
121
95
  // 第 5 層:ACR 憑證管理(依賴 AppConfig)
122
96
  // =========================================================================
123
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.AcrCredentialManager, acr_credential_manager_service_1.AcrCredentialManagerService);
97
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IAcrCredentialManager, services_3.AcrCredentialManagerService);
124
98
  // =========================================================================
125
99
  // 第 6 層:版本相容性服務(依賴 HttpClient, AppConfig, AcrCredentialManager, Logger)
126
100
  // =========================================================================
127
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.VersionCompatibilityService, version_compatibility_service_1.VersionCompatibilityService);
101
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.VersionCompatibilityService, services_3.VersionCompatibilityService);
128
102
  // =========================================================================
129
103
  // 第 6.5 層:OCI Artifact 服務(依賴 HttpClient, AppConfig, ExecutionEnvironmentFactory, Logger)
130
104
  // =========================================================================
131
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IOciArtifactService, oci_artifact_service_1.OciArtifactService);
105
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IOciArtifactService, services_3.OciArtifactService);
132
106
  // =========================================================================
133
107
  // 第 7 層:其他部署相關服務
134
108
  // =========================================================================
135
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.HelmRegistryService, helm_registry_service_1.HelmRegistryService);
136
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.SecretManagerService, secret_manager_service_1.SecretManagerService);
137
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.InfraManagerService, infra_manager_service_1.InfraManagerService);
138
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ServiceManagerService, service_manager_service_1.ServiceManagerService);
139
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.AppManagerService, app_manager_service_1.AppManagerService);
109
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHelmRegistry, services_3.HelmRegistryService);
110
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ISecretManager, services_3.SecretManagerService);
111
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IInfraManager, services_3.InfraManagerService);
112
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IServiceManager, services_3.ServiceManagerService);
113
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IAppManager, services_3.AppManagerService);
140
114
  // MSSQL 子服務(取代 MssqlManagerService)
141
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlStorage, mssql_storage_service_1.MssqlStorageService);
142
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlDatabaseInit, mssql_database_init_service_1.MssqlDatabaseInitService);
143
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlUserManager, mssql_user_manager_service_1.MssqlUserManagerService);
144
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IK8sJobRunner, k8s_job_runner_service_1.K8sJobRunnerService);
145
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlHelmDeployment, mssql_helm_deployment_service_1.MssqlHelmDeploymentService);
115
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlStorage, services_3.MssqlStorageService);
116
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlDatabaseInit, services_3.MssqlDatabaseInitService);
117
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlUserManager, services_3.MssqlUserManagerService);
118
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IK8sJobRunner, services_3.K8sJobRunnerService);
119
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMssqlHelmDeployment, services_3.MssqlHelmDeploymentService);
146
120
  // =========================================================================
147
121
  // 第 8 層:Script 執行器(依賴 CommandExecutor)
148
122
  // =========================================================================
149
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ScriptExecutorService, script_executor_service_1.ScriptExecutorService);
123
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.ScriptExecutorService, services_6.ScriptExecutorService);
124
+ // =========================================================================
125
+ // 第 8.5 層:FileSystem Port
126
+ // =========================================================================
127
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IFileSystemPort, filesystem_adapter_1.FileSystemAdapter);
150
128
  // =========================================================================
151
129
  // 第 9 層:Persistence 服務
152
130
  // =========================================================================
153
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileInstanceRepository, file_system_instance_repository_1.FileSystemInstanceRepository);
154
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileConfigRepository, file_system_config_repository_1.FileSystemConfigRepository);
131
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileInstanceRepository, services_4.FileSystemInstanceRepository);
132
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.FileConfigRepository, services_4.FileSystemConfigRepository);
155
133
  // =========================================================================
156
134
  // 第 10 層:System 服務(平台無關)
157
135
  // =========================================================================
158
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.NetworkCheckerService, network_checker_service_1.NetworkCheckerService);
159
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHardwareInfo, hardware_info_service_1.HardwareInfoService);
136
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.NetworkCheckerService, services_2.NetworkCheckerService);
137
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IHardwareInfo, services_2.HardwareInfoService);
160
138
  // =========================================================================
161
139
  // 第 11 層:Platform-Specific 服務(Windows/WSL)
162
140
  // =========================================================================
163
141
  if (platform === 'windows') {
164
142
  // Windows 系統資源服務
165
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WindowsInfoService, windows_info_service_1.WindowsInfoService);
166
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WindowsFeaturesService, windows_features_service_1.WindowsFeaturesService);
143
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WindowsInfoService, services_1.WindowsInfoService);
144
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WindowsFeaturesService, services_1.WindowsFeaturesService);
167
145
  // WSL 相關服務
168
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WslInfoService, wsl_info_service_1.WslInfoService);
169
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslConfigParser, wslconfig_parser_service_1.WslConfigParserService);
146
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WslInfoService, services_1.WslInfoService);
147
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslConfigParser, services_1.WslConfigParserService);
170
148
  // WSL 子服務(取代 WslManagerService)
171
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceNaming, wsl_instance_naming_service_1.WslInstanceNamingService);
172
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceInspection, wsl_instance_inspection_service_1.WslInstanceInspectionService);
173
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceLifecycle, wsl_instance_lifecycle_service_1.WslInstanceLifecycleService);
149
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceNaming, services_1.WslInstanceNamingService);
150
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceInspection, services_1.WslInstanceInspectionService);
151
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslInstanceLifecycle, services_1.WslInstanceLifecycleService);
174
152
  // 其他 WSL 相關服務
175
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WslConfigService, wsl_config_service_1.WslConfigService);
176
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WslUpdaterService, wsl_updater_service_1.WslUpdaterService);
177
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.RootfsManagerService, rootfs_manager_service_1.RootfsManagerService);
178
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.MicroK8sService, microk8s_service_1.MicroK8sService);
153
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IWslConfig, services_1.WslConfigService);
154
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.WslUpdaterService, services_1.WslUpdaterService);
155
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.RootfsManagerService, services_1.RootfsManagerService);
156
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.Internal.IMicroK8s, services_1.MicroK8sService);
179
157
  }
180
158
  // =========================================================================
181
159
  // 第 12 層:Domain Ports - Adapters(依賴上述所有服務)
@@ -185,13 +163,18 @@ function registerInfrastructureModule() {
185
163
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IInstanceManagerPort, wsl_instance_manager_adapter_1.WslInstanceManagerAdapter);
186
164
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IBaseImagePort, wsl_base_image_adapter_1.WslBaseImageAdapter);
187
165
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IRuntimeEnvironmentPort, windows_environment_adapter_1.WindowsEnvironmentAdapter);
166
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IWslSetupPort, wsl_setup_adapter_1.WslSetupAdapter);
188
167
  }
189
168
  else if (platform === 'linux') {
190
169
  // Linux/Docker 平台(未來實作)
191
- throw new Error('Linux platform not yet implemented');
170
+ throw new errors_1.AppError('Linux platform not yet implemented', {
171
+ exitCode: errors_1.EXIT_CODES.ENVIRONMENT_ERROR,
172
+ });
192
173
  }
193
174
  else {
194
- throw new Error(`Unsupported platform: ${platform}`);
175
+ throw new errors_1.AppError(`Unsupported platform: ${platform}`, {
176
+ exitCode: errors_1.EXIT_CODES.ENVIRONMENT_ERROR,
177
+ });
195
178
  }
196
179
  // 共用 Ports(跨平台)
197
180
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IDeploymentPort, deployment_adapter_1.DeploymentAdapter);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerLogsModule = registerLogsModule;
4
+ const tsyringe_1 = require("tsyringe");
5
+ const tokens_1 = require("../tokens");
6
+ // Logs Use Cases
7
+ const show_logs_use_case_1 = require("../../application/use-cases/logs/show-logs.use-case");
8
+ /**
9
+ * Logs Module
10
+ * 註冊 logs 指令群組的 Use Cases
11
+ */
12
+ function registerLogsModule() {
13
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.ShowLogsUseCase, show_logs_use_case_1.ShowLogsUseCase);
14
+ }
15
+ //# sourceMappingURL=logs.module.js.map
@@ -10,22 +10,33 @@ const interaction_service_1 = require("../../presentation/ui/interaction.service
10
10
  const cli_progress_service_1 = require("../../presentation/ui/cli-progress.service");
11
11
  // Prompts
12
12
  const acr_credentials_prompt_1 = require("../../presentation/prompts/acr-credentials.prompt");
13
- // Controllers
14
- const instance_controller_1 = require("../../presentation/controllers/instance.controller");
15
- const setup_controller_1 = require("../../presentation/controllers/setup.controller");
16
- const config_controller_1 = require("../../presentation/controllers/config.controller");
17
- const logs_controller_1 = require("../../presentation/controllers/logs.controller");
18
- const credentials_controller_1 = require("../../presentation/controllers/credentials.controller");
13
+ // Controllers - Env
14
+ const instance_controller_1 = require("../../presentation/controllers/env/instance.controller");
15
+ const setup_controller_1 = require("../../presentation/controllers/env/setup.controller");
16
+ const credentials_controller_1 = require("../../presentation/controllers/env/credentials.controller");
17
+ // Controllers - Config
18
+ const config_controller_1 = require("../../presentation/controllers/config/config.controller");
19
+ // Controllers - Logs
20
+ const logs_controller_1 = require("../../presentation/controllers/logs/logs.controller");
21
+ // Controllers - Dev
22
+ const template_controller_1 = require("../../presentation/controllers/dev/template.controller");
23
+ const dev_controller_1 = require("../../presentation/controllers/dev/dev.controller");
19
24
  function registerPresentationModule() {
20
25
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IOutputPort, output_builder_service_1.OutputBuilder);
21
26
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IProgress, cli_progress_service_1.CliProgress);
22
27
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IOutputFormatter, output_formatter_service_1.OutputFormatter);
23
28
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.IUserInteractionPort, interaction_service_1.UserInteraction);
24
29
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.AcrCredentialsPrompt, acr_credentials_prompt_1.AcrCredentialsPrompt);
30
+ // Env Controllers
25
31
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.InstanceController, instance_controller_1.InstanceController);
26
32
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.SetupController, setup_controller_1.SetupController);
33
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.CredentialsController, credentials_controller_1.CredentialsController);
34
+ // Config Controllers
27
35
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.ConfigController, config_controller_1.ConfigController);
36
+ // Logs Controllers
28
37
  tsyringe_1.container.registerSingleton(tokens_1.TOKENS.LogsController, logs_controller_1.LogsController);
29
- tsyringe_1.container.registerSingleton(tokens_1.TOKENS.CredentialsController, credentials_controller_1.CredentialsController);
38
+ // Dev Controllers
39
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.TemplateController, template_controller_1.TemplateController);
40
+ tsyringe_1.container.registerSingleton(tokens_1.TOKENS.DevController, dev_controller_1.DevController);
30
41
  }
31
42
  //# sourceMappingURL=presentation.module.js.map
package/dist/di/tokens.js CHANGED
@@ -24,8 +24,16 @@ exports.TOKENS = {
24
24
  IInstanceStoragePort: 'IInstanceStoragePort',
25
25
  IErrorHandlerPort: 'IErrorHandlerPort',
26
26
  ICorrelationIdPort: 'ICorrelationIdPort',
27
+ IHttpClientPort: 'IHttpClientPort',
27
28
  IInstanceMetadataPort: 'IInstanceMetadataPort',
28
29
  IUserInteractionPort: 'IUserInteractionPort',
30
+ IWslSetupPort: 'IWslSetupPort',
31
+ IFileSystemPort: 'IFileSystemPort',
32
+ // ===========================================================================
33
+ // Application Layer - Services
34
+ // ===========================================================================
35
+ EnvironmentValidator: 'EnvironmentValidator',
36
+ InstanceCleanupService: 'InstanceCleanupService',
29
37
  // ===========================================================================
30
38
  // Application Layer - Use Cases
31
39
  // ===========================================================================
@@ -36,15 +44,31 @@ exports.TOKENS = {
36
44
  DeleteInstanceUseCase: 'DeleteInstanceUseCase',
37
45
  ListInstancesUseCase: 'ListInstancesUseCase',
38
46
  ListChartsUseCase: 'ListChartsUseCase',
47
+ ListRunningInstancesUseCase: 'ListRunningInstancesUseCase',
39
48
  // --- Setup Use Cases ---
40
49
  SetupEnvironmentUseCase: 'SetupEnvironmentUseCase',
41
50
  // --- Config Use Cases ---
42
51
  GetConfigUseCase: 'GetConfigUseCase',
52
+ GetAllConfigUseCase: 'GetAllConfigUseCase',
43
53
  SetConfigUseCase: 'SetConfigUseCase',
44
54
  // --- Credentials Use Cases ---
45
55
  GetCredentialsUseCase: 'GetCredentialsUseCase',
46
56
  // --- Logs Use Cases ---
47
57
  ShowLogsUseCase: 'ShowLogsUseCase',
58
+ // --- Dev Template Use Cases ---
59
+ InstallTemplateUseCase: 'InstallTemplateUseCase',
60
+ ListTemplatesUseCase: 'ListTemplatesUseCase',
61
+ UninstallTemplateUseCase: 'UninstallTemplateUseCase',
62
+ // --- Dev Project/Generate Use Cases ---
63
+ NewProjectUseCase: 'NewProjectUseCase',
64
+ GenerateComponentUseCase: 'GenerateComponentUseCase',
65
+ PublishPluginUseCase: 'PublishPluginUseCase',
66
+ // --- Domain Ports (Template) ---
67
+ ITemplateManagerPort: 'ITemplateManagerPort',
68
+ // --- Domain Ports (Dev) ---
69
+ IProjectScaffolderPort: 'IProjectScaffolderPort',
70
+ ISchematicsRunnerPort: 'ISchematicsRunnerPort',
71
+ IDotnetPublisherPort: 'IDotnetPublisherPort',
48
72
  // ===========================================================================
49
73
  // Presentation Layer - Controllers & UI Services
50
74
  // ===========================================================================
@@ -54,13 +78,12 @@ exports.TOKENS = {
54
78
  ConfigController: 'ConfigController',
55
79
  LogsController: 'LogsController',
56
80
  CredentialsController: 'CredentialsController',
81
+ TemplateController: 'TemplateController',
82
+ DevController: 'DevController',
57
83
  // --- UI Services ---
58
- ISystemOutput: 'ISystemOutput',
59
84
  IOutputPort: 'IOutputPort',
60
85
  IProgress: 'IProgress',
61
86
  IOutputFormatter: 'IOutputFormatter',
62
- // --- Infrastructure Common Services (CLI 啟動時需要) ---
63
- IAppConfig: 'IAppConfig',
64
87
  // --- Prompts ---
65
88
  AcrCredentialsPrompt: 'AcrCredentialsPrompt',
66
89
  // ===========================================================================
@@ -69,14 +92,12 @@ exports.TOKENS = {
69
92
  Internal: {
70
93
  // --- Windows/WSL Services ---
71
94
  WslInfoService: 'Internal.WslInfoService',
72
- WslConfigService: 'Internal.WslConfigService',
73
- IWslConfig: 'Internal.WslConfigService', // Alias for injection
95
+ IWslConfig: 'Internal.WslConfigService',
74
96
  WslUpdaterService: 'Internal.WslUpdaterService',
75
97
  RootfsManagerService: 'Internal.RootfsManagerService',
76
98
  WindowsInfoService: 'Internal.WindowsInfoService',
77
99
  WindowsFeaturesService: 'Internal.WindowsFeaturesService',
78
- MicroK8sService: 'Internal.MicroK8sService',
79
- IMicroK8s: 'Internal.MicroK8sService', // Alias for injection
100
+ IMicroK8s: 'Internal.MicroK8sService',
80
101
  // --- WSL 子服務 (取代 WslManagerService) ---
81
102
  WslInstanceNamingService: 'Internal.WslInstanceNamingService',
82
103
  IWslInstanceNaming: 'Internal.WslInstanceNamingService',
@@ -86,14 +107,11 @@ exports.TOKENS = {
86
107
  IWslInstanceInspection: 'Internal.WslInstanceInspectionService',
87
108
  // --- K8s/Helm Services ---
88
109
  HelmService: 'Internal.HelmService',
89
- HelmRegistryService: 'Internal.HelmRegistryService',
90
- IHelmRegistry: 'Internal.HelmRegistryService', // Alias for injection
91
- SecretManagerService: 'Internal.SecretManagerService',
92
- ISecretManager: 'Internal.SecretManagerService', // Alias for injection
110
+ IHelmRegistry: 'Internal.HelmRegistryService',
111
+ ISecretManager: 'Internal.SecretManagerService',
93
112
  VersionCompatibilityService: 'Internal.VersionCompatibilityService',
94
113
  // --- OCI Artifact Services ---
95
- OciArtifactService: 'Internal.OciArtifactService',
96
- IOciArtifactService: 'Internal.OciArtifactService', // Alias for injection
114
+ IOciArtifactService: 'Internal.OciArtifactService',
97
115
  // --- MSSQL Services ---
98
116
  MssqlHelmDeploymentService: 'Internal.MssqlHelmDeploymentService',
99
117
  IMssqlHelmDeployment: 'Internal.MssqlHelmDeploymentService',
@@ -105,12 +123,9 @@ exports.TOKENS = {
105
123
  IMssqlUserManager: 'Internal.MssqlUserManagerService',
106
124
  K8sJobRunnerService: 'Internal.K8sJobRunnerService',
107
125
  IK8sJobRunner: 'Internal.K8sJobRunnerService',
108
- InfraManagerService: 'Internal.InfraManagerService',
109
- IInfraManager: 'Internal.InfraManagerService', // Alias for injection
110
- ServiceManagerService: 'Internal.ServiceManagerService',
111
- IServiceManager: 'Internal.ServiceManagerService', // Alias for injection
112
- AppManagerService: 'Internal.AppManagerService',
113
- IAppManager: 'Internal.AppManagerService', // Alias for injection
126
+ IInfraManager: 'Internal.InfraManagerService',
127
+ IServiceManager: 'Internal.ServiceManagerService',
128
+ IAppManager: 'Internal.AppManagerService',
114
129
  // --- Persistence Services ---
115
130
  FileInstanceRepository: 'Internal.FileInstanceRepository',
116
131
  FileConfigRepository: 'Internal.FileConfigRepository',
@@ -118,15 +133,11 @@ exports.TOKENS = {
118
133
  FileLogWriter: 'Internal.FileLogWriter',
119
134
  FileLogReader: 'Internal.FileLogReader',
120
135
  // --- Execution Services ---
121
- CommandExecutorService: 'Internal.CommandExecutorService',
122
- ICommandExecutor: 'Internal.CommandExecutorService', // Alias for injection
136
+ ICommandExecutor: 'Internal.CommandExecutorService',
123
137
  ScriptExecutorService: 'Internal.ScriptExecutorService',
124
- HttpClientService: 'Internal.HttpClientService',
125
- IHttpClient: 'Internal.HttpClientService', // Alias for injection
126
- ExecutionEnvironmentFactory: 'Internal.ExecutionEnvironmentFactory',
127
- IExecutionEnvironmentFactory: 'Internal.ExecutionEnvironmentFactory', // Alias for injection
128
- HostCommandBuilder: 'Internal.HostCommandBuilder',
129
- IHostCommandBuilder: 'Internal.HostCommandBuilder', // Alias for injection
138
+ IHttpClient: 'Internal.HttpClientService',
139
+ IExecutionEnvironmentFactory: 'Internal.ExecutionEnvironmentFactory',
140
+ IHostCommandBuilder: 'Internal.HostCommandBuilder',
130
141
  // --- System Services ---
131
142
  NetworkCheckerService: 'Internal.NetworkCheckerService',
132
143
  // --- System Resources Services ---
@@ -135,15 +146,16 @@ exports.TOKENS = {
135
146
  WslConfigParserService: 'Internal.WslConfigParserService',
136
147
  IWslConfigParser: 'Internal.WslConfigParserService',
137
148
  // --- Security ---
138
- AcrCredentialManager: 'Internal.AcrCredentialManager',
139
- IAcrCredentialManager: 'Internal.AcrCredentialManager', // Alias for injection
149
+ IAcrCredentialManager: 'Internal.AcrCredentialManager',
140
150
  // --- Error Handling ---
141
151
  ErrorHandler: 'Internal.ErrorHandler',
142
- IErrorHandler: 'Internal.ErrorHandler', // Alias for injection
143
152
  // --- Config ---
144
153
  AppConfig: 'Internal.AppConfig',
145
154
  // --- Node.js Process ---
146
155
  Process: 'Internal.Process',
156
+ // --- Template Services ---
157
+ TemplateDownloader: 'Internal.TemplateDownloader',
158
+ TemplateRegistry: 'Internal.TemplateRegistry',
147
159
  },
148
160
  };
149
161
  //# sourceMappingURL=tokens.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CredentialsResolver = void 0;
4
+ const errors_1 = require("../errors");
4
5
  /**
5
6
  * 憑證解析策略 Entity
6
7
  *
@@ -118,7 +119,9 @@ class CredentialsResolver {
118
119
  resolveOrThrow() {
119
120
  const result = this.resolve();
120
121
  if (!result.resolved) {
121
- throw new Error(result.errorMessage);
122
+ throw new errors_1.AppError(result.errorMessage, {
123
+ exitCode: errors_1.EXIT_CODES.VALIDATION_ERROR,
124
+ });
122
125
  }
123
126
  return result.credentials;
124
127
  }
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Credentials = void 0;
4
- const instance_name_value_object_1 = require("../value-objects/instance-name.value-object");
5
- const mssql_password_value_object_1 = require("../value-objects/mssql-password.value-object");
6
- const rsa_key_pair_value_object_1 = require("../value-objects/rsa-key-pair.value-object");
7
- const jwt_key_value_object_1 = require("../value-objects/jwt-key.value-object");
4
+ const value_objects_1 = require("../value-objects");
8
5
  /**
9
6
  * 憑證 Entity
10
7
  *
@@ -41,7 +38,7 @@ class Credentials {
41
38
  * 從原始物件建立 Credentials
42
39
  */
43
40
  static fromObject(data) {
44
- return new Credentials(instance_name_value_object_1.InstanceName.create(data.instanceName), mssql_password_value_object_1.MssqlPassword.create(data.saPassword), mssql_password_value_object_1.MssqlPassword.create(data.adminPassword), rsa_key_pair_value_object_1.RsaKeyPair.create(data.signInRsaPrivateKey, data.signInRsaPublicKey), rsa_key_pair_value_object_1.RsaKeyPair.create(data.uofxRsaPrivateKey, data.uofxRsaPublicKey), jwt_key_value_object_1.JwtKey.create(data.jwtSigningKey), data.connectionStringUofxDb, data.connectionStringUofxSearchDb);
41
+ return new Credentials(value_objects_1.InstanceName.create(data.instanceName), value_objects_1.MssqlPassword.create(data.saPassword), value_objects_1.MssqlPassword.create(data.adminPassword), value_objects_1.RsaKeyPair.create(data.signInRsaPrivateKey, data.signInRsaPublicKey), value_objects_1.RsaKeyPair.create(data.uofxRsaPrivateKey, data.uofxRsaPublicKey), value_objects_1.JwtKey.create(data.jwtSigningKey), data.connectionStringUofxDb, data.connectionStringUofxSearchDb);
45
42
  }
46
43
  /**
47
44
  * 轉換為回應 DTO
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeleteInstanceValidation = void 0;
4
+ const errors_1 = require("../errors");
4
5
  /**
5
6
  * 刪除實例驗證 Entity
6
7
  *
@@ -92,7 +93,9 @@ class DeleteInstanceValidation {
92
93
  assertCanDelete() {
93
94
  const result = this.validate();
94
95
  if (!result.canDelete) {
95
- throw new Error(result.errorMessage);
96
+ throw new errors_1.AppError(result.errorMessage, {
97
+ exitCode: errors_1.EXIT_CODES.VALIDATION_ERROR,
98
+ });
96
99
  }
97
100
  }
98
101
  }
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeploymentParameters = void 0;
4
- const mssql_password_value_object_1 = require("../value-objects/mssql-password.value-object");
5
- const jwt_key_value_object_1 = require("../value-objects/jwt-key.value-object");
6
- const rsa_key_pair_value_object_1 = require("../value-objects/rsa-key-pair.value-object");
4
+ const value_objects_1 = require("../value-objects");
7
5
  /**
8
6
  * 部署參數 Entity
9
7
  *
10
8
  * 聚合所有部署所需的憑證與參數
11
9
  */
12
10
  class DeploymentParameters {
13
- constructor(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials) {
11
+ constructor(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials, skipNorthwind = false) {
14
12
  this.instanceName = instanceName;
15
13
  this.saPassword = saPassword;
16
14
  this.adminPassword = adminPassword;
@@ -18,6 +16,7 @@ class DeploymentParameters {
18
16
  this.uofxRsaKeys = uofxRsaKeys;
19
17
  this.jwtKey = jwtKey;
20
18
  this.acrCredentials = acrCredentials;
19
+ this.skipNorthwind = skipNorthwind;
21
20
  }
22
21
  /**
23
22
  * 建立部署參數
@@ -28,19 +27,21 @@ class DeploymentParameters {
28
27
  * @param uofxRsaKeys - Uofx RSA 金鑰對
29
28
  * @param jwtKey - JWT 金鑰
30
29
  * @param acrCredentials - ACR 憑證
30
+ * @param skipNorthwind - 是否跳過北風資料庫安裝
31
31
  * @returns 部署參數物件
32
32
  */
33
- static create(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials) {
34
- return new DeploymentParameters(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials);
33
+ static create(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials, skipNorthwind = false) {
34
+ return new DeploymentParameters(instanceName, saPassword, adminPassword, signInRsaKeys, uofxRsaKeys, jwtKey, acrCredentials, skipNorthwind);
35
35
  }
36
36
  /**
37
37
  * 使用自動生成的憑證建立部署參數
38
38
  * @param instanceName - 實例名稱
39
39
  * @param acrCredentials - ACR 憑證
40
+ * @param skipNorthwind - 是否跳過北風資料庫安裝
40
41
  * @returns 部署參數物件
41
42
  */
42
- static createWithGeneratedCredentials(instanceName, acrCredentials) {
43
- return new DeploymentParameters(instanceName, mssql_password_value_object_1.MssqlPassword.generate(), mssql_password_value_object_1.MssqlPassword.generate(), rsa_key_pair_value_object_1.RsaKeyPair.generate(), rsa_key_pair_value_object_1.RsaKeyPair.generate(), jwt_key_value_object_1.JwtKey.generate(), acrCredentials);
43
+ static createWithGeneratedCredentials(instanceName, acrCredentials, skipNorthwind = false) {
44
+ return new DeploymentParameters(instanceName, value_objects_1.MssqlPassword.generate(), value_objects_1.MssqlPassword.generate(), value_objects_1.RsaKeyPair.generate(), value_objects_1.RsaKeyPair.generate(), value_objects_1.JwtKey.generate(), acrCredentials, skipNorthwind);
44
45
  }
45
46
  /**
46
47
  * 取得 MSSQL 連線字串
@@ -94,6 +95,7 @@ class DeploymentParameters {
94
95
  saPassword: this.saPassword.toMasked(),
95
96
  adminPassword: this.adminPassword.toMasked(),
96
97
  acrName: this.acrCredentials.name,
98
+ skipNorthwind: this.skipNorthwind,
97
99
  };
98
100
  }
99
101
  /**
@@ -113,6 +115,7 @@ class DeploymentParameters {
113
115
  acrCredentials: this.acrCredentials.toSafeLog(),
114
116
  connectionStringUofxDb: '***MASKED***',
115
117
  connectionStringUofxSearchDb: '***MASKED***',
118
+ skipNorthwind: this.skipNorthwind,
116
119
  };
117
120
  }
118
121
  }