@tdk-landscape/tdk-cli-core 1.3.15 → 1.3.22

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 (274) hide show
  1. package/Tiltfile +144 -0
  2. package/discovery/AGENTS.md +362 -0
  3. package/discovery/TILT_DISCOVERY.star +424 -0
  4. package/discovery/Tiltfile +58 -0
  5. package/discovery/config.star +258 -0
  6. package/discovery/constants.star +127 -0
  7. package/discovery/deterministic.star +211 -0
  8. package/discovery/discovery_daemon.star +191 -0
  9. package/discovery/discovery_orchestrator.star +460 -0
  10. package/discovery/filtering.star +5 -0
  11. package/discovery/identity-management-backend/service.yaml +26 -0
  12. package/discovery/identity-management-frontend/service.yaml +29 -0
  13. package/discovery/identity-sdk/service.yaml +9 -0
  14. package/discovery/incremental_discovery.star +213 -0
  15. package/discovery/indexing.star +7 -0
  16. package/discovery/json_manifest_scanner.star +51 -0
  17. package/discovery/libraries.star +46 -0
  18. package/discovery/loading.star +23 -0
  19. package/discovery/manifest/constants.star +104 -0
  20. package/discovery/manifest/loading.star +386 -0
  21. package/discovery/manifest/normalize.star +281 -0
  22. package/discovery/manifest/validation.star +108 -0
  23. package/discovery/normalization.star +11 -0
  24. package/discovery/registry.star +544 -0
  25. package/discovery/resource_snapshot.py +382 -0
  26. package/discovery/resource_snapshot.star +143 -0
  27. package/discovery/schemas.star +1 -0
  28. package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
  29. package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
  30. package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
  31. package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
  32. package/discovery/test_resource_snapshot.py +251 -0
  33. package/discovery/validation.star +78 -0
  34. package/discovery/versioning.star +1 -0
  35. package/dist/commands/config.d.ts.map +1 -1
  36. package/dist/commands/config.js +11 -0
  37. package/dist/commands/config.js.map +1 -1
  38. package/dist/commands/doctor.d.ts.map +1 -1
  39. package/dist/commands/doctor.js +1 -2
  40. package/dist/commands/doctor.js.map +1 -1
  41. package/dist/commands/project.d.ts.map +1 -1
  42. package/dist/commands/project.js +36 -41
  43. package/dist/commands/project.js.map +1 -1
  44. package/dist/commands/resource.d.ts.map +1 -1
  45. package/dist/commands/resource.js +51 -55
  46. package/dist/commands/resource.js.map +1 -1
  47. package/dist/commands/stack.d.ts.map +1 -1
  48. package/dist/commands/stack.js +22 -24
  49. package/dist/commands/stack.js.map +1 -1
  50. package/dist/commands/ui.d.ts.map +1 -1
  51. package/dist/commands/ui.js +1 -2
  52. package/dist/commands/ui.js.map +1 -1
  53. package/dist/commands/up.d.ts.map +1 -1
  54. package/dist/commands/up.js +1 -2
  55. package/dist/commands/up.js.map +1 -1
  56. package/dist/commands/upgrade.d.ts +8 -0
  57. package/dist/commands/upgrade.d.ts.map +1 -1
  58. package/dist/commands/upgrade.js +59 -18
  59. package/dist/commands/upgrade.js.map +1 -1
  60. package/dist/generator/extension-fetch.d.ts +19 -0
  61. package/dist/generator/extension-fetch.d.ts.map +1 -1
  62. package/dist/generator/extension-fetch.js +71 -5
  63. package/dist/generator/extension-fetch.js.map +1 -1
  64. package/dist/generator/template-engine.d.ts +1 -0
  65. package/dist/generator/template-engine.d.ts.map +1 -1
  66. package/dist/generator/template-engine.js +50 -6
  67. package/dist/generator/template-engine.js.map +1 -1
  68. package/dist/utils/command-helpers.d.ts.map +1 -1
  69. package/dist/utils/command-helpers.js +7 -9
  70. package/dist/utils/command-helpers.js.map +1 -1
  71. package/dist/utils/constants.d.ts +1 -0
  72. package/dist/utils/constants.d.ts.map +1 -1
  73. package/dist/utils/constants.js +1 -0
  74. package/dist/utils/constants.js.map +1 -1
  75. package/dist/utils/errors.d.ts +2 -0
  76. package/dist/utils/errors.d.ts.map +1 -1
  77. package/dist/utils/errors.js +6 -1
  78. package/dist/utils/errors.js.map +1 -1
  79. package/dist/utils/project-features.d.ts.map +1 -1
  80. package/dist/utils/project-features.js +1 -1
  81. package/dist/utils/project-features.js.map +1 -1
  82. package/dist/utils/resource-features.d.ts.map +1 -1
  83. package/dist/utils/resource-features.js +2 -2
  84. package/dist/utils/resource-features.js.map +1 -1
  85. package/dist/utils/tar.js +4 -4
  86. package/dist/utils/tar.js.map +1 -1
  87. package/dist/utils/validation.d.ts +7 -0
  88. package/dist/utils/validation.d.ts.map +1 -1
  89. package/dist/utils/validation.js +9 -0
  90. package/dist/utils/validation.js.map +1 -1
  91. package/engine/AGENTS.md +705 -0
  92. package/engine/README.md +29 -0
  93. package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
  94. package/engine/Tiltfile +80 -0
  95. package/engine/assets/docker/golden-layers.Dockerfile +221 -0
  96. package/engine/assets/scripts/cleanup-completed-migrator-images.sh +37 -0
  97. package/engine/assets/scripts/cleanup-tilt-images.sh +120 -0
  98. package/engine/assets/scripts/mac-m1-resource-monitor.sh +121 -0
  99. package/engine/config.star +3 -0
  100. package/engine/docs/AUTODISCOVERY_TEST.md +182 -0
  101. package/engine/docs/C4-ARCHITECTURE-operations.md +396 -0
  102. package/engine/docs/C4-ARCHITECTURE-overview.md +284 -0
  103. package/engine/docs/C4-ARCHITECTURE.md +17 -0
  104. package/engine/docs/GOLDEN_IMAGE_INTEGRATION.md +349 -0
  105. package/engine/docs/MANIFEST_DRIVEN_ARCHITECTURE.md +357 -0
  106. package/engine/docs/README.md +284 -0
  107. package/engine/entrypoint.star +97 -0
  108. package/engine/lifecycle/orchestrator.star +260 -0
  109. package/engine/paths.star +717 -0
  110. package/engine/schemas/manifest-schema.json +301 -0
  111. package/engine/schemas/service-schema.json +301 -0
  112. package/engine/scripts/README.md +89 -0
  113. package/engine/scripts/build-and-publish-lib.sh +205 -0
  114. package/engine/scripts/check-lib-publish.sh +85 -0
  115. package/engine/scripts/debug-container.sh +258 -0
  116. package/engine/scripts/generate-manifest.sh +197 -0
  117. package/engine/spec.master +702 -0
  118. package/engine/spec.master.example +341 -0
  119. package/engine/topologies/README.md +34 -0
  120. package/engine/topologies/platform/docker/AGENTS.md +59 -0
  121. package/engine/topologies/platform/docker/auth/auth.star +167 -0
  122. package/engine/topologies/platform/docker/build/golden_image.star +37 -0
  123. package/engine/topologies/platform/docker/build/golden_image_build.star +82 -0
  124. package/engine/topologies/platform/docker/build/golden_image_constants.star +93 -0
  125. package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +291 -0
  126. package/engine/topologies/platform/docker/compose/compose.star +636 -0
  127. package/engine/topologies/platform/docker/compose/compose_helpers.star +52 -0
  128. package/engine/topologies/platform/docker/compose/traefik_standalone.star +53 -0
  129. package/engine/topologies/platform/docker/config/bunignore.star +142 -0
  130. package/engine/topologies/platform/docker/config/dockerignore.star +150 -0
  131. package/engine/topologies/platform/docker/constants.star +170 -0
  132. package/engine/topologies/platform/docker/dockerfile/dockerfile.star +54 -0
  133. package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +73 -0
  134. package/engine/topologies/platform/docker/index.star +27 -0
  135. package/engine/topologies/platform/docker/layers/bun_helpers.star +23 -0
  136. package/engine/topologies/platform/docker/layers/infisical/index.star +40 -0
  137. package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +262 -0
  138. package/engine/topologies/platform/docker/layers/l1_base_layers.star +87 -0
  139. package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +125 -0
  140. package/engine/topologies/platform/docker/layers/l3_builder_layers.star +209 -0
  141. package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +214 -0
  142. package/engine/topologies/platform/docker/layers/prisma/constants.star +135 -0
  143. package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +96 -0
  144. package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +109 -0
  145. package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +98 -0
  146. package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +126 -0
  147. package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +161 -0
  148. package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +119 -0
  149. package/engine/topologies/platform/docker/networking/api_path_constants.star +230 -0
  150. package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +27 -0
  151. package/engine/topologies/platform/docker/networking/traefik.star +232 -0
  152. package/engine/topologies/platform/docker/networking/traefik_constants.star +146 -0
  153. package/engine/topologies/platform/docker/networking/traefik_helpers.star +160 -0
  154. package/engine/topologies/platform/docker/secrets/infisical.star +135 -0
  155. package/engine/topologies/platform/net/proxy.star +4 -0
  156. package/engine/topologies/platform/registries/local.star +4 -0
  157. package/engine/topologies/platform/security/secrets.star +239 -0
  158. package/engine/topologies/platform/state/relational.star +4 -0
  159. package/engine/topologies/tilt/common/AGENTS.md +59 -0
  160. package/engine/topologies/tilt/common/utils.star +364 -0
  161. package/engine/topologies/tilt/common/utils_debug.star +69 -0
  162. package/engine/topologies/tilt/common/utils_deterministic.star +168 -0
  163. package/engine/topologies/tilt/common/utils_docker_networks.star +46 -0
  164. package/engine/topologies/tilt/common/utils_env.star +43 -0
  165. package/engine/topologies/tilt/common/utils_output.star +97 -0
  166. package/engine/topologies/tilt/config/AGENTS.md +68 -0
  167. package/engine/topologies/tilt/config/defaults.star +3 -0
  168. package/engine/topologies/tilt/config/feature_flags.star +10 -0
  169. package/engine/topologies/tilt/config/global.star +55 -0
  170. package/engine/topologies/tilt/config/profiles.star +382 -0
  171. package/engine/topologies/tilt/generators/agents_md.star +62 -0
  172. package/engine/topologies/tilt/generators/api_gateway.star +145 -0
  173. package/engine/topologies/tilt/generators/index.star +124 -0
  174. package/engine/topologies/tilt/generators/infisical/README.md +424 -0
  175. package/engine/topologies/tilt/generators/infisical/examples.star +312 -0
  176. package/engine/topologies/tilt/generators/infisical/index.star +57 -0
  177. package/engine/topologies/tilt/generators/infisical/machine_identity.star +420 -0
  178. package/engine/topologies/tilt/generators/infisical/organization.star +534 -0
  179. package/engine/topologies/tilt/generators/infisical/path_manager.star +476 -0
  180. package/engine/topologies/tilt/generators/infisical/secrets_generator.star +420 -0
  181. package/engine/topologies/tilt/generators/nginx_conf.star +143 -0
  182. package/engine/topologies/tilt/generators/npmrc.star +111 -0
  183. package/engine/topologies/tilt/generators/tsconfig.star +23 -0
  184. package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +71 -0
  185. package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +124 -0
  186. package/engine/topologies/tilt/generators/typescript/common.star +7 -0
  187. package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +76 -0
  188. package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +110 -0
  189. package/engine/topologies/tilt/generators/typescript/include.star +23 -0
  190. package/engine/topologies/tilt/generators/typescript/playwright_config.star +40 -0
  191. package/engine/topologies/tilt/generators/typescript/prisma_config.star +49 -0
  192. package/engine/topologies/tilt/generators/validators.star +853 -0
  193. package/engine/topologies/tilt/generators/vite/backend.star +78 -0
  194. package/engine/topologies/tilt/generators/vite/frontend.star +98 -0
  195. package/engine/topologies/tilt/generators/vite/generators.star +43 -0
  196. package/engine/topologies/tilt/generators/vite/helpers.star +244 -0
  197. package/engine/topologies/tilt/generators/vite/library.star +65 -0
  198. package/engine/topologies/tilt/generators/vite/sdk.star +73 -0
  199. package/engine/topologies/tilt/generators/vite/templates.star +737 -0
  200. package/engine/topologies/tilt/generators/vite_config.star +22 -0
  201. package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
  202. package/engine/topologies/tilt/manifest/README.md +693 -0
  203. package/engine/topologies/tilt/manifest/__init__.star +218 -0
  204. package/engine/topologies/tilt/manifest/constants.star +252 -0
  205. package/engine/topologies/tilt/manifest/errors.star +266 -0
  206. package/engine/topologies/tilt/manifest/integration.star +339 -0
  207. package/engine/topologies/tilt/manifest/json_to_yaml.py +54 -0
  208. package/engine/topologies/tilt/manifest/loader.star +214 -0
  209. package/engine/topologies/tilt/manifest/mapper.star +227 -0
  210. package/engine/topologies/tilt/manifest/parser.star +400 -0
  211. package/engine/topologies/tilt/manifest/schema.star +462 -0
  212. package/engine/topologies/tilt/manifest/tests/test_integration.star +276 -0
  213. package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +397 -0
  214. package/engine/topologies/tilt/manifest/tests/test_manifest.star +316 -0
  215. package/engine/topologies/tilt/manifest/tests/test_validator.star +470 -0
  216. package/engine/topologies/tilt/manifest/validator.star +717 -0
  217. package/engine/topologies/tilt/manifest/yaml_to_json.py +18 -0
  218. package/engine/topologies/tilt/resources/AGENTS.md +71 -0
  219. package/engine/topologies/tilt/resources/conditions.star +3 -0
  220. package/engine/topologies/tilt/resources/databases.star +244 -0
  221. package/engine/topologies/tilt/resources/declaration.star +3 -0
  222. package/engine/topologies/tilt/resources/deps.star +3 -0
  223. package/engine/topologies/tilt/resources/infra-loader.star +437 -0
  224. package/engine/topologies/tilt/resources/libs.star +30 -0
  225. package/engine/topologies/tilt/resources/libs_discovery.star +102 -0
  226. package/engine/topologies/tilt/resources/libs_paths.star +79 -0
  227. package/engine/topologies/tilt/resources/libs_resource_definition.star +151 -0
  228. package/engine/topologies/tilt/resources/libs_setup.star +164 -0
  229. package/engine/topologies/tilt/resources/libs_tsconfig.star +37 -0
  230. package/engine/topologies/tilt/resources/orchestrator/apply.star +77 -0
  231. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +431 -0
  232. package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +81 -0
  233. package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +148 -0
  234. package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +36 -0
  235. package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +44 -0
  236. package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +164 -0
  237. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
  238. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +21 -0
  239. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +134 -0
  240. package/engine/topologies/tilt/resources/orchestrator/generators/env.star +258 -0
  241. package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +169 -0
  242. package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +524 -0
  243. package/engine/topologies/tilt/resources/orchestrator/helpers.star +33 -0
  244. package/engine/topologies/tilt/resources/orchestrator.star +54 -0
  245. package/engine/topologies/tilt/resources/ordering.star +3 -0
  246. package/engine/topologies/tilt/resources/triggers.star +3 -0
  247. package/engine/topologies/tilt/resources/watchers.star +299 -0
  248. package/engine/where-things-live.star +717 -0
  249. package/ext/Tiltfile +66 -0
  250. package/ext/ide-components/README.md +219 -0
  251. package/ext/ide-components/code_executor/server.py +268 -0
  252. package/ext/ide-components/code_viewer/server.py +206 -0
  253. package/ext/ide-components/config_inspector/server.py +1050 -0
  254. package/ext/ide-components/file_browser/server.py +285 -0
  255. package/ext/ide-components/shared/config_service.py +469 -0
  256. package/ext/ide-components/shared/file_utils.py +298 -0
  257. package/ext/ide-components/shared/http_utils.py +232 -0
  258. package/ext/ide-components/shared/static/styles.css +1334 -0
  259. package/ext/ide-components/shared/syntax_highlighter.py +140 -0
  260. package/ext/ide-components/shared/template_engine.py +123 -0
  261. package/ext/ide-components/shared/templates/base.html +121 -0
  262. package/ext/ide-components/shared/test_config_service.py +326 -0
  263. package/ext/ide-components/shared/tilt_integration.py +158 -0
  264. package/ext/ui-enhancements/cron-status-server.sh +49 -0
  265. package/ext/ui-enhancements/cron-status-tracker.sh +146 -0
  266. package/ext/ui-enhancements/extension.yaml +36 -0
  267. package/ext/ui-enhancements/tiltfile.py +99 -0
  268. package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
  269. package/ext/ui-enhancements/ui/help-panel.css +279 -0
  270. package/ext/ui-enhancements/ui/icons.css +125 -0
  271. package/ext/ui-enhancements/ui/tooltips.css +114 -0
  272. package/package.json +13 -9
  273. package/specs/specs/TILT_SERVICE_DEFAULTS.star +205 -0
  274. package/specs/specs/TILT_TECH_STACK.star +159 -0
