@tdk-landscape/tdk-cli-core 1.3.14 → 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 (277) hide show
  1. package/README.md +3 -3
  2. package/Tiltfile +144 -0
  3. package/discovery/AGENTS.md +362 -0
  4. package/discovery/TILT_DISCOVERY.star +424 -0
  5. package/discovery/Tiltfile +58 -0
  6. package/discovery/config.star +258 -0
  7. package/discovery/constants.star +127 -0
  8. package/discovery/deterministic.star +211 -0
  9. package/discovery/discovery_daemon.star +191 -0
  10. package/discovery/discovery_orchestrator.star +460 -0
  11. package/discovery/filtering.star +5 -0
  12. package/discovery/identity-management-backend/service.yaml +26 -0
  13. package/discovery/identity-management-frontend/service.yaml +29 -0
  14. package/discovery/identity-sdk/service.yaml +9 -0
  15. package/discovery/incremental_discovery.star +213 -0
  16. package/discovery/indexing.star +7 -0
  17. package/discovery/json_manifest_scanner.star +51 -0
  18. package/discovery/libraries.star +46 -0
  19. package/discovery/loading.star +23 -0
  20. package/discovery/manifest/constants.star +104 -0
  21. package/discovery/manifest/loading.star +386 -0
  22. package/discovery/manifest/normalize.star +281 -0
  23. package/discovery/manifest/validation.star +108 -0
  24. package/discovery/normalization.star +11 -0
  25. package/discovery/registry.star +544 -0
  26. package/discovery/resource_snapshot.py +382 -0
  27. package/discovery/resource_snapshot.star +143 -0
  28. package/discovery/schemas.star +1 -0
  29. package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
  30. package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
  31. package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
  32. package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
  33. package/discovery/test_resource_snapshot.py +251 -0
  34. package/discovery/validation.star +78 -0
  35. package/discovery/versioning.star +1 -0
  36. package/dist/commands/config.d.ts.map +1 -1
  37. package/dist/commands/config.js +11 -0
  38. package/dist/commands/config.js.map +1 -1
  39. package/dist/commands/doctor.d.ts.map +1 -1
  40. package/dist/commands/doctor.js +1 -2
  41. package/dist/commands/doctor.js.map +1 -1
  42. package/dist/commands/project.d.ts.map +1 -1
  43. package/dist/commands/project.js +36 -41
  44. package/dist/commands/project.js.map +1 -1
  45. package/dist/commands/resource.d.ts.map +1 -1
  46. package/dist/commands/resource.js +51 -55
  47. package/dist/commands/resource.js.map +1 -1
  48. package/dist/commands/stack.d.ts.map +1 -1
  49. package/dist/commands/stack.js +22 -24
  50. package/dist/commands/stack.js.map +1 -1
  51. package/dist/commands/ui.d.ts.map +1 -1
  52. package/dist/commands/ui.js +1 -2
  53. package/dist/commands/ui.js.map +1 -1
  54. package/dist/commands/up.d.ts.map +1 -1
  55. package/dist/commands/up.js +1 -2
  56. package/dist/commands/up.js.map +1 -1
  57. package/dist/commands/upgrade.d.ts +8 -0
  58. package/dist/commands/upgrade.d.ts.map +1 -1
  59. package/dist/commands/upgrade.js +62 -21
  60. package/dist/commands/upgrade.js.map +1 -1
  61. package/dist/generator/extension-fetch.d.ts +19 -0
  62. package/dist/generator/extension-fetch.d.ts.map +1 -1
  63. package/dist/generator/extension-fetch.js +71 -5
  64. package/dist/generator/extension-fetch.js.map +1 -1
  65. package/dist/generator/template-engine.d.ts +1 -0
  66. package/dist/generator/template-engine.d.ts.map +1 -1
  67. package/dist/generator/template-engine.js +50 -6
  68. package/dist/generator/template-engine.js.map +1 -1
  69. package/dist/utils/command-helpers.d.ts.map +1 -1
  70. package/dist/utils/command-helpers.js +7 -9
  71. package/dist/utils/command-helpers.js.map +1 -1
  72. package/dist/utils/constants.d.ts +1 -0
  73. package/dist/utils/constants.d.ts.map +1 -1
  74. package/dist/utils/constants.js +1 -0
  75. package/dist/utils/constants.js.map +1 -1
  76. package/dist/utils/errors.d.ts +2 -0
  77. package/dist/utils/errors.d.ts.map +1 -1
  78. package/dist/utils/errors.js +6 -1
  79. package/dist/utils/errors.js.map +1 -1
  80. package/dist/utils/paths.js +1 -1
  81. package/dist/utils/paths.js.map +1 -1
  82. package/dist/utils/project-features.d.ts.map +1 -1
  83. package/dist/utils/project-features.js +1 -1
  84. package/dist/utils/project-features.js.map +1 -1
  85. package/dist/utils/resource-features.d.ts.map +1 -1
  86. package/dist/utils/resource-features.js +2 -2
  87. package/dist/utils/resource-features.js.map +1 -1
  88. package/dist/utils/tar.js +4 -4
  89. package/dist/utils/tar.js.map +1 -1
  90. package/dist/utils/validation.d.ts +7 -0
  91. package/dist/utils/validation.d.ts.map +1 -1
  92. package/dist/utils/validation.js +9 -0
  93. package/dist/utils/validation.js.map +1 -1
  94. package/engine/AGENTS.md +705 -0
  95. package/engine/README.md +29 -0
  96. package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
  97. package/engine/Tiltfile +80 -0
  98. package/engine/assets/docker/golden-layers.Dockerfile +221 -0
  99. package/engine/assets/scripts/cleanup-completed-migrator-images.sh +37 -0
  100. package/engine/assets/scripts/cleanup-tilt-images.sh +120 -0
  101. package/engine/assets/scripts/mac-m1-resource-monitor.sh +121 -0
  102. package/engine/config.star +3 -0
  103. package/engine/docs/AUTODISCOVERY_TEST.md +182 -0
  104. package/engine/docs/C4-ARCHITECTURE-operations.md +396 -0
  105. package/engine/docs/C4-ARCHITECTURE-overview.md +284 -0
  106. package/engine/docs/C4-ARCHITECTURE.md +17 -0
  107. package/engine/docs/GOLDEN_IMAGE_INTEGRATION.md +349 -0
  108. package/engine/docs/MANIFEST_DRIVEN_ARCHITECTURE.md +357 -0
  109. package/engine/docs/README.md +284 -0
  110. package/engine/entrypoint.star +97 -0
  111. package/engine/lifecycle/orchestrator.star +260 -0
  112. package/engine/paths.star +717 -0
  113. package/engine/schemas/manifest-schema.json +301 -0
  114. package/engine/schemas/service-schema.json +301 -0
  115. package/engine/scripts/README.md +89 -0
  116. package/engine/scripts/build-and-publish-lib.sh +205 -0
  117. package/engine/scripts/check-lib-publish.sh +85 -0
  118. package/engine/scripts/debug-container.sh +258 -0
  119. package/engine/scripts/generate-manifest.sh +197 -0
  120. package/engine/spec.master +702 -0
  121. package/engine/spec.master.example +341 -0
  122. package/engine/topologies/README.md +34 -0
  123. package/engine/topologies/platform/docker/AGENTS.md +59 -0
  124. package/engine/topologies/platform/docker/auth/auth.star +167 -0
  125. package/engine/topologies/platform/docker/build/golden_image.star +37 -0
  126. package/engine/topologies/platform/docker/build/golden_image_build.star +82 -0
  127. package/engine/topologies/platform/docker/build/golden_image_constants.star +93 -0
  128. package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +291 -0
  129. package/engine/topologies/platform/docker/compose/compose.star +636 -0
  130. package/engine/topologies/platform/docker/compose/compose_helpers.star +52 -0
  131. package/engine/topologies/platform/docker/compose/traefik_standalone.star +53 -0
  132. package/engine/topologies/platform/docker/config/bunignore.star +142 -0
  133. package/engine/topologies/platform/docker/config/dockerignore.star +150 -0
  134. package/engine/topologies/platform/docker/constants.star +170 -0
  135. package/engine/topologies/platform/docker/dockerfile/dockerfile.star +54 -0
  136. package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +73 -0
  137. package/engine/topologies/platform/docker/index.star +27 -0
  138. package/engine/topologies/platform/docker/layers/bun_helpers.star +23 -0
  139. package/engine/topologies/platform/docker/layers/infisical/index.star +40 -0
  140. package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +262 -0
  141. package/engine/topologies/platform/docker/layers/l1_base_layers.star +87 -0
  142. package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +125 -0
  143. package/engine/topologies/platform/docker/layers/l3_builder_layers.star +209 -0
  144. package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +214 -0
  145. package/engine/topologies/platform/docker/layers/prisma/constants.star +135 -0
  146. package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +96 -0
  147. package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +109 -0
  148. package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +98 -0
  149. package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +126 -0
  150. package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +161 -0
  151. package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +119 -0
  152. package/engine/topologies/platform/docker/networking/api_path_constants.star +230 -0
  153. package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +27 -0
  154. package/engine/topologies/platform/docker/networking/traefik.star +232 -0
  155. package/engine/topologies/platform/docker/networking/traefik_constants.star +146 -0
  156. package/engine/topologies/platform/docker/networking/traefik_helpers.star +160 -0
  157. package/engine/topologies/platform/docker/secrets/infisical.star +135 -0
  158. package/engine/topologies/platform/net/proxy.star +4 -0
  159. package/engine/topologies/platform/registries/local.star +4 -0
  160. package/engine/topologies/platform/security/secrets.star +239 -0
  161. package/engine/topologies/platform/state/relational.star +4 -0
  162. package/engine/topologies/tilt/common/AGENTS.md +59 -0
  163. package/engine/topologies/tilt/common/utils.star +364 -0
  164. package/engine/topologies/tilt/common/utils_debug.star +69 -0
  165. package/engine/topologies/tilt/common/utils_deterministic.star +168 -0
  166. package/engine/topologies/tilt/common/utils_docker_networks.star +46 -0
  167. package/engine/topologies/tilt/common/utils_env.star +43 -0
  168. package/engine/topologies/tilt/common/utils_output.star +97 -0
  169. package/engine/topologies/tilt/config/AGENTS.md +68 -0
  170. package/engine/topologies/tilt/config/defaults.star +3 -0
  171. package/engine/topologies/tilt/config/feature_flags.star +10 -0
  172. package/engine/topologies/tilt/config/global.star +55 -0
  173. package/engine/topologies/tilt/config/profiles.star +382 -0
  174. package/engine/topologies/tilt/generators/agents_md.star +62 -0
  175. package/engine/topologies/tilt/generators/api_gateway.star +145 -0
  176. package/engine/topologies/tilt/generators/index.star +124 -0
  177. package/engine/topologies/tilt/generators/infisical/README.md +424 -0
  178. package/engine/topologies/tilt/generators/infisical/examples.star +312 -0
  179. package/engine/topologies/tilt/generators/infisical/index.star +57 -0
  180. package/engine/topologies/tilt/generators/infisical/machine_identity.star +420 -0
  181. package/engine/topologies/tilt/generators/infisical/organization.star +534 -0
  182. package/engine/topologies/tilt/generators/infisical/path_manager.star +476 -0
  183. package/engine/topologies/tilt/generators/infisical/secrets_generator.star +420 -0
  184. package/engine/topologies/tilt/generators/nginx_conf.star +143 -0
  185. package/engine/topologies/tilt/generators/npmrc.star +111 -0
  186. package/engine/topologies/tilt/generators/tsconfig.star +23 -0
  187. package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +71 -0
  188. package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +124 -0
  189. package/engine/topologies/tilt/generators/typescript/common.star +7 -0
  190. package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +76 -0
  191. package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +110 -0
  192. package/engine/topologies/tilt/generators/typescript/include.star +23 -0
  193. package/engine/topologies/tilt/generators/typescript/playwright_config.star +40 -0
  194. package/engine/topologies/tilt/generators/typescript/prisma_config.star +49 -0
  195. package/engine/topologies/tilt/generators/validators.star +853 -0
  196. package/engine/topologies/tilt/generators/vite/backend.star +78 -0
  197. package/engine/topologies/tilt/generators/vite/frontend.star +98 -0
  198. package/engine/topologies/tilt/generators/vite/generators.star +43 -0
  199. package/engine/topologies/tilt/generators/vite/helpers.star +244 -0
  200. package/engine/topologies/tilt/generators/vite/library.star +65 -0
  201. package/engine/topologies/tilt/generators/vite/sdk.star +73 -0
  202. package/engine/topologies/tilt/generators/vite/templates.star +737 -0
  203. package/engine/topologies/tilt/generators/vite_config.star +22 -0
  204. package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
  205. package/engine/topologies/tilt/manifest/README.md +693 -0
  206. package/engine/topologies/tilt/manifest/__init__.star +218 -0
  207. package/engine/topologies/tilt/manifest/constants.star +252 -0
  208. package/engine/topologies/tilt/manifest/errors.star +266 -0
  209. package/engine/topologies/tilt/manifest/integration.star +339 -0
  210. package/engine/topologies/tilt/manifest/json_to_yaml.py +54 -0
  211. package/engine/topologies/tilt/manifest/loader.star +214 -0
  212. package/engine/topologies/tilt/manifest/mapper.star +227 -0
  213. package/engine/topologies/tilt/manifest/parser.star +400 -0
  214. package/engine/topologies/tilt/manifest/schema.star +462 -0
  215. package/engine/topologies/tilt/manifest/tests/test_integration.star +276 -0
  216. package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +397 -0
  217. package/engine/topologies/tilt/manifest/tests/test_manifest.star +316 -0
  218. package/engine/topologies/tilt/manifest/tests/test_validator.star +470 -0
  219. package/engine/topologies/tilt/manifest/validator.star +717 -0
  220. package/engine/topologies/tilt/manifest/yaml_to_json.py +18 -0
  221. package/engine/topologies/tilt/resources/AGENTS.md +71 -0
  222. package/engine/topologies/tilt/resources/conditions.star +3 -0
  223. package/engine/topologies/tilt/resources/databases.star +244 -0
  224. package/engine/topologies/tilt/resources/declaration.star +3 -0
  225. package/engine/topologies/tilt/resources/deps.star +3 -0
  226. package/engine/topologies/tilt/resources/infra-loader.star +437 -0
  227. package/engine/topologies/tilt/resources/libs.star +30 -0
  228. package/engine/topologies/tilt/resources/libs_discovery.star +102 -0
  229. package/engine/topologies/tilt/resources/libs_paths.star +79 -0
  230. package/engine/topologies/tilt/resources/libs_resource_definition.star +151 -0
  231. package/engine/topologies/tilt/resources/libs_setup.star +164 -0
  232. package/engine/topologies/tilt/resources/libs_tsconfig.star +37 -0
  233. package/engine/topologies/tilt/resources/orchestrator/apply.star +77 -0
  234. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +431 -0
  235. package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +81 -0
  236. package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +148 -0
  237. package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +36 -0
  238. package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +44 -0
  239. package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +164 -0
  240. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
  241. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +21 -0
  242. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +134 -0
  243. package/engine/topologies/tilt/resources/orchestrator/generators/env.star +258 -0
  244. package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +169 -0
  245. package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +524 -0
  246. package/engine/topologies/tilt/resources/orchestrator/helpers.star +33 -0
  247. package/engine/topologies/tilt/resources/orchestrator.star +54 -0
  248. package/engine/topologies/tilt/resources/ordering.star +3 -0
  249. package/engine/topologies/tilt/resources/triggers.star +3 -0
  250. package/engine/topologies/tilt/resources/watchers.star +299 -0
  251. package/engine/where-things-live.star +717 -0
  252. package/ext/Tiltfile +66 -0
  253. package/ext/ide-components/README.md +219 -0
  254. package/ext/ide-components/code_executor/server.py +268 -0
  255. package/ext/ide-components/code_viewer/server.py +206 -0
  256. package/ext/ide-components/config_inspector/server.py +1050 -0
  257. package/ext/ide-components/file_browser/server.py +285 -0
  258. package/ext/ide-components/shared/config_service.py +469 -0
  259. package/ext/ide-components/shared/file_utils.py +298 -0
  260. package/ext/ide-components/shared/http_utils.py +232 -0
  261. package/ext/ide-components/shared/static/styles.css +1334 -0
  262. package/ext/ide-components/shared/syntax_highlighter.py +140 -0
  263. package/ext/ide-components/shared/template_engine.py +123 -0
  264. package/ext/ide-components/shared/templates/base.html +121 -0
  265. package/ext/ide-components/shared/test_config_service.py +326 -0
  266. package/ext/ide-components/shared/tilt_integration.py +158 -0
  267. package/ext/ui-enhancements/cron-status-server.sh +49 -0
  268. package/ext/ui-enhancements/cron-status-tracker.sh +146 -0
  269. package/ext/ui-enhancements/extension.yaml +36 -0
  270. package/ext/ui-enhancements/tiltfile.py +99 -0
  271. package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
  272. package/ext/ui-enhancements/ui/help-panel.css +279 -0
  273. package/ext/ui-enhancements/ui/icons.css +125 -0
  274. package/ext/ui-enhancements/ui/tooltips.css +114 -0
  275. package/package.json +13 -9
  276. package/specs/specs/TILT_SERVICE_DEFAULTS.star +205 -0
  277. package/specs/specs/TILT_TECH_STACK.star +159 -0
