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

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
@@ -0,0 +1,151 @@
1
+ # =============================================================================
2
+ # 📦 TILT SDK - LIBRARY RESOURCE DEFINITION
3
+ # =============================================================================
4
+
5
+ load("../../platform/docker/constants.star", "PlatformDockerConstants")
6
+
7
+
8
+ def _library_needs_vite(path):
9
+ """Check if a library needs a Vite config."""
10
+ pkg_content = read_file(path + '/package.json', default='')
11
+ if not pkg_content:
12
+ return False
13
+
14
+ pkg = decode_json(pkg_content)
15
+ if not pkg:
16
+ return False
17
+
18
+ deps = {}
19
+ for dep_type in ['dependencies', 'devDependencies', 'peerDependencies']:
20
+ deps.update(pkg.get(dep_type, {}))
21
+
22
+ needs_vite = 'vitest' in deps or 'vite-plugin-dts' in deps or 'vite' in deps
23
+ if needs_vite:
24
+ print(" 🔍 Library at " + path + " needs Vite")
25
+ return needs_vite
26
+
27
+
28
+ def _library_has_react(path):
29
+ """Check if a library has React components."""
30
+ pkg_content = read_file(path + '/package.json', default='')
31
+ if not pkg_content:
32
+ return False
33
+
34
+ pkg = decode_json(pkg_content)
35
+ if not pkg:
36
+ return False
37
+
38
+ deps = {}
39
+ for dep_type in ['dependencies', 'devDependencies', 'peerDependencies']:
40
+ deps.update(pkg.get(dep_type, {}))
41
+
42
+ return 'react' in deps or '@vitejs/plugin-react' in deps
43
+
44
+
45
+ def _library_has_dts(path):
46
+ """Check if a library has vite-plugin-dts in dependencies."""
47
+ pkg_content = read_file(path + '/package.json', default='')
48
+ if not pkg_content:
49
+ return False
50
+
51
+ pkg = decode_json(pkg_content)
52
+ if not pkg:
53
+ return False
54
+
55
+ deps = {}
56
+ for dep_type in ['dependencies', 'devDependencies', 'peerDependencies']:
57
+ deps.update(pkg.get(dep_type, {}))
58
+
59
+ return 'vite-plugin-dts' in deps
60
+
61
+
62
+ def library_is_frontend(path):
63
+ """Check if library is marked as frontend in manifest or has React."""
64
+ # Check library manifest (libraries use their own naming convention)
65
+ lib_name = path.split('/')[-1]
66
+ manifest_content = read_file(path + '/' + lib_name + '.manifest.json', default='')
67
+
68
+ return _library_has_react(path)
69
+
70
+
71
+ def define_library_resource(ctx, name, path, labels, internal_deps=None, consumer_paths=None, write_fn=None, generate_vite_fn=None):
72
+ """Defines a Tilt local_resource for a library with proper dependency management.
73
+
74
+ Args:
75
+ ctx: Tilt context with global_config, verdaccio_url, etc.
76
+ name: Library name
77
+ path: Path to library directory
78
+ labels: Labels for Tilt UI organization
79
+ internal_deps: Optional list of internal dependencies
80
+ consumer_paths: Optional list of consumer resource paths
81
+ write_fn: Optional write function for file generation
82
+ generate_vite_fn: Optional Vite config generator function
83
+
84
+ Returns:
85
+ str: Name of created Tilt resource
86
+ """
87
+ global_config = ctx.get('global_config', {})
88
+ registry = (
89
+ ctx.get('verdaccio_url_docker')
90
+ or global_config.get('verdaccio_url_docker')
91
+ or ctx.get('verdaccio_url_local')
92
+ or global_config.get('verdaccio_url_local')
93
+ or PlatformDockerConstants.VERDACCIO_URL_DOCKER
94
+ )
95
+ internal_scope = ctx.get('internal_scope', '@tdk/')
96
+ pkg_name = internal_scope + name
97
+
98
+ if write_fn and generate_vite_fn:
99
+ lib_manifest = {
100
+ 'appName': name,
101
+ 'appType': 'library',
102
+ '_servicePath': path,
103
+ 'needsVite': True,
104
+ 'hasReact': _library_has_react(path),
105
+ 'hasDts': _library_has_dts(path),
106
+ }
107
+
108
+ if _library_needs_vite(path):
109
+ print(" 📚 Generating vite.config.ts for library: " + name)
110
+ generate_vite_fn(lib_manifest, None, write_fn)
111
+
112
+ consumer_paths_str = ''
113
+ if consumer_paths:
114
+ consumer_paths_str = ','.join(consumer_paths)
115
+
116
+ publish_cmd = './engine/scripts/build-and-publish-lib.sh "' + path + '" "' + registry + '" "' + pkg_name + '" "' + consumer_paths_str + '"'
117
+
118
+ # Sanitize name to remove invalid characters for Tilt resource names
119
+ # e.g., "introvertic/ui" -> "introvertic-ui"
120
+ resource_name = 'lib-' + name.replace('/', '-')
121
+ auto_init_libs = os.environ.get('TILT_AUTO_INIT_LIBS', 'false').lower() == 'true'
122
+
123
+ deps = [PlatformDockerConstants.VERDACCIO_RESOURCE_NAME]
124
+ if internal_deps:
125
+ for dep in internal_deps:
126
+ if dep not in deps:
127
+ deps.append(dep)
128
+
129
+ input_deps = [
130
+ path + '/src',
131
+ path + '/package.json',
132
+ path + '/tsconfig.json',
133
+ ]
134
+
135
+ local_resource(
136
+ resource_name,
137
+ cmd=publish_cmd,
138
+ deps=input_deps,
139
+ labels=labels + ['lib'],
140
+ resource_deps=deps,
141
+ allow_parallel=True,
142
+ auto_init=auto_init_libs,
143
+ )
144
+
145
+ return resource_name
146
+
147
+
148
+ LibsResourceDefinition = struct(
149
+ define_resource = define_library_resource,
150
+ is_frontend = library_is_frontend,
151
+ )
@@ -0,0 +1,164 @@
1
+ # =============================================================================
2
+ # 🚀 TILT SDK - LIBRARY SETUP ORCHESTRATOR
3
+ # =============================================================================
4
+
5
+ load('./libs_paths.star', 'LibsPaths')
6
+ load('./libs_discovery.star', 'LibsDiscovery')
7
+ load('./libs_resource_definition.star', 'LibsResourceDefinition')
8
+ load('../../platform/docker/constants.star', 'PlatformDockerConstants')
9
+
10
+ _get_lib_path_from_package_name = LibsPaths.get_path
11
+ _read_package_json_deps = LibsPaths.read_package_json_deps
12
+ _get_resource_paths_for_focus = LibsPaths.get_resource_paths
13
+ _discover_resource_libraries = LibsDiscovery.discover_resource_libs
14
+ _define_library_resource = LibsResourceDefinition.define_resource
15
+
16
+
17
+ def setup_libraries(ctx, should_enable_fn, ddd_libs, platform_libs, product_libs, config_generators, focus_enabled_all=None):
18
+ """
19
+ Sets up library resources with dynamic dependency scanning.
20
+
21
+ Returns:
22
+ Dict mapping package_name -> tilt_resource_name
23
+ """
24
+ library_map = {}
25
+ internal_scope = ctx.get('internal_scope', '@tdk/')
26
+ library_roots = ctx.get('library_roots', {})
27
+ print("📚 setup_libraries called for " + str(len(platform_libs) + len(product_libs) + len(ddd_libs)) + " potential libraries")
28
+
29
+ generate_tsconfig = config_generators.get('tsconfig')
30
+ generate_npmrc = config_generators.get('npmrc')
31
+ generate_bunfig = config_generators.get('bunfig')
32
+ generate_vite = config_generators.get('vite')
33
+ write_fn = config_generators.get('write_fn')
34
+
35
+ if not should_enable_fn(PlatformDockerConstants.VERDACCIO_RESOURCE_NAME):
36
+ return library_map
37
+
38
+ if focus_enabled_all != None:
39
+ print("📚 Focus mode: Scanning service dependencies...")
40
+
41
+ resource_paths = _get_resource_paths_for_focus(ctx, focus_enabled_all)
42
+
43
+ if len(resource_paths) == 0:
44
+ print(" ⚠️ No service paths found for focus targets")
45
+ return library_map
46
+
47
+ print(" 🔍 Scanning " + str(len(resource_paths)) + " services")
48
+
49
+ needed_libs = _discover_resource_libraries(ctx, resource_paths)
50
+
51
+ if len(needed_libs) == 0:
52
+ print(" ℹ️ No internal library dependencies found")
53
+ return library_map
54
+
55
+ platform_count = 0
56
+ product_count = 0
57
+ ddd_count = 0
58
+
59
+ for pkg_name, lib_info in needed_libs.items():
60
+ lib_name = lib_info['name']
61
+ lib_path = lib_info['path']
62
+ lib_label = lib_info['label']
63
+ tilt_resource = lib_info['tilt_resource']
64
+ internal_deps = lib_info.get('internal_deps', [])
65
+
66
+ lib_res_deps = []
67
+ lib_ts_deps = {}
68
+ for dep_pkg in internal_deps:
69
+ dep_info = _get_lib_path_from_package_name(ctx, dep_pkg)
70
+ if dep_info[2]:
71
+ lib_res_deps.append(dep_info[2])
72
+ lib_ts_deps[dep_pkg] = dep_info[0]
73
+
74
+ consumer_paths = []
75
+ for resource_path in resource_paths:
76
+ resource_internal_deps = _read_package_json_deps(ctx, resource_path + '/package.json')
77
+ if pkg_name in resource_internal_deps:
78
+ consumer_paths.append(resource_path)
79
+
80
+ if generate_npmrc:
81
+ generate_npmrc(lib_path)
82
+ if generate_bunfig:
83
+ generate_bunfig(lib_path)
84
+ if generate_tsconfig:
85
+ generate_tsconfig(lib_path, lib_ts_deps)
86
+
87
+ _define_library_resource(
88
+ ctx,
89
+ lib_name,
90
+ lib_path,
91
+ [lib_label],
92
+ internal_deps=lib_res_deps,
93
+ consumer_paths=consumer_paths,
94
+ write_fn=write_fn,
95
+ generate_vite_fn=generate_vite,
96
+ )
97
+ library_map[pkg_name] = tilt_resource
98
+
99
+ if lib_label == 'lib.platform':
100
+ platform_count = platform_count + 1
101
+ elif lib_label == 'lib.product':
102
+ product_count = product_count + 1
103
+ elif lib_label == 'lib.ddd':
104
+ ddd_count = ddd_count + 1
105
+
106
+ print(" ✅ Discovered " + str(len(needed_libs)) + " libraries (platform: " + str(platform_count) + ", product: " + str(product_count) + ", ddd: " + str(ddd_count) + ")")
107
+
108
+ else:
109
+ all_libs_info = {}
110
+
111
+ for lib in ddd_libs:
112
+ pkg_name = internal_scope + lib['name']
113
+ lib_path = lib['path']
114
+ all_libs_info[pkg_name] = {'name': lib['name'], 'path': lib_path, 'label': 'lib.ddd'}
115
+
116
+ for lib_name in platform_libs:
117
+ pkg_name = internal_scope + lib_name
118
+ lib_path = library_roots.get('platform', 'shared-platform-engineering') + '/' + lib_name
119
+ all_libs_info[pkg_name] = {'name': lib_name, 'path': lib_path, 'label': 'lib.platform'}
120
+
121
+ for lib_name in product_libs:
122
+ pkg_name = internal_scope + lib_name
123
+ lib_path = library_roots.get('product', 'shared-product-engineering') + '/' + lib_name
124
+ all_libs_info[pkg_name] = {'name': lib_name, 'path': lib_path, 'label': 'lib.product'}
125
+
126
+ for pkg_name, lib_info in all_libs_info.items():
127
+ lib_name = lib_info['name']
128
+ lib_path = lib_info['path']
129
+ lib_label = lib_info['label']
130
+
131
+ internal_deps = _read_package_json_deps(ctx, lib_path + '/package.json')
132
+
133
+ lib_res_deps = []
134
+ lib_ts_deps = {}
135
+ for dep_pkg in internal_deps:
136
+ dep_info = _get_lib_path_from_package_name(ctx, dep_pkg)
137
+ if dep_info[2]:
138
+ lib_res_deps.append(dep_info[2])
139
+ lib_ts_deps[dep_pkg] = dep_info[0]
140
+
141
+ if generate_npmrc:
142
+ generate_npmrc(lib_path)
143
+ if generate_bunfig:
144
+ generate_bunfig(lib_path)
145
+ if generate_tsconfig:
146
+ generate_tsconfig(lib_path, lib_ts_deps)
147
+
148
+ _define_library_resource(
149
+ ctx,
150
+ lib_name,
151
+ lib_path,
152
+ [lib_label],
153
+ internal_deps=lib_res_deps,
154
+ write_fn=write_fn,
155
+ generate_vite_fn=generate_vite,
156
+ )
157
+ library_map[pkg_name] = 'lib-' + lib_name
158
+
159
+ return library_map
160
+
161
+
162
+ LibsSetup = struct(
163
+ setup_all = setup_libraries,
164
+ )
@@ -0,0 +1,37 @@
1
+ # =============================================================================
2
+ # 🎯 TILT SDK - LIBRARY TSCONFIG FACTORY
3
+ # =============================================================================
4
+
5
+ load('./libs_resource_definition.star', 'LibsResourceDefinition')
6
+
7
+ _library_is_frontend = LibsResourceDefinition.is_frontend
8
+
9
+
10
+ def make_smart_tsconfig_generator(tsconfig_provider, write_fn):
11
+ """
12
+ Factory function that creates a smart tsconfig generator.
13
+ Detects if a library is frontend (manifest or has React) and uses appropriate tsconfig.
14
+
15
+ Args:
16
+ tsconfig_provider: Provider with library_frontend and library_backend methods
17
+ write_fn: Write function for file output
18
+
19
+ Returns:
20
+ function: Config generator function taking (path, deps)
21
+ """
22
+ def generate_tsconfig(path, deps=None):
23
+ is_frontend = _library_is_frontend(path)
24
+
25
+ if is_frontend:
26
+ tsconfig_provider.library_frontend(path, write_fn, internal_deps=deps, is_docker=True)
27
+ tsconfig_provider.library_frontend(path, write_fn, internal_deps=deps, is_docker=False)
28
+ else:
29
+ tsconfig_provider.library_backend(path, write_fn, internal_deps=deps, is_docker=True)
30
+ tsconfig_provider.library_backend(path, write_fn, internal_deps=deps, is_docker=False)
31
+
32
+ return generate_tsconfig
33
+
34
+
35
+ LibsTSConfig = struct(
36
+ make_smart_tsconfig = make_smart_tsconfig_generator,
37
+ )
@@ -0,0 +1,77 @@
1
+ # =============================================================================
2
+ # 🎯 TILT SDK - ORCHESTRATOR APPLY
3
+ # =============================================================================
4
+ # Purpose: thin coordinator for service apply lifecycle.
5
+ # =============================================================================
6
+
7
+ load('../databases.star', 'Database')
8
+ load('./apply_runtime_flags.star', 'RuntimeFlags')
9
+ load('./apply_resource_validation.star', 'ResourceValidation')
10
+ load('./apply_manifest_orchestration.star', 'ManifestOrchestration')
11
+ load('./apply_compose_resource_registration.star', 'ComposeResourceRegistration')
12
+ load('./apply_migrator_orchestration.star', 'MigratorOrchestration')
13
+
14
+
15
+ def apply_app_service(resource_config, ctx):
16
+ """
17
+ Load and configure an application service by delegating each responsibility
18
+ to a focused orchestration module.
19
+ """
20
+ resource_name = resource_config.get('appName', resource_config.get('name', 'UNKNOWN'))
21
+ resource_path = resource_config.get('path', 'NO_PATH')
22
+ should_enable = ctx['should_enable']
23
+
24
+ # resource_config here is a STACK-level grouping from discovery_orchestrator.star
25
+ # (its own 'name'/'appName' is the stack, e.g. "auth") - the actual
26
+ # individual services live nested in resource_config['resources'], each
27
+ # with its own 'name' (e.g. "auth-api-backend"). tdk stack/tdk project -
28
+ # the CLI's own standard scaffolding - populates spec.master's
29
+ # PRE_ALPHA_RESOURCES etc. keyed by individual SERVICE name, not stack
30
+ # name. Checking should_enable() only at the stack level silently drops
31
+ # every service whose stack name isn't itself individually enabled, even
32
+ # when the service is - which is the common case for any project using
33
+ # the CLI's normal `tdk resource` + `tdk stack` workflow. Fall back to
34
+ # checking each nested service name before giving up on this group.
35
+ stack_enabled = should_enable(resource_name)
36
+ service_enabled = False
37
+ if not stack_enabled:
38
+ for nested in resource_config.get('resources', []):
39
+ nested_name = nested.get('name', '')
40
+ if nested_name and should_enable(nested_name):
41
+ print("DEBUG APPLY: stack '{}' not individually enabled, but nested service '{}' is - proceeding".format(resource_name, nested_name))
42
+ service_enabled = True
43
+ break
44
+
45
+ if not stack_enabled and not service_enabled:
46
+ return
47
+
48
+ runtime_flags = RuntimeFlags.resolve()
49
+ ctx['auto_init_config_gen'] = runtime_flags['auto_init_config_gen']
50
+
51
+ ResourceValidation.validate(resource_config)
52
+
53
+ # Only provision database if service has a backend resource (not just frontend)
54
+ has_backend = False
55
+ for resource in resource_config.get('resources', []):
56
+ manifest = resource.get('_manifest', {})
57
+ if manifest.get('appType') == 'backend':
58
+ has_backend = True
59
+ break
60
+
61
+ if should_enable('database-management') and has_backend:
62
+ Database.provision(resource_name)
63
+
64
+ manifest_state = ManifestOrchestration.prepare(resource_config, ctx)
65
+ compose_state = ComposeResourceRegistration.register(
66
+ resource_config,
67
+ ctx,
68
+ runtime_flags,
69
+ manifest_state,
70
+ )
71
+
72
+ MigratorOrchestration.register(
73
+ resource_config,
74
+ ctx,
75
+ runtime_flags,
76
+ compose_state['compose_project_name'],
77
+ )