@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
@@ -0,0 +1,312 @@
1
+ # =============================================================================
2
+ # 🔐 INFISICAL STARLARK GENERATORS - USAGE EXAMPLES
3
+ # =============================================================================
4
+ # This file demonstrates how to use the new Infisical Starlark generators
5
+ # =============================================================================
6
+
7
+ # =============================================================================
8
+ # 1. Load the modules
9
+ # =============================================================================
10
+
11
+ # Option 1: Load the complete Infisical module
12
+ load("engine/topologies/tilt/generators/infisical/index.star", "Infisical")
13
+
14
+ # Option 2: Load individual submodules
15
+ load("engine/topologies/tilt/generators/infisical/secrets_generator.star", "SecretsGenerator")
16
+ load("engine/topologies/tilt/generators/infisical/path_manager.star", "PathManager")
17
+ load("engine/topologies/tilt/generators/infisical/machine_identity.star", "MachineIdentity")
18
+ load("engine/topologies/tilt/generators/infisical/organization.star", "Organization")
19
+
20
+ # Option 3: Load from the generators index (recommended)
21
+ load("engine/topologies/tilt/generators/index.star", "Generators")
22
+ Infisical = Generators.SecretsManagement
23
+
24
+ # Option 4: Load from security module (complete integration)
25
+ load("engine/topologies/platform/security/secrets.star", "Secrets")
26
+
27
+ # =============================================================================
28
+ # 2. Generate Secret Configuration for a Service
29
+ # =============================================================================
30
+
31
+ def example_resource_secrets():
32
+ """Example: Configure secrets for a single service."""
33
+
34
+ # Generate configuration for user service
35
+ config = Infisical.Secrets.generate_for_service(
36
+ resource_name="user-management-backend",
37
+ secret_path="/services/user",
38
+ resource_type="backend",
39
+ command="bun run src/index.ts",
40
+ )
41
+
42
+ # Access the generated configuration
43
+ print("Service:", config["resource_name"])
44
+ print("Path:", config["secret_path"])
45
+ print("Required Secrets:", config["required_secrets"])
46
+ print("Docker Compose Env:", config["docker_compose"]["environment"])
47
+
48
+ return config
49
+
50
+ # =============================================================================
51
+ # 3. Plan Folder Structure
52
+ # =============================================================================
53
+
54
+ def example_path_planning():
55
+ """Example: Plan Infisical folder structure."""
56
+
57
+ # Plan a single service path
58
+ user_path = Infisical.Paths.plan_resource_path(
59
+ resource_name="user-management-backend",
60
+ resource_type="backend",
61
+ )
62
+ print("User Path:", user_path["full_path"])
63
+ print("Subpaths:", user_path["subpaths"])
64
+
65
+ # Plan multiple services at once
66
+ batch_paths = Infisical.Paths.plan_batch_resource_paths([
67
+ "user-management-backend",
68
+ "order-management-backend",
69
+ "team-management-backend",
70
+ ])
71
+
72
+ for name, plan in batch_paths.items():
73
+ print("Service: {}, Path: {}".format(name, plan["full_path"]))
74
+
75
+ # Plan complete organization structure (example org name)
76
+ org_structure = Infisical.Paths.plan_organization_structure(
77
+ org_name="my-project",
78
+ resource_names=[
79
+ "user",
80
+ "order",
81
+ "team",
82
+ "service",
83
+ "products",
84
+ "website",
85
+ "gdpr",
86
+ "payment",
87
+ ],
88
+ )
89
+
90
+ print("Organization:", org_structure["organization"])
91
+ print("Services:", org_structure["services"].keys())
92
+
93
+ # =============================================================================
94
+ # 4. Machine Identity Configuration
95
+ # =============================================================================
96
+
97
+ def example_machine_identity():
98
+ """Example: Configure machine identity."""
99
+
100
+ # Development machine with broad access
101
+ dev_machine = Infisical.Identity.generate_development_machine(
102
+ identity_name="dev-machine",
103
+ project_id="bc7cf07f-4002-4148-bca8-78a05c95dea2",
104
+ )
105
+ print("Dev Machine:", dev_machine["identity_name"])
106
+ print("Auth Method:", dev_machine["auth_method"])
107
+ print("Access Paths:", dev_machine["config"]["access_paths"])
108
+
109
+ # Service-specific machine with restricted access
110
+ resource_machine = Infisical.Identity.generate_resource_specific_machine(
111
+ resource_name="user",
112
+ project_id="bc7cf07f-4002-4148-bca8-78a05c95dea2",
113
+ )
114
+ print("Service Machine Access:", resource_machine["config"]["access_paths"])
115
+
116
+ # CI/CD machine for GitHub Actions
117
+ ci_machine = Infisical.Identity.generate_ci_machine(
118
+ identity_name="github-actions",
119
+ project_id="bc7cf07f-4002-4148-bca8-78a05c95dea2",
120
+ )
121
+ print("CI Machine:", ci_machine["identity_name"])
122
+
123
+ # =============================================================================
124
+ # 5. Organization Configuration
125
+ # =============================================================================
126
+
127
+ def example_organization():
128
+ """Example: Generate organization configuration."""
129
+
130
+ # Complete organization setup (example org name)
131
+ org = Infisical.Org.generate_config(
132
+ org_name="my-project",
133
+ env_names=["dev", "staging", "prod"],
134
+ resource_names=[
135
+ "user",
136
+ "order",
137
+ "team",
138
+ "service",
139
+ "products",
140
+ "website",
141
+ "gdpr",
142
+ "payment",
143
+ ],
144
+ )
145
+
146
+ print("Organization:", org["organization"]["name"])
147
+ print("Project:", org["project"]["name"])
148
+ print("Environments:", org["environments"].keys())
149
+ print("Roles:", org["roles"].keys())
150
+ print("Folder Structure:", org["folder_structure"].keys())
151
+
152
+ # =============================================================================
153
+ # 6. Batch Configuration for Multiple Services
154
+ # =============================================================================
155
+
156
+ def example_batch_configuration():
157
+ """Example: Configure multiple services at once."""
158
+
159
+ services_config = [
160
+ {
161
+ "name": "user-management-backend",
162
+ "path": "/services/user",
163
+ "type": "backend",
164
+ "command": "bun run src/index.ts",
165
+ },
166
+ {
167
+ "name": "payment-management-backend",
168
+ "path": "/services/payment",
169
+ "type": "payment",
170
+ "command": "bun run src/index.ts",
171
+ },
172
+ {
173
+ "name": "api-gateway",
174
+ "path": "/services/api-gateway",
175
+ "type": "api-gateway",
176
+ "command": "bun run src/index.ts",
177
+ },
178
+ ]
179
+
180
+ # Generate configs for all services
181
+ configs = Infisical.Secrets.generate_for_services_batch(services_config)
182
+
183
+ for name, config in configs.items():
184
+ print("Service: {}".format(name))
185
+ print(" Valid: {}".format(config["validation"]["valid"]))
186
+ print(" Required Secrets: {}".format(config["required_secrets"]))
187
+
188
+ # =============================================================================
189
+ # 7. Using Predefined Services (via Secrets module)
190
+ # =============================================================================
191
+
192
+ def example_predefined_services():
193
+ """Example: Use predefined service configurations."""
194
+
195
+ # Get configuration for a predefined service
196
+ config = Secrets.configure_predefined_service(
197
+ resource_name="user-management-backend",
198
+ command="bun run src/index.ts",
199
+ )
200
+
201
+ if config:
202
+ print("Configured:", config["resource_name"])
203
+ print("Path:", config["secret_path"])
204
+
205
+ # Configure all predefined services at once
206
+ all_configs = Secrets.configure_all_predefined_services(
207
+ command="bun run src/index.ts",
208
+ )
209
+
210
+ print("Configured {} services".format(len(all_configs)))
211
+ for name in all_configs:
212
+ print(" - {}".format(name))
213
+
214
+ # =============================================================================
215
+ # 8. Complete Integration Example (in Tiltfile)
216
+ # =============================================================================
217
+
218
+ """
219
+ # Example Tiltfile usage:
220
+
221
+ load("engine/topologies/platform/security/secrets.star", "Secrets")
222
+ load("engine/topologies/tilt/generators/infisical/path_manager.star", "PathManager")
223
+
224
+ def configure_resource_with_secrets(resource_name):
225
+ # Get predefined config or plan new one
226
+ config = Secrets.configure_predefined_service(resource_name)
227
+
228
+ if not config:
229
+ # Plan path for unknown service
230
+ path_plan = PathManager.plan_resource_path(resource_name)
231
+ config = Secrets.configure_service(
232
+ resource_name=resource_name,
233
+ secret_path=path_plan["full_path"],
234
+ )
235
+
236
+ # Use config in docker_compose or k8s_yaml
237
+ docker_compose_env = config["docker_compose"]["environment"]
238
+
239
+ # Apply to Tilt resource
240
+ dc_resource(resource_name, env=docker_compose_env)
241
+
242
+ # Configure all services
243
+ for service in ["user", "order", "team"]:
244
+ configure_resource_with_secrets(service)
245
+ """
246
+
247
+ # =============================================================================
248
+ # 9. Validation Examples
249
+ # =============================================================================
250
+
251
+ def example_validation():
252
+ """Example: Validate configurations."""
253
+
254
+ # Validate path
255
+ result = Infisical.Paths.validate_path("/services/my-service")
256
+ print("Path Valid:", result["valid"])
257
+ if not result["valid"]:
258
+ print("Errors:", result["errors"])
259
+
260
+ # Validate auth method
261
+ auth_result = Infisical.Identity.validate_auth_method("universal-auth")
262
+ print("Auth Method Valid:", auth_result["valid"])
263
+ print("Auth Method Supported:", auth_result["supported"])
264
+
265
+ # Validate machine config
266
+ machine_config = Infisical.Identity.generate_universal_auth(
267
+ identity_name="test-machine",
268
+ access_paths=["/services/*"],
269
+ )
270
+ validation = Infisical.Identity.validate_machine_config(machine_config)
271
+ print("Machine Config Valid:", validation["valid"])
272
+ if validation["warnings"]:
273
+ print("Warnings:", validation["warnings"])
274
+
275
+ # =============================================================================
276
+ # 10. Generating .env File Templates
277
+ # =============================================================================
278
+
279
+ def example_env_templates():
280
+ """Example: Generate .env file templates."""
281
+
282
+ # Generate for development
283
+ machine = Infisical.Identity.generate_development_machine("dev-machine")
284
+ env_content = Infisical.Identity.generate_env_file_content(
285
+ machine,
286
+ include_secrets=False, # Don't include actual secrets
287
+ )
288
+ print("Dev .env template:")
289
+ print(env_content[:500] + "...")
290
+
291
+ # Generate service-specific template
292
+ config = Infisical.Secrets.generate_for_service(
293
+ "user-management-backend",
294
+ "/services/user",
295
+ "backend",
296
+ )
297
+ print("\nService local template:")
298
+ print(config["local_template"][:500] + "...")
299
+
300
+ # =============================================================================
301
+ # Run all examples (in a real Tiltfile, you wouldn't do this)
302
+ # =============================================================================
303
+
304
+ # Uncomment to run examples:
305
+ # example_resource_secrets()
306
+ # example_path_planning()
307
+ # example_machine_identity()
308
+ # example_organization()
309
+ # example_batch_configuration()
310
+ # example_predefined_services()
311
+ # example_validation()
312
+ # example_env_templates()
@@ -0,0 +1,57 @@
1
+ # =============================================================================
2
+ # 🔐 INFISICAL GENERATORS - Master Index
3
+ # =============================================================================
4
+ # All Infisical-related generators for Tilt topology configuration
5
+ # =============================================================================
6
+ #
7
+ # This module provides complete Infisical integration for the TDK CLI:
8
+ # - Secret injection configuration generation
9
+ # - Path/folder management
10
+ # - Machine identity configuration
11
+ # - Organization structure planning
12
+ #
13
+ # Usage:
14
+ # load("./infisical/index.star", "Infisical")
15
+ #
16
+ # # Generate secret config for a service
17
+ # config = Infisical.Secrets.generate_for_service("my-service", "/services/my-service")
18
+ #
19
+ # # Plan folder structure
20
+ # paths = Infisical.Paths.plan_batch_resource_paths(["user", "order"])
21
+ #
22
+ # # Get machine identity
23
+ # machine = Infisical.Identity.generate_development_machine("dev-machine")
24
+ #
25
+ # # Organization setup
26
+ # org = Infisical.Org.generate_config("my-project", ["dev", "staging", "prod"])
27
+ # =============================================================================
28
+
29
+ # Load all Infisical submodules
30
+ load("./secrets_generator.star", _Secrets="SecretsGenerator")
31
+ load("./path_manager.star", _Paths="PathManager")
32
+ load("./machine_identity.star", _Identity="MachineIdentity")
33
+ load("./organization.star", _Org="Organization")
34
+
35
+ # =============================================================================
36
+ # Combined Exports
37
+ # =============================================================================
38
+
39
+ Infisical = struct(
40
+ # Secret injection generation
41
+ Secrets=_Secrets,
42
+
43
+ # Path and folder management
44
+ Paths=_Paths,
45
+
46
+ # Machine identity management
47
+ Identity=_Identity,
48
+
49
+ # Organization configuration
50
+ Org=_Org,
51
+
52
+ # Quick access to common functions
53
+ generate_for_service=_Secrets.generate_for_service,
54
+ plan_resource_path=_Paths.plan_resource_path,
55
+ generate_universal_auth=_Identity.generate_universal_auth,
56
+ generate_org_config=_Org.generate_config,
57
+ )