@@ -0,0 +1,160 @@
1
+ # =============================================================================
2
+ # 🐳 TILT SDK - TRAEFIK HELPERS
3
+ # =============================================================================
4
+
5
+ # === INLINED CONSTANTS for pure extension loading ===
6
+ TRAEFIK_API_BASE_PATH = "/api"
7
+ # === END INLINED CONSTANTS ===
8
+
9
+
10
+ load(
11
+ "./traefik_constants.star",
12
+ "TRAEFIK_PROJECT_HOST",
13
+ "TRAEFIK_PROJECT_APP_HOST",
14
+ "TRAEFIK_PROJECT_API_HOST",
15
+ "TRAEFIK_ENABLE_BACKEND_PATH_RULE",
16
+ "TRAEFIK_ENABLE_BACKEND_HOST_RULE",
17
+ "TRAEFIK_ENABLE_FRONTEND_HOST_RULE",
18
+ "TRAEFIK_ENABLE_FRONTEND_PATH_RULE",
19
+ "TRAEFIK_FRONTEND_LOCALHOST_SUFFIX",
20
+ "TRAEFIK_WEB_ENTRYPOINT",
21
+ "TRAEFIK_WEBSECURE_ENTRYPOINT",
22
+ "TRAEFIK_API_VERSION",
23
+ )
24
+
25
+
26
+
27
+ def build_entrypoints(enable_http, enable_https):
28
+ entrypoints = []
29
+ if enable_http:
30
+ entrypoints.append(TRAEFIK_WEB_ENTRYPOINT)
31
+ if enable_https:
32
+ entrypoints.append(TRAEFIK_WEBSECURE_ENTRYPOINT)
33
+ if len(entrypoints) == 0:
34
+ entrypoints.append(TRAEFIK_WEB_ENTRYPOINT)
35
+ return ",".join(entrypoints)
36
+
37
+
38
+ def frontend_rule(res_name, base_path, traefik_host):
39
+ parts = []
40
+ if TRAEFIK_ENABLE_FRONTEND_HOST_RULE:
41
+ parts.append(
42
+ "Host(`{res_name}{suffix}`)".format(
43
+ res_name=res_name,
44
+ suffix=TRAEFIK_FRONTEND_LOCALHOST_SUFFIX,
45
+ ),
46
+ )
47
+ if traefik_host:
48
+ parts.append("Host(`{traefik_host}`)".format(traefik_host=traefik_host))
49
+ if TRAEFIK_ENABLE_FRONTEND_PATH_RULE:
50
+ parts.append(
51
+ "(Host(`{host}`) && PathPrefix(`{base_path}`))".format(
52
+ host=TRAEFIK_PROJECT_APP_HOST,
53
+ base_path=base_path,
54
+ ),
55
+ )
56
+ # Also accept localhost for local testing
57
+ parts.append(
58
+ "(Host(`localhost`) && PathPrefix(`{base_path}`))".format(
59
+ base_path=base_path,
60
+ ),
61
+ )
62
+ return " || ".join(parts)
63
+
64
+
65
+ def backend_rule(traefik_host, traefik_path):
66
+ parts = []
67
+ if TRAEFIK_ENABLE_BACKEND_HOST_RULE:
68
+ parts.append("Host(`{host}`)".format(host=traefik_host))
69
+ if TRAEFIK_ENABLE_BACKEND_PATH_RULE and traefik_path:
70
+ parts.append("PathPrefix(`{path}`)".format(path=traefik_path))
71
+ return " || ".join(parts)
72
+
73
+
74
+ def _pluralize_stack(stack):
75
+ """Convert stack to proper plural form.
76
+
77
+ Handles irregular plurals and special cases.
78
+
79
+ Args:
80
+ stack: Singular stack name (e.g., "user", "order", "product")
81
+
82
+ Returns:
83
+ str: Pluralized stack name (e.g., "users", "orders", "products")
84
+ """
85
+ # Already plural
86
+ if stack.endswith("s"):
87
+ return stack
88
+
89
+ # Irregular plurals that don't follow normal rules
90
+ irregulars = {
91
+ "identity": "identity",
92
+ "profile": "profile", # profiles is wrong, profile is correct
93
+ "staff": "staff",
94
+ "inventory": "inventory",
95
+ }
96
+
97
+ if stack in irregulars:
98
+ return irregulars[stack]
99
+
100
+ # Words ending in 'y' preceded by a consonant -> 'ies'
101
+ if stack.endswith("y") and len(stack) > 1 and stack[-2] not in "aeiou":
102
+ return stack[:-1] + "ies"
103
+
104
+ # Words ending in ch, sh, ss, x, z, o -> 'es'
105
+ if stack.endswith(("ch", "sh", "ss", "x", "z", "o")):
106
+ return stack + "es"
107
+
108
+ return stack + "s"
109
+
110
+
111
+ def get_api_path(stack, manifest=None):
112
+ """Generate API path from stack. Converts stack to proper resource name.
113
+
114
+ URL Restructuring: Changed from /api/v1/{stack} to /api/{resource-name}
115
+
116
+ Args:
117
+ stack: Resource stack from manifest (from service.json)
118
+
119
+ Returns:
120
+ str: API path like "/api/{stack}-management"
121
+ """
122
+ # NEW: Use {stack}-management pattern instead of pluralized stack
123
+ # This matches the resource naming convention ({stack}-management)
124
+ return "{base}/{stack}-management".format(
125
+ base=TRAEFIK_API_BASE_PATH,
126
+ stack=stack,
127
+ )
128
+
129
+
130
+ def cli_api_path(resource_name, manifest=None):
131
+ """API path printed by `tdk up` and served on api.{project}.localhost.
132
+
133
+ Matches cli/src/commands/up.ts: `/api/{name}` with a trailing `-api` stripped.
134
+ """
135
+ if manifest and manifest.get("apiPath"):
136
+ return manifest.get("apiPath")
137
+ name = resource_name or (manifest.get("appName", "") if manifest else "")
138
+ if name.endswith("-api"):
139
+ name = name[:-4]
140
+ return TRAEFIK_API_BASE_PATH + "/" + name
141
+
142
+
143
+ def project_backend_rule(manifest, resource_name=None):
144
+ """Generate routing rule for api.{project}.localhost from manifest.
145
+
146
+ Args:
147
+ manifest: Service manifest dictionary
148
+ resource_name: Runtime resource name (e.g. auth-api-backend)
149
+
150
+ Returns:
151
+ str: Traefik routing rule for project localhost domain
152
+ """
153
+ if not manifest and not resource_name:
154
+ return ""
155
+
156
+ api_path = cli_api_path(resource_name, manifest)
157
+ return "Host(`{host}`) && PathPrefix(`{path}`)".format(
158
+ host=TRAEFIK_PROJECT_API_HOST,
159
+ path=api_path,
160
+ )
@@ -0,0 +1,135 @@
1
+ # =============================================================================
2
+ # 🔐 INFISICAL ENVIRONMENT GENERATOR (Refactored)
3
+ # =============================================================================
4
+ # Uses Starlark generators for consistent secret management
5
+ # =============================================================================
6
+ #
7
+ # This module provides:
8
+ # - Environment variable generation for Infisical integration
9
+ # - Uses SecretsGenerator for consistent configuration
10
+ #
11
+ # Usage:
12
+ # load("../secrets/infisical.star", "InfisicalEnv")
13
+ # env_vars = InfisicalEnv.get_for_service("my-service")
14
+ # =============================================================================
15
+
16
+ load("../constants.star", "PlatformDockerConstants")
17
+ load("../../../tilt/generators/infisical/secrets_generator.star", "SecretsGenerator")
18
+ load("../../../tilt/generators/infisical/path_manager.star", "PathManager")
19
+
20
+ def _get_infisical_base_url():
21
+ """Get the Infisical base URL."""
22
+ return "http://{}-infisical:8080".format(PlatformDockerConstants.PROJECT_NAME)
23
+
24
+ def get_infisical_environment_vars(as_array=True, resource_name=None, resource_type="backend"):
25
+ """
26
+ Generate environment variables for Infisical integration.
27
+
28
+ Uses Starlark generators for consistent configuration.
29
+
30
+ Args:
31
+ as_array: If True, return as YAML array format; else as dict format
32
+ resource_name: Optional service name for service-specific configuration
33
+ resource_type: Service type for path generation
34
+
35
+ Returns:
36
+ String with environment variables in YAML format
37
+ """
38
+ infisical_url = _get_infisical_base_url()
39
+
40
+ if resource_name:
41
+ # Use generator for service-specific configuration
42
+ secret_path = PathManager.get_known_resource_path(resource_name)
43
+ if not secret_path:
44
+ path_plan = PathManager.plan_resource_path(resource_name, resource_type)
45
+ secret_path = path_plan["full_path"]
46
+
47
+ config = SecretsGenerator.generate_for_service(
48
+ resource_name=resource_name,
49
+ secret_path=secret_path,
50
+ resource_type=resource_type,
51
+ )
52
+
53
+ env = config["docker_compose"]["environment"]
54
+
55
+ if as_array:
56
+ lines = []
57
+ for key, value in env.items():
58
+ lines.append(" - {}={}".format(key, value))
59
+ return "\n".join(lines)
60
+ else:
61
+ lines = []
62
+ for key, value in env.items():
63
+ lines.append(" {}: {}".format(key, value))
64
+ return "\n".join(lines)
65
+
66
+ # Fallback to base configuration (no service-specific paths)
67
+ base_env = {
68
+ "INFISICAL_CLIENT_ID": "${INFISICAL_CLIENT_ID:-}",
69
+ "INFISICAL_CLIENT_SECRET": "${INFISICAL_CLIENT_SECRET:-}",
70
+ "INFISICAL_PROJECT_ID": "${INFISICAL_PROJECT_ID:-}",
71
+ "INFISICAL_SITE_URL": "${INFISICAL_SITE_URL:-" + infisical_url + "}",
72
+ "INFISICAL_ENV": "${INFISICAL_ENV:-dev}",
73
+ "INFISICAL_ENABLED": "${INFISICAL_ENABLED:-true}",
74
+ }
75
+
76
+ if as_array:
77
+ lines = []
78
+ for key, value in base_env.items():
79
+ lines.append(" - {}={}".format(key, value))
80
+ return "\n".join(lines)
81
+ else:
82
+ lines = []
83
+ for key, value in base_env.items():
84
+ lines.append(" {}: {}".format(key, value))
85
+ return "\n".join(lines)
86
+
87
+ def get_for_service(resource_name, resource_type="backend", as_array=True):
88
+ """
89
+ Get Infisical environment variables for a specific service.
90
+
91
+ Args:
92
+ resource_name: Name of the service
93
+ resource_type: Type of service
94
+ as_array: Return format (array or dict style)
95
+
96
+ Returns:
97
+ String with environment variables
98
+ """
99
+ return get_infisical_environment_vars(
100
+ as_array=as_array,
101
+ resource_name=resource_name,
102
+ resource_type=resource_type,
103
+ )
104
+
105
+ def get_batch_for_services(resource_configs):
106
+ """
107
+ Get Infisical environment variables for multiple services.
108
+
109
+ Args:
110
+ resource_configs: List of dicts with 'name' and optional 'type'
111
+
112
+ Returns:
113
+ Dict mapping service names to environment variable strings
114
+ """
115
+ results = {}
116
+
117
+ for config in resource_configs:
118
+ name = config.get("name")
119
+ svc_type = config.get("type", "backend")
120
+
121
+ if name:
122
+ results[name] = get_for_service(name, svc_type)
123
+
124
+ return results
125
+
126
+ # =============================================================================
127
+ # Public API
128
+ # =============================================================================
129
+
130
+ InfisicalEnv = struct(
131
+ get_base_url=_get_infisical_base_url,
132
+ get_infisical_environment_vars=get_infisical_environment_vars,
133
+ get_for_service=get_for_service,
134
+ get_batch_for_services=get_batch_for_services,
135
+ )
@@ -0,0 +1,4 @@
1
+ load("../../tilt/resources/infra-loader.star", _Infra = "Infra")
2
+
3
+ def load(should_enable):
4
+ return _Infra.load_proxy(should_enable)
@@ -0,0 +1,4 @@
1
+ load("../../tilt/resources/infra-loader.star", _Infra = "Infra")
2
+
3
+ def load(should_enable):
4
+ return _Infra.load_verdaccio(should_enable)
@@ -0,0 +1,239 @@
1
+ # =============================================================================
2
+ # 🔐 INFISICAL SECURITY MODULE
3
+ # =============================================================================
4
+ # Centralizes Infisical secrets management configuration
5
+ # =============================================================================
6
+ #
7
+ # This module provides:
8
+ # - Infrastructure loading (Infisical containers)
9
+ # - Secret injection configuration for services
10
+ # - Machine identity management
11
+ # - Organization and path management
12
+ #
13
+ # Usage:
14
+ # load("../../platform/security/secrets.star", "Secrets")
15
+ #
16
+ # # Load Infisical infrastructure
17
+ # Secrets.load_infra(should_enable_fn)
18
+ #
19
+ # # Configure service secrets
20
+ # config = Secrets.configure_service("my-service", "/services/my-service")
21
+ # =============================================================================
22
+
23
+ # Infrastructure loader
24
+ load("../../tilt/resources/infra-loader.star", _Infra="Infra")
25
+
26
+ # Generators
27
+ load("../../tilt/generators/infisical/index.star", _Infisical="Infisical")
28
+
29
+ # Docker layers integration
30
+ load("../../platform/docker/layers/infisical/index.star", "InfisicalLayers")
31
+
32
+ # =============================================================================
33
+ # Infrastructure Loading
34
+ # =============================================================================
35
+
36
+ def _load_infra(should_enable):
37
+ """Load Infisical infrastructure containers."""
38
+ return _Infra.load_infisical(should_enable)
39
+
40
+ # =============================================================================
41
+ # Resource Secret Configuration
42
+ # =============================================================================
43
+
44
+ def _configure_service(resource_name, secret_path, resource_type="backend", command=None):
45
+ """
46
+ Configure secret injection for a resource.
47
+
48
+ Args:
49
+ resource_name: Name of the resource
50
+ secret_path: Infisical path (e.g., "/services/my-service")
51
+ resource_type: Type of resource (backend, frontend, worker, etc.)
52
+ command: Entrypoint command (optional)
53
+
54
+ Returns:
55
+ Configuration dict for the resource
56
+ """
57
+ return _Infisical.Secrets.generate_for_service(
58
+ resource_name=resource_name,
59
+ secret_path=secret_path,
60
+ resource_type=resource_type,
61
+ command=command,
62
+ )
63
+
64
+ def _configure_services_batch(services_config):
65
+ """
66
+ Configure secrets for multiple resources.
67
+
68
+ Args:
69
+ services_config: List of dicts with resource configuration
70
+
71
+ Returns:
72
+ Dict mapping resource names to configurations
73
+ """
74
+ return _Infisical.Secrets.generate_for_services_batch(services_config)
75
+
76
+ # =============================================================================
77
+ # Path Management
78
+ # =============================================================================
79
+
80
+ def _plan_resource_path(resource_name, resource_type="backend"):
81
+ """Plan Infisical path for a resource."""
82
+ return _Infisical.Paths.plan_resource_path(resource_name, resource_type)
83
+
84
+ def _plan_batch_paths(resource_names, resource_type="backend"):
85
+ """Plan paths for multiple resources."""
86
+ return _Infisical.Paths.plan_batch_resource_paths(resource_names, resource_type)
87
+
88
+ def _get_known_resource_path(resource_name):
89
+ """Get predefined path for a known resource."""
90
+ return _Infisical.Paths.get_known_resource_path(resource_name)
91
+
92
+ # =============================================================================
93
+ # Machine Identity
94
+ # =============================================================================
95
+
96
+ def _generate_machine_identity(identity_name, access_paths=None, project_id=None):
97
+ """
98
+ Generate machine identity configuration.
99
+
100
+ Args:
101
+ identity_name: Name of the machine identity
102
+ access_paths: List of paths the identity can access
103
+ project_id: Project ID
104
+
105
+ Returns:
106
+ Machine identity configuration
107
+ """
108
+ return _Infisical.Identity.generate_universal_auth(
109
+ identity_name=identity_name,
110
+ access_paths=access_paths,
111
+ project_id=project_id,
112
+ )
113
+
114
+ def _get_development_machine(project_id=None):
115
+ """Get development machine identity configuration."""
116
+ return _Infisical.Identity.generate_development_machine(
117
+ identity_name="dev-machine",
118
+ project_id=project_id,
119
+ )
120
+
121
+ def _get_ci_machine(project_id=None):
122
+ """Get CI/CD machine identity configuration."""
123
+ return _Infisical.Identity.generate_ci_machine(project_id=project_id)
124
+
125
+ # =============================================================================
126
+ # Organization Setup
127
+ # =============================================================================
128
+
129
+ def _generate_org_config(org_name=None, environments=None, resource_names=None):
130
+ """
131
+ Generate organization configuration.
132
+
133
+ Args:
134
+ org_name: Organization name
135
+ environments: List of environment names
136
+ resource_names: List of service names
137
+
138
+ Returns:
139
+ Organization configuration dict
140
+ """
141
+ return _Infisical.Org.generate_config(
142
+ org_name=org_name,
143
+ env_names=environments,
144
+ resource_names=resource_names,
145
+ )
146
+
147
+ # =============================================================================
148
+ # Predefined Services Configuration
149
+ # =============================================================================
150
+
151
+ # Project-specific service configurations should be defined in .tdk/project.json
152
+ # This dict is kept for backward compatibility but should be empty for generic TDK CLI
153
+ PREDEFINED_RESOURCES = {}
154
+
155
+ def _get_predefined_resource_config(resource_name):
156
+ """Get predefined configuration for a known resource."""
157
+ return PREDEFINED_RESOURCES.get(resource_name)
158
+
159
+ def _configure_predefined_service(resource_name, command=None):
160
+ """
161
+ Configure a predefined resource by name.
162
+
163
+ Args:
164
+ resource_name: Name of the predefined resource
165
+ command: Entrypoint command (optional)
166
+
167
+ Returns:
168
+ Resource configuration or None if not predefined
169
+ """
170
+ config = _get_predefined_resource_config(resource_name)
171
+ if not config:
172
+ return None
173
+
174
+ return _configure_service(
175
+ resource_name=resource_name,
176
+ secret_path=config["path"],
177
+ resource_type=config["type"],
178
+ command=command,
179
+ )
180
+
181
+ # =============================================================================
182
+ # Batch Configuration for All Resources
183
+ # =============================================================================
184
+
185
+ def _configure_all_predefined_services(command=None):
186
+ """
187
+ Configure all predefined resources.
188
+
189
+ Args:
190
+ command: Default entrypoint command (optional)
191
+
192
+ Returns:
193
+ Dict mapping resource names to configurations
194
+ """
195
+ results = {}
196
+
197
+ for resource_name in PREDEFINED_RESOURCES:
198
+ config = _configure_predefined_service(resource_name, command)
199
+ if config:
200
+ results[resource_name] = config
201
+
202
+ return results
203
+
204
+ # =============================================================================
205
+ # Public API
206
+ # =============================================================================
207
+
208
+ Secrets = struct(
209
+ # Infrastructure
210
+ load_infra=_load_infra,
211
+
212
+ # Resource configuration
213
+ configure_service=_configure_service,
214
+ configure_services_batch=_configure_services_batch,
215
+ configure_predefined_service=_configure_predefined_service,
216
+ configure_all_predefined_services=_configure_all_predefined_services,
217
+
218
+ # Path management
219
+ plan_resource_path=_plan_resource_path,
220
+ plan_batch_paths=_plan_batch_paths,
221
+ get_known_resource_path=_get_known_resource_path,
222
+
223
+ # Machine identity
224
+ generate_machine_identity=_generate_machine_identity,
225
+ get_development_machine=_get_development_machine,
226
+ get_ci_machine=_get_ci_machine,
227
+
228
+ # Organization
229
+ generate_org_config=_generate_org_config,
230
+
231
+ # Constants
232
+ PREDEFINED_RESOURCES=PREDEFINED_RESOURCES,
233
+
234
+ # Direct access to submodules
235
+ Infisical=_Infisical,
236
+
237
+ # Docker layers integration
238
+ Layers=InfisicalLayers,
239
+ )
@@ -0,0 +1,4 @@
1
+ load("../../tilt/resources/infra-loader.star", _Infra = "Infra")
2
+
3
+ def load(should_enable):
4
+ return _Infra.load_database(should_enable)
@@ -0,0 +1,59 @@
1
+ # AGENTS.md - Common Utilities
2
+
3
+ ## Purpose
4
+
5
+ Shared utility functions used across all Tilt topologies.
6
+
7
+ ## Key Files
8
+
9
+ ### Core Utilities
10
+ - **`utils.star`** - `Utils` struct with file operations, path manipulation
11
+ - **`paths.star`** - Path utilities, path joining, normalization
12
+ - **`strings.star`** - String manipulation helpers
13
+
14
+ ### Tilt Helpers
15
+ - **`tilt.star`** - Tilt-specific utilities
16
+ - **`debug.star`** - Debug logging, tracing
17
+
18
+ ## Common Tasks
19
+
20
+ ### Read JSON file
21
+ ```starlark
22
+ load("./utils.star", "Utils")
23
+ content = Utils.read_json_file(path)
24
+ ```
25
+
26
+ ### Check if path exists
27
+ ```starlark
28
+ load("./utils.star", "Utils")
29
+ exists = Utils.path_exists(path)
30
+ ```
31
+
32
+ ### Join paths
33
+ ```starlark
34
+ load("./utils.star", "Utils")
35
+ full_path = Utils.join_paths(base, relative)
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ Most topology modules load this:
41
+ ```starlark
42
+ load("../common/utils.star", "Utils")
43
+ ```
44
+
45
+ ## Important Notes
46
+
47
+ - These are pure Starlark functions (no Tilt builtins)
48
+ - Safe to use in any context
49
+ - No side effects
50
+
51
+ ## Available Functions
52
+
53
+ See `Utils` struct for full list:
54
+ - `read_json_file(path)`
55
+ - `path_exists(path)`
56
+ - `join_paths(base, rel)`
57
+ - `sanitize_name(name)`
58
+ - `extract_domain(path)`
59
+ - `get_relative_path(from, to)`