package/Tiltfile ADDED
@@ -0,0 +1,144 @@
1
+ # =============================================================================
2
+ # 🎯 TDK CLI - Combined Tilt Development Kit
3
+ # =============================================================================
4
+ # This is the unified Tiltfile entry point for tdk-cli.
5
+ # It combines: engine, discovery, specs, and ext into one repository.
6
+ #
7
+ # Usage:
8
+ # v1alpha1.extension_repo(name='tdk-cli', url='https://github.com/tdk-landscape/tdk-cli')
9
+ # load('ext://tdk-cli', 'Utils', 'Manifest', ...)
10
+ # =============================================================================
11
+
12
+ # =============================================================================
13
+ # ENGINE (Core orchestration)
14
+ # =============================================================================
15
+ load('./engine/topologies/tilt/common/utils.star', _Utils='Utils')
16
+ load('./discovery/loading.star', _Manifest='Manifest')
17
+ load('./engine/topologies/tilt/config/global.star', _Config='Config')
18
+ load('./discovery/registry.star',
19
+ _GLOBAL_CONFIG_EXPORT='GLOBAL_CONFIG_EXPORT',
20
+ _INFRA_RESOURCES_EXPORT='INFRA_RESOURCES_EXPORT',
21
+ _DDD_LIBS_EXPORT='DDD_LIBS_EXPORT',
22
+ _DEFAULTS_EXPORT='DEFAULTS_EXPORT',
23
+ _get_platform_libs_export='get_platform_libs_export',
24
+ _get_product_libs_export='get_product_libs_export',
25
+ _Registry='Registry',
26
+ _APP_RESOURCES='APP_RESOURCES',
27
+ )
28
+ load('./engine/topologies/tilt/generators/vite_config.star', _Vite='Vite')
29
+ load('./engine/topologies/tilt/generators/tsconfig.star', _TSConfig='TSConfig')
30
+ load('./engine/topologies/platform/docker/index.star', _Docker='Docker')
31
+ load('./engine/topologies/tilt/generators/npmrc.star', _PackageConfig='PackageConfig')
32
+ load('./engine/topologies/tilt/common/utils_deterministic.star', _Determinism='Determinism')
33
+ load('./engine/topologies/tilt/resources/deps.star', _Libs='Libs')
34
+ load('./engine/topologies/tilt/resources/conditions.star', _Database='Database')
35
+ load('./engine/topologies/tilt/resources/declaration.star', _Orchestrator='Orchestrator')
36
+ load('./engine/topologies/tilt/resources/ordering.star', _Infra='Infra')
37
+ load('./engine/topologies/tilt/resources/triggers.star', _Watchers='Watchers')
38
+
39
+ # =============================================================================
40
+ # SPECS (Tech stack and standards)
41
+ # =============================================================================
42
+ load('./specs/specs/TILT_TECH_STACK.star', _assert_tech_stack='assert_tech_stack', _TECH_STACK='TECH_STACK')
43
+
44
+ # =============================================================================
45
+ # DISCOVERY (Service discovery)
46
+ # =============================================================================
47
+ load('./discovery/constants.star',
48
+ _MANIFEST_FILENAME='MANIFEST_FILENAME',
49
+ _MANIFEST_FILENAME_YAML='MANIFEST_FILENAME_YAML',
50
+ _RESOURCES_ROOT='RESOURCES_ROOT',
51
+ _DISCOVERY_SCAN_ROOTS='DISCOVERY_SCAN_ROOTS',
52
+ )
53
+ load('./discovery/discovery_orchestrator.star', _initialize_discovery='initialize_discovery')
54
+ load('./discovery/resource_snapshot.star', _get_resource_snapshot_path='get_resource_snapshot_path')
55
+
56
+ # =============================================================================
57
+ # EXT (UI enhancements and IDE components)
58
+ # =============================================================================
59
+ # UI enhancements are inlined for self-containment
60
+ def load_ui_enhancements(config):
61
+ """Load UI enhancements configuration."""
62
+ enable_tooltips = config.get('enable_tooltips', True)
63
+ enable_icons = config.get('enable_icons', True)
64
+ enable_help_panel = config.get('enable_help_panel', True)
65
+ enable_cron_jobs_tab = config.get('enable_cron_jobs_tab', True)
66
+
67
+
68
+ def get_ide_components_path():
69
+ """Return the path to IDE components."""
70
+ return './ext/ide-components'
71
+
72
+ def get_file_browser_script():
73
+ """Return the path to file browser server script."""
74
+ return './ext/ide-components/file_browser/server.py'
75
+
76
+ def get_code_viewer_script():
77
+ """Return the path to code viewer server script."""
78
+ return './ext/ide-components/code_viewer/server.py'
79
+
80
+ def get_config_inspector_script():
81
+ """Return the path to config inspector server script."""
82
+ return './ext/ide-components/config_inspector/server.py'
83
+
84
+ def get_code_executor_script():
85
+ """Return the path to code executor server script."""
86
+ return './ext/ide-components/code_executor/server.py'
87
+
88
+ IDE_PORTS = {
89
+ 'file_browser': 9765,
90
+ 'code_viewer': 9766,
91
+ 'config_inspector': 9767,
92
+ 'code_executor': 9768,
93
+ }
94
+
95
+ # =============================================================================
96
+ # RE-EXPORTS (Unified API)
97
+ # =============================================================================
98
+
99
+ # Core
100
+ Utils = _Utils
101
+ Manifest = _Manifest
102
+ Config = _Config
103
+
104
+ # Registry Data
105
+ GLOBAL_CONFIG_EXPORT = _GLOBAL_CONFIG_EXPORT
106
+ INFRA_RESOURCES_EXPORT = _INFRA_RESOURCES_EXPORT
107
+ DDD_LIBS_EXPORT = _DDD_LIBS_EXPORT
108
+ DEFAULTS_EXPORT = _DEFAULTS_EXPORT
109
+ APP_RESOURCES = _APP_RESOURCES
110
+ Registry = _Registry
111
+
112
+ def get_platform_libs_export():
113
+ return _get_platform_libs_export()
114
+
115
+ def get_product_libs_export():
116
+ return _get_product_libs_export()
117
+
118
+ # Providers
119
+ Vite = _Vite
120
+ TSConfig = _TSConfig
121
+ Docker = _Docker
122
+ PackageConfig = _PackageConfig
123
+
124
+ # Lifecycle
125
+ Libs = _Libs
126
+ Database = _Database
127
+ Orchestrator = _Orchestrator
128
+ Infra = _Infra
129
+ Watchers = _Watchers
130
+
131
+ # Specs
132
+ assert_tech_stack = _assert_tech_stack
133
+ TECH_STACK = _TECH_STACK
134
+
135
+ # Discovery
136
+ MANIFEST_FILENAME = _MANIFEST_FILENAME
137
+ MANIFEST_FILENAME_YAML = _MANIFEST_FILENAME_YAML
138
+ RESOURCES_ROOT = _RESOURCES_ROOT
139
+ DISCOVERY_SCAN_ROOTS = _DISCOVERY_SCAN_ROOTS
140
+ initialize_discovery = _initialize_discovery
141
+ get_resource_snapshot_path = _get_resource_snapshot_path
142
+
143
+ # Determinism Utilities
144
+ Determinism = _Determinism
@@ -0,0 +1,362 @@
1
+ # AGENTS.md - Tilt Discovery System
2
+
3
+ ## Purpose
4
+
5
+ This folder contains the **service discovery system** for TDK Landscape's Tilt infrastructure. It scans the repository for service manifests and creates Tilt resources.
6
+
7
+ ## Architecture: Two-Layer Scanning with Validation
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────────────┐
11
+ │ DISCOVERY SYSTEM │
12
+ ├─────────────────────────────────────────────────────────────┤
13
+ │ │
14
+ │ LAYER 1: AUTO DISCOVERY (Orchestrator) │
15
+ │ ┌─────────────────────────────────────────────────────┐ │
16
+ │ │ discovery_orchestrator.star │ │
17
+ │ │ ├── Orchestrates the discovery process │ │
18
+ │ │ ├── Multi-root scanning (Phase 2) │ │
19
+ │ │ ├── Root overlap validation (Phase 2) │ │
20
+ │ │ ├── Loads and validates manifests (Phase 1.5) │ │
21
+ │ │ └── Logs validation warnings with file paths │ │
22
+ │ └─────────────────────────────────────────────────────┘ │
23
+ │ │ │
24
+ │ ▼ │
25
+ │ LAYER 2: MANUAL SCANNER (Folder-Specific) │
26
+ │ ┌─────────────────────────────────────────────────────┐ │
27
+ │ │ json_manifest_scanner.star │ │
28
+ │ │ ├── Low-level shell `find` command │ │
29
+ │ │ ├── Scans one root per call (reused for Phase 2) │ │
30
+ │ │ └── Returns list of manifest paths │ │
31
+ │ └─────────────────────────────────────────────────────┘ │
32
+ │ │ │
33
+ │ ▼ │
34
+ │ LAYER 3: VALIDATION (Phase 1.5) │
35
+ │ ┌─────────────────────────────────────────────────────┐ │
36
+ │ │ validation.star │ │
37
+ │ │ ├── validate(manifest) → returns issues[] │ │
38
+ │ │ ├── Validates: appName, appType, domain, port │ │
39
+ │ │ ├── Validates: features, dependsOn │ │
40
+ │ │ └── Lenient mode: warns but continues discovery │ │
41
+ │ └─────────────────────────────────────────────────────┘ │
42
+ │ │ │
43
+ │ ▼ │
44
+ │ LAYER 4: REGISTRY (Service Registry) │
45
+ │ ┌─────────────────────────────────────────────────────┐ │
46
+ │ │ registry.star │ │
47
+ │ │ ├── get_app_resources() │ │
48
+ │ │ ├── get_resource_by_name(name) │ │
49
+ │ │ └── Exports to autogenerated files │ │
50
+ │ └─────────────────────────────────────────────────────┘ │
51
+ │ │
52
+ └─────────────────────────────────────────────────────────────┘
53
+ ```
54
+
55
+ ## Phase 2: Universal Discovery (Implemented)
56
+
57
+ **Status:** ✅ **IMPLEMENTED** - Multi-root discovery with validation and explicit domain extraction
58
+
59
+ ### What Changed
60
+
61
+ Phase 2 extends discovery from single-root (`services/product/`) to multi-root scanning:
62
+
63
+ **Scan Roots Configuration (`constants.star`):**
64
+ ```starlark
65
+ DISCOVERY_SCAN_ROOTS = [
66
+ RESOURCES_ROOT, # services/product/*/*/
67
+ "../../../../services/platform", # services/platform/*/*/
68
+ "../../../../shared-product-engineering", # shared-product-engineering/*/
69
+ "../../../../cli-platform-engineering", # cli-platform-engineering/*/
70
+ ]
71
+ ```
72
+
73
+ **Domain Extraction Patterns (`SCAN_ROOT_PATTERNS`):**
74
+ ```starlark
75
+ SCAN_ROOT_PATTERNS = {
76
+ RESOURCES_ROOT: {"domain_depth": -3}, # Domain-grouped (product)
77
+ "../../../../services/platform": {"domain_depth": -2}, # Flat
78
+ # ... etc
79
+ }
80
+ ```
81
+
82
+ **Performance Guardrails:**
83
+ - `MAX_SCAN_TIMEOUT_MS = 5000` - Warn if scan takes >5 seconds
84
+ - `MAX_MANIFESTS_PER_ROOT = 50` - Warn if root has >50 manifests
85
+
86
+ ### Architecture Changes
87
+
88
+ Phase 2 adds two key features to the orchestrator:
89
+
90
+ 1. **Root Overlap Validation** - Prevents duplicate scanning from misconfiguration
91
+ ```starlark
92
+ def _validate_scan_roots(roots):
93
+ # Warns if one root is subdirectory of another
94
+ ```
95
+
96
+ 2. **Multi-Root Scanning** - Iterates over all configured roots
97
+ ```starlark
98
+ for root in DISCOVERY_SCAN_ROOTS:
99
+ paths = discover_json_manifests(root)
100
+ # ... deduplicate and process
101
+ ```
102
+
103
+ 3. **Explicit Domain Extraction** - Uses configured patterns instead of hardcoded assumptions
104
+ ```starlark
105
+ pattern = SCAN_ROOT_PATTERNS.get(matching_root, {"domain_depth": -2})
106
+ domain = path_parts[pattern["domain_depth"]]
107
+ ```
108
+
109
+ ### Expected Service Counts
110
+
111
+ | Root | Expected Manifests | Structure |
112
+ |------|---------------------|-----------|
113
+ | `services/product/` | ~26 | Domain-grouped (`{domain}/{service}/`) |
114
+ | `services/platform/` | ~9 | Flat (`{service}/`) |
115
+ | `shared-product-engineering/` | ~3 | Flat (`{service}/`) |
116
+ | `cli-platform-engineering/` | ~1 | Flat (`{service}/`) |
117
+ | **Total** | **~39** | - |
118
+
119
+ ### "Pool of Candidates" Behavior
120
+
121
+ Phase 2 discovers **all manifests** from all scan roots, creating a "pool of candidates." Not every candidate will be ready to run, and that's expected:
122
+
123
+ - Some platform services are works-in-progress
124
+ - Some services may lack complete infrastructure (Dockerfile, configs)
125
+ - Tilt will show clear error messages for services with missing infrastructure
126
+ - Developers can see what's available vs what's broken in Tilt UI
127
+
128
+ **This is intentional** - Starlark has limited filesystem capabilities for pre-flight validation. Services fail naturally at build/orchestration time with clear Tilt error messages.
129
+
130
+ ### Example Phase 2 Discovery Output
131
+
132
+ ```
133
+ 📄 FIRST PASS: Loading services from JSON manifests...
134
+ 📁 Scanned 26 manifests from ../../../../services/product
135
+ 📁 Scanned 9 manifests from ../../../../services/platform
136
+ 📁 Scanned 3 manifests from ../../../../shared-product-engineering
137
+ 📁 Scanned 1 manifests from ../../../../cli-platform-engineering
138
+ ⚠️ Validation: services/product/order/management/manifest.json: appName too short
139
+ ✅ Discovery complete: 38/39 manifests valid
140
+ ⚠️ 1 manifest(s) with 1 validation warning(s)
141
+ ```
142
+
143
+ ### Rollback to Phase 1
144
+
145
+ If issues arise with Phase 2:
146
+
147
+ ```bash
148
+ # Restore Phase 1 behavior
149
+ tilt down
150
+ git checkout .tilt/topologies/tilt/discovery/constants.star
151
+ git checkout .tilt/topologies/tilt/discovery/discovery_orchestrator.star
152
+ tilt up
153
+ ```
154
+
155
+ This reverts to single-root scanning of `services/product/` only.
156
+
157
+ ### Troubleshooting Phase 2
158
+
159
+ **Issue: Warning about overlapping roots**
160
+ ```
161
+ ⚠️ Warning: ../../../../services/product/user is subdirectory of ../../../../services/product
162
+ ```
163
+ **Solution:** Check `DISCOVERY_SCAN_ROOTS` in `constants.star` - one root should not be inside another.
164
+
165
+ **Issue: Large root warning**
166
+ ```
167
+ ⚠️ Large root: ../../../../services/product has 60 manifests (max: 50)
168
+ ```
169
+ **Solution:** Either increase `MAX_MANIFESTS_PER_ROOT` or verify the root path is correct.
170
+
171
+ **Issue: New services not appearing in Tilt UI**
172
+ **Solution:**
173
+ 1. Check manifest exists in new root: `find services/platform -name "*.manifest.json"`
174
+ 2. Verify manifest is valid JSON
175
+ 3. Check Tilt logs: `tilt logs | grep "Scanned"`
176
+ 4. Verify domain extraction: Check Tilt UI grouping
177
+
178
+ ---
179
+
180
+ ## Phase 1.5: Validation Integration (Complete)
181
+
182
+ **Status:** ✅ Complete - Validation integrated into discovery flow
183
+
184
+ ### Validation Behavior
185
+
186
+ The discovery system now validates all manifests during the scan process:
187
+
188
+ 1. **When:** After `ManifestLoader.load_from_file()` successfully loads a manifest
189
+ 2. **What:** Validates required fields (appName, appType, domain, port, features, replicas)
190
+ 3. **How:** Lenient mode - logs warnings but continues discovery
191
+ 4. **Summary:** Discovery completion shows validation stats
192
+
193
+ ### Validation Rules
194
+
195
+ | Field | Validation |
196
+ |-------|------------|
197
+ | `appName` | Required, 3-64 chars, kebab-case (lowercase, numbers, hyphens) |
198
+ | `appType` | Required, must be: backend, frontend, library, migrator, sdk, worker |
199
+ | `domain` | Required, must be a valid domain from `constants.star` |
200
+ | `port` | Required, integer 3000-9999, appType-specific ranges enforced |
201
+ | `features` | Optional, each must be a valid feature from `constants.star` |
202
+ | `replicas` | Optional, integer 1-10 |
203
+
204
+ ### Example Discovery Output
205
+
206
+ ```
207
+ 📄 FIRST PASS: Loading services from JSON manifests...
208
+ ⚠️ Validation: services/product/order/management/manifest.json: appName too short: 'ab'. Minimum 3 characters
209
+ ⚠️ Validation: services/product/user/provider/manifest.json: Invalid appType: microservice. Must be one of: backend, frontend...
210
+ ✅ Discovery complete: 24/26 manifests valid
211
+ ⚠️ 2 manifest(s) with 3 validation warning(s)
212
+ ```
213
+
214
+ ## Troubleshooting
215
+
216
+ ### Validation Warnings
217
+
218
+ **Issue:** Manifest shows validation warnings but service still loads
219
+ ```
220
+ ⚠️ Validation: services/product/.../manifest.json: appName too short: 'x'
221
+ ```
222
+
223
+ **Solution:** Validation runs in lenient mode. Fix the warning to ensure future compatibility:
224
+ - Check manifest follows all validation rules above
225
+ - Run `tilt logs` to see all validation issues for a manifest
226
+ - View the manifest file path in the warning message
227
+
228
+ ### Discovery Not Finding Services
229
+
230
+ **Issue:** Services not appearing in Tilt UI
231
+
232
+ **Solution:**
233
+ 1. Check manifest file exists: `services/product/{domain}/{service}/manifest.json`
234
+ 2. Verify JSON is valid: `cat manifest.json | python -m json.tool`
235
+ 3. Check for validation errors in `tilt logs`
236
+ 4. Ensure domain is not in `OUT_OF_SCOPE_DOMAINS` (see `spec.master`)
237
+
238
+ ### Validation Errors in Strict Mode
239
+
240
+ **Note:** Currently validation runs in **lenient mode** (warnings only). If strict mode is needed:
241
+ - Modify `discovery_orchestrator.star` to `continue` on validation issues
242
+ - Or add `STRICT_VALIDATION = True` config option
243
+
244
+ ---
245
+
246
+ ## Key Files
247
+
248
+ ### Layer 1: Auto Discovery Orchestrator
249
+ - **`discovery_orchestrator.star`** - Main orchestrator
250
+ - `initialize_discovery(cache, second_pass=False)` - Load all services
251
+ - `_scan_services()` - Scan and normalize all manifests
252
+ - Calls manual scanner, processes results
253
+
254
+ ### Layer 2: Manual Folder-Specific Scanner
255
+ - **`json_manifest_scanner.star`** - Low-level JSON manifest finder
256
+ - `discover_json_manifests(root_path)` - Uses shell `find` command
257
+ - Folder-specific: scans one root at a time
258
+ - Returns list of manifest file paths
259
+
260
+ ### Layer 3: Service Registry
261
+ - **`registry.star`** - Service registry and export
262
+ - `get_app_resources()` - Get all discovered services
263
+ - `get_resource_by_name(name)` - Get specific service
264
+ - `generate_product_snapshot_topology()` - Export to autogenerated files
265
+
266
+ ### Configuration & Constants
267
+ - **`constants.star`** - Paths and constants
268
+ - `RESOURCES_ROOT` - "../../../../services/product"
269
+ - `DISCOVERY_SCAN_ROOTS` - Array of scan roots (Phase 2)
270
+ - `SCAN_ROOT_PATTERNS` - Domain extraction patterns per root (Phase 2)
271
+ - `MAX_SCAN_TIMEOUT_MS` - Performance guardrail (Phase 2)
272
+ - `MAX_MANIFESTS_PER_ROOT` - Performance guardrail (Phase 2)
273
+ - `PRODUCT_SNAPSHOT_DIR` - Where to write autogenerated files
274
+
275
+ ### Supporting Files
276
+ - **`config.star`** - Global configuration loading
277
+ - **`libraries.star`** - Library autodiscovery (DDD libs, platform libs)
278
+ - **`validation.star`** - Manifest validation rules
279
+ - **`loading.star`** - High-level loading wrapper
280
+ - **`normalization.star`** - Manifest normalization
281
+
282
+ ### Subfolder: manifest/
283
+ **Note:** Discovery-specific manifest logic (not the general `../manifest/`)
284
+ - **`manifest/loading.star`** - Default sync patterns, Prisma checks
285
+ - **`manifest/normalize.star`** - Manifest normalization and discovery
286
+ - **`manifest/validation.star`** - Domain/app type validation
287
+
288
+ ## Common Tasks
289
+
290
+ ### Get all services (Auto Discovery)
291
+ ```starlark
292
+ load("./registry.star", "get_app_resources")
293
+ services = get_app_resources()
294
+ ```
295
+
296
+ ### Get service by name
297
+ ```starlark
298
+ load("./registry.star", "get_resource_by_name")
299
+ svc = get_resource_by_name("order-management-backend")
300
+ ```
301
+
302
+ ### Manual scan for manifests (Manual Scanner)
303
+ ```starlark
304
+ load("./json_manifest_scanner.star", "discover_json_manifests")
305
+ paths = discover_json_manifests("../../../../services/product")
306
+ # Returns: ["../../../../services/product/.../manifest.json", ...]
307
+ ```
308
+
309
+ ### Initialize full discovery (Orchestrator)
310
+ ```starlark
311
+ load("./discovery_orchestrator.star", "initialize_discovery")
312
+ _DISCOVERY_CACHE = {"initialized": False}
313
+ initialize_discovery(_DISCOVERY_CACHE)
314
+ ```
315
+
316
+ ## Two-Pass Discovery Process
317
+
318
+ **Pass 1:** Scan JSON manifests and normalize
319
+ 1. `discovery_orchestrator.star` calls `json_manifest_scanner.star`
320
+ 2. Scanner returns list of manifest paths
321
+ 3. Orchestrator loads and normalizes each manifest
322
+ 4. Services stored in cache
323
+
324
+ **Pass 2:** Export to autogenerated Tilt resources
325
+ 1. `registry.star` reads from discovery cache
326
+ 2. Generates `.tilt/topologies/product_autogenerated_*/` files
327
+ 3. Creates Tilt resources from generated files
328
+
329
+ ## Important Notes
330
+
331
+ 1. **Clear Separation:**
332
+ - **Manual scanner:** Low-level, folder-specific, reusable
333
+ - **Auto orchestrator:** High-level, coordinates scanning
334
+ - **Registry:** Consumer of discovery results
335
+
336
+ 2. **Phase 1 Status:** ✅ Complete
337
+ - Clean separation between scanner and orchestrator
338
+ - Good naming: `json_manifest_scanner` + `discovery_orchestrator`
339
+
340
+ 3. **Phase 1.5 Status:** ✅ Complete
341
+ - Validation integrated into discovery flow
342
+ - Per-service validation with file paths in error messages
343
+ - Discovery summary shows validation stats
344
+ - Backward compatible (lenient mode)
345
+
346
+ 4. **Phase 2 Status:** ✅ **IMPLEMENTED**
347
+ - Multi-root scanning active (`DISCOVERY_SCAN_ROOTS`)
348
+ - Scans 4 roots: services/product, services/platform, shared-*, cli-*
349
+ - Root overlap validation prevents misconfiguration
350
+ - Explicit domain extraction patterns (`SCAN_ROOT_PATTERNS`)
351
+ - Performance guardrails (timeouts, manifest limits)
352
+ - "Pool of candidates" approach - all manifests discovered, some may fail at build time
353
+
354
+ 4. **Autogenerated Files:**
355
+ - `registry.star` writes to `product_autogenerated_resource_manifests/`
356
+ - These become Tilt resources
357
+
358
+ ## Dependencies
359
+
360
+ - `../manifest/` - General manifest parsing (constants, loader, parser)
361
+ - `../../platform/docker/` - Docker constants
362
+ - `../../../../spec.master` - Global defaults