@flisk-sh/flisk 0.0.0-stage → 1.3.190

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 (440) hide show
  1. package/CHANGELOG.md +492 -0
  2. package/LICENSE +21 -0
  3. package/README.md +479 -2
  4. package/Tiltfile +151 -0
  5. package/cli/bin/flisk.js +42 -0
  6. package/cli/dist/agent-runtimes/custom.js +335 -0
  7. package/cli/dist/agent-runtimes/registry.js +34 -0
  8. package/cli/dist/backend-frameworks/elysia.js +38 -0
  9. package/cli/dist/backend-frameworks/express.js +49 -0
  10. package/cli/dist/backend-frameworks/fastify.js +43 -0
  11. package/cli/dist/backend-frameworks/h3.js +37 -0
  12. package/cli/dist/backend-frameworks/koa.js +47 -0
  13. package/cli/dist/backend-frameworks/mcp.js +86 -0
  14. package/cli/dist/backend-frameworks/nestjs.js +55 -0
  15. package/cli/dist/backend-frameworks/registry.js +134 -0
  16. package/cli/dist/backend-frameworks/types.js +1 -0
  17. package/cli/dist/backend-languages/bun.js +76 -0
  18. package/cli/dist/backend-languages/go.js +125 -0
  19. package/cli/dist/backend-languages/node.js +122 -0
  20. package/cli/dist/backend-languages/python.js +94 -0
  21. package/cli/dist/backend-languages/registry.js +37 -0
  22. package/cli/dist/backend-languages/rust.js +82 -0
  23. package/cli/dist/backend-languages/types.js +1 -0
  24. package/cli/dist/cli.js +29 -0
  25. package/cli/dist/commands/__tests__/project-e2e-helpers.js +49 -0
  26. package/cli/dist/commands/__tests__/ui-loading-screen.test.js +16 -0
  27. package/cli/dist/commands/agent.js +182 -0
  28. package/cli/dist/commands/completion-candidates.js +116 -0
  29. package/cli/dist/commands/completion.js +843 -0
  30. package/cli/dist/commands/config.js +362 -0
  31. package/cli/dist/commands/doctor.js +1504 -0
  32. package/cli/dist/commands/down.js +114 -0
  33. package/cli/dist/commands/eject.js +108 -0
  34. package/cli/dist/commands/help.js +152 -0
  35. package/cli/dist/commands/import.js +164 -0
  36. package/cli/dist/commands/logs.js +119 -0
  37. package/cli/dist/commands/maintainers.js +102 -0
  38. package/cli/dist/commands/mcp.js +28 -0
  39. package/cli/dist/commands/networks.js +306 -0
  40. package/cli/dist/commands/project.js +447 -0
  41. package/cli/dist/commands/projects.js +103 -0
  42. package/cli/dist/commands/registry.js +53 -0
  43. package/cli/dist/commands/resource.js +992 -0
  44. package/cli/dist/commands/resources.js +127 -0
  45. package/cli/dist/commands/restart.js +89 -0
  46. package/cli/dist/commands/runtime.js +75 -0
  47. package/cli/dist/commands/stack.js +171 -0
  48. package/cli/dist/commands/stacks.js +71 -0
  49. package/cli/dist/commands/status.js +211 -0
  50. package/cli/dist/commands/ui.js +725 -0
  51. package/cli/dist/commands/up.js +609 -0
  52. package/cli/dist/commands/upgrade.js +840 -0
  53. package/cli/dist/commands/version.js +10 -0
  54. package/cli/dist/components/Accessible.js +11 -0
  55. package/cli/dist/components/BaseTooltip.js +30 -0
  56. package/cli/dist/components/DetailPanel.js +33 -0
  57. package/cli/dist/components/FileTree.js +51 -0
  58. package/cli/dist/components/ResourceSelectInput.js +42 -0
  59. package/cli/dist/components/ResourceTable.js +35 -0
  60. package/cli/dist/components/ServiceIssues.js +13 -0
  61. package/cli/dist/components/TUIHeader.js +27 -0
  62. package/cli/dist/components/TabBar.js +27 -0
  63. package/cli/dist/components/Tooltip.js +13 -0
  64. package/cli/dist/components/index.js +11 -0
  65. package/cli/dist/components/ui-theme.js +120 -0
  66. package/cli/dist/config/platform-standards.js +182 -0
  67. package/cli/dist/frontend-frameworks/lit.js +64 -0
  68. package/cli/dist/frontend-frameworks/preact.js +62 -0
  69. package/cli/dist/frontend-frameworks/qwik.js +61 -0
  70. package/cli/dist/frontend-frameworks/react.js +69 -0
  71. package/cli/dist/frontend-frameworks/registry.js +83 -0
  72. package/cli/dist/frontend-frameworks/solid.js +62 -0
  73. package/cli/dist/frontend-frameworks/svelte.js +67 -0
  74. package/cli/dist/frontend-frameworks/tanstack-router.js +101 -0
  75. package/cli/dist/frontend-frameworks/types.js +1 -0
  76. package/cli/dist/frontend-frameworks/vanilla.js +59 -0
  77. package/cli/dist/frontend-frameworks/vue.js +72 -0
  78. package/cli/dist/generator/__tests__/golden-helpers.js +43 -0
  79. package/cli/dist/generator/extension-fetch.js +291 -0
  80. package/cli/dist/generator/resource-templates.js +133 -0
  81. package/cli/dist/generator/template-engine.js +801 -0
  82. package/cli/dist/index.js +10 -0
  83. package/cli/dist/mcp/server.js +101 -0
  84. package/cli/dist/mcp/tools.js +351 -0
  85. package/cli/dist/program.js +37 -0
  86. package/cli/dist/types/index.js +38 -0
  87. package/cli/dist/utils/agent-host.js +36 -0
  88. package/cli/dist/utils/atomic-write.js +36 -0
  89. package/cli/dist/utils/bun-floor.js +9 -0
  90. package/cli/dist/utils/bun-requirement.js +10 -0
  91. package/cli/dist/utils/cache.js +63 -0
  92. package/cli/dist/utils/cold-preflight.js +257 -0
  93. package/cli/dist/utils/command-helpers.js +57 -0
  94. package/cli/dist/utils/constants.js +160 -0
  95. package/cli/dist/utils/discovery-context.js +71 -0
  96. package/cli/dist/utils/discovery-paths.js +93 -0
  97. package/cli/dist/utils/docker.js +34 -0
  98. package/cli/dist/utils/doctor-crashloop.js +161 -0
  99. package/cli/dist/utils/doctor-fix.js +391 -0
  100. package/cli/dist/utils/doctor-host.js +66 -0
  101. package/cli/dist/utils/doctor-report.js +78 -0
  102. package/cli/dist/utils/doctor-runtime.js +880 -0
  103. package/cli/dist/utils/doctor-starlark.js +132 -0
  104. package/cli/dist/utils/doctor-wiring.js +698 -0
  105. package/cli/dist/utils/down-cleanup.js +125 -0
  106. package/cli/dist/utils/env-validator.js +266 -0
  107. package/cli/dist/utils/errors.js +175 -0
  108. package/cli/dist/utils/exec-async.js +31 -0
  109. package/cli/dist/utils/file-helpers.js +104 -0
  110. package/cli/dist/utils/formatting.js +165 -0
  111. package/cli/dist/utils/generated-paths.js +51 -0
  112. package/cli/dist/utils/help-command.js +11 -0
  113. package/cli/dist/utils/host-port-config.js +140 -0
  114. package/cli/dist/utils/host-port-plan.js +100 -0
  115. package/cli/dist/utils/json-output.js +29 -0
  116. package/cli/dist/utils/machine-output.js +33 -0
  117. package/cli/dist/utils/paths.js +43 -0
  118. package/cli/dist/utils/platform.js +58 -0
  119. package/cli/dist/utils/port-assignment.js +75 -0
  120. package/cli/dist/utils/port-conflict-fix.js +25 -0
  121. package/cli/dist/utils/port-fallback-notice.js +17 -0
  122. package/cli/dist/utils/port-listener-probe.js +20 -0
  123. package/cli/dist/utils/project-config-defaults.js +17 -0
  124. package/cli/dist/utils/project-features.js +91 -0
  125. package/cli/dist/utils/project-templates.js +32 -0
  126. package/cli/dist/utils/prompt.js +97 -0
  127. package/cli/dist/utils/resource-features.js +184 -0
  128. package/cli/dist/utils/resource-kind.js +9 -0
  129. package/cli/dist/utils/schema-version-gate.js +45 -0
  130. package/cli/dist/utils/search-status.js +12 -0
  131. package/cli/dist/utils/secret-redaction.js +73 -0
  132. package/cli/dist/utils/service-config-checks.js +189 -0
  133. package/cli/dist/utils/service-manifest.js +254 -0
  134. package/cli/dist/utils/service-runtime-state.js +66 -0
  135. package/cli/dist/utils/service-urls.js +112 -0
  136. package/cli/dist/utils/services.js +360 -0
  137. package/cli/dist/utils/shared-infra.js +45 -0
  138. package/cli/dist/utils/shared-platform-postgres.js +232 -0
  139. package/cli/dist/utils/single-flight.js +21 -0
  140. package/cli/dist/utils/smoke.js +401 -0
  141. package/cli/dist/utils/spinner.js +40 -0
  142. package/cli/dist/utils/stack-features.js +15 -0
  143. package/cli/dist/utils/stack-status.js +14 -0
  144. package/cli/dist/utils/startup-report.js +78 -0
  145. package/cli/dist/utils/status-message.js +21 -0
  146. package/cli/dist/utils/status-ports.js +33 -0
  147. package/cli/dist/utils/suggestions.js +63 -0
  148. package/cli/dist/utils/tar.js +46 -0
  149. package/cli/dist/utils/tdk-version.js +51 -0
  150. package/cli/dist/utils/terminal-layout.js +19 -0
  151. package/cli/dist/utils/tilt-events.js +194 -0
  152. package/cli/dist/utils/tilt-logs.js +61 -0
  153. package/cli/dist/utils/tilt-port-owner.js +63 -0
  154. package/cli/dist/utils/tilt-process.js +54 -0
  155. package/cli/dist/utils/tilt-resource-state.js +32 -0
  156. package/cli/dist/utils/tilt-startup.js +49 -0
  157. package/cli/dist/utils/tilt-unreachable-message.js +9 -0
  158. package/cli/dist/utils/tilt.js +104 -0
  159. package/cli/dist/utils/ui-keymap.js +129 -0
  160. package/cli/dist/utils/ui-service-state.js +34 -0
  161. package/cli/dist/utils/up-only.js +28 -0
  162. package/cli/dist/utils/up-readiness.js +118 -0
  163. package/cli/dist/utils/url-actions.js +103 -0
  164. package/cli/dist/utils/validation.js +62 -0
  165. package/cli/dist/utils/which.js +56 -0
  166. package/cli/dist/utils/windows-doctor.js +176 -0
  167. package/cli/dist-bundle/chunk-6EA4DGCY.js +2 -0
  168. package/cli/dist-bundle/chunk-BZ4H7MM4.js +3 -0
  169. package/cli/dist-bundle/chunk-CLCUIDBH.js +510 -0
  170. package/cli/dist-bundle/cli.js +2017 -0
  171. package/cli/dist-bundle/cold-preflight-SY26O2IG.js +2 -0
  172. package/cli/dist-bundle/devtools-ZUHXW33W.js +5 -0
  173. package/cli/dist-bundle/extension-fetch-J4FFH7TJ.js +2 -0
  174. package/cli/package.json +83 -0
  175. package/cli/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
  176. package/cli/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
  177. package/cli/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
  178. package/cli/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
  179. package/cli/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
  180. package/cli/templates/.tiltignore.hbs +72 -0
  181. package/cli/templates/TILT_RESOURCE_DEFAULTS.star.hbs +220 -0
  182. package/cli/templates/TILT_TECH_STACK.star.hbs +149 -0
  183. package/cli/templates/Tiltfile.hbs +381 -0
  184. package/cli/templates/spec.master.hbs +192 -0
  185. package/discovery/AGENTS.md +362 -0
  186. package/discovery/TILT_DISCOVERY.star +429 -0
  187. package/discovery/Tiltfile +58 -0
  188. package/discovery/config.star +265 -0
  189. package/discovery/constants.star +167 -0
  190. package/discovery/deterministic.star +213 -0
  191. package/discovery/discovery_daemon.star +193 -0
  192. package/discovery/discovery_orchestrator.star +492 -0
  193. package/discovery/filtering.star +7 -0
  194. package/discovery/identity-management-backend/service.yaml +26 -0
  195. package/discovery/identity-management-frontend/service.yaml +29 -0
  196. package/discovery/identity-sdk/service.yaml +9 -0
  197. package/discovery/incremental_discovery.star +215 -0
  198. package/discovery/indexing.star +9 -0
  199. package/discovery/json_manifest_scanner.star +57 -0
  200. package/discovery/libraries.star +48 -0
  201. package/discovery/loading.star +25 -0
  202. package/discovery/manifest/constants.star +106 -0
  203. package/discovery/manifest/loading.star +418 -0
  204. package/discovery/manifest/normalize.star +289 -0
  205. package/discovery/manifest/validation.star +110 -0
  206. package/discovery/normalization.star +13 -0
  207. package/discovery/registry.star +562 -0
  208. package/discovery/resource_snapshot.py +384 -0
  209. package/discovery/resource_snapshot.star +145 -0
  210. package/discovery/schemas.star +3 -0
  211. package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
  212. package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
  213. package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
  214. package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
  215. package/discovery/test_resource_snapshot.py +253 -0
  216. package/discovery/validation.star +80 -0
  217. package/discovery/versioning.star +3 -0
  218. package/engine/AGENTS.md +706 -0
  219. package/engine/README.md +31 -0
  220. package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
  221. package/engine/Tiltfile +86 -0
  222. package/engine/assets/docker/golden-layers.Dockerfile +204 -0
  223. package/engine/assets/docker/wake-gateway/Dockerfile +28 -0
  224. package/engine/assets/docker/wake-gateway/decide.test.ts +177 -0
  225. package/engine/assets/docker/wake-gateway/decide.ts +135 -0
  226. package/engine/assets/docker/wake-gateway/server.ts +363 -0
  227. package/engine/assets/scripts/cleanup-completed-migrator-images.sh +39 -0
  228. package/engine/assets/scripts/cleanup-tilt-images.sh +122 -0
  229. package/engine/assets/scripts/mac-m1-resource-monitor.sh +123 -0
  230. package/engine/config.star +5 -0
  231. package/engine/entrypoint.star +101 -0
  232. package/engine/lifecycle/orchestrator.star +263 -0
  233. package/engine/paths.star +719 -0
  234. package/engine/schemas/project-schema.json +147 -0
  235. package/engine/schemas/service-schema.json +537 -0
  236. package/engine/scripts/README.md +89 -0
  237. package/engine/scripts/build-and-publish-lib.sh +207 -0
  238. package/engine/scripts/check-lib-publish.sh +87 -0
  239. package/engine/scripts/debug-container.sh +265 -0
  240. package/engine/scripts/generate-manifest.sh +200 -0
  241. package/engine/spec.master +702 -0
  242. package/engine/spec.master.example +341 -0
  243. package/engine/topologies/README.md +33 -0
  244. package/engine/topologies/platform/docker/AGENTS.md +59 -0
  245. package/engine/topologies/platform/docker/auth/auth.star +207 -0
  246. package/engine/topologies/platform/docker/build/frontend_build_plan.star +65 -0
  247. package/engine/topologies/platform/docker/build/golden_image.star +37 -0
  248. package/engine/topologies/platform/docker/build/golden_image_build.star +144 -0
  249. package/engine/topologies/platform/docker/build/golden_image_constants.star +100 -0
  250. package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +263 -0
  251. package/engine/topologies/platform/docker/compose/compose.star +637 -0
  252. package/engine/topologies/platform/docker/compose/compose_helpers.star +54 -0
  253. package/engine/topologies/platform/docker/compose/traefik_standalone.star +171 -0
  254. package/engine/topologies/platform/docker/config/bunignore.star +144 -0
  255. package/engine/topologies/platform/docker/config/dockerignore.star +152 -0
  256. package/engine/topologies/platform/docker/config/healthcheck.star +58 -0
  257. package/engine/topologies/platform/docker/constants.star +211 -0
  258. package/engine/topologies/platform/docker/dockerfile/dockerfile.star +56 -0
  259. package/engine/topologies/platform/docker/dockerfile/language_dockerfile.star +264 -0
  260. package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +76 -0
  261. package/engine/topologies/platform/docker/index.star +40 -0
  262. package/engine/topologies/platform/docker/layers/bun_helpers.star +25 -0
  263. package/engine/topologies/platform/docker/layers/infisical/index.star +42 -0
  264. package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +264 -0
  265. package/engine/topologies/platform/docker/layers/l1_base_layers.star +89 -0
  266. package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +147 -0
  267. package/engine/topologies/platform/docker/layers/l3_builder_layers.star +229 -0
  268. package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +282 -0
  269. package/engine/topologies/platform/docker/layers/prisma/constants.star +138 -0
  270. package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +98 -0
  271. package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +131 -0
  272. package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +100 -0
  273. package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +128 -0
  274. package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +205 -0
  275. package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +121 -0
  276. package/engine/topologies/platform/docker/networking/api_path_constants.star +206 -0
  277. package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +31 -0
  278. package/engine/topologies/platform/docker/networking/traefik.star +266 -0
  279. package/engine/topologies/platform/docker/networking/traefik_constants.star +148 -0
  280. package/engine/topologies/platform/docker/networking/traefik_helpers.star +162 -0
  281. package/engine/topologies/platform/docker/networking/traefik_static_routes.star +165 -0
  282. package/engine/topologies/platform/docker/secrets/env_secrets.star +74 -0
  283. package/engine/topologies/platform/docker/secrets/infisical.star +109 -0
  284. package/engine/topologies/platform/net/AGENTS.md +64 -0
  285. package/engine/topologies/platform/net/proxy.star +6 -0
  286. package/engine/topologies/platform/registries/local.star +6 -0
  287. package/engine/topologies/platform/registries/verdaccio_loader.star +20 -0
  288. package/engine/topologies/platform/security/AGENTS.md +49 -0
  289. package/engine/topologies/platform/security/secrets.star +241 -0
  290. package/engine/topologies/platform/state/AGENTS.md +64 -0
  291. package/engine/topologies/platform/state/relational.star +6 -0
  292. package/engine/topologies/tilt/common/AGENTS.md +59 -0
  293. package/engine/topologies/tilt/common/utils.star +409 -0
  294. package/engine/topologies/tilt/common/utils_debug.star +71 -0
  295. package/engine/topologies/tilt/common/utils_deterministic.star +170 -0
  296. package/engine/topologies/tilt/common/utils_docker_networks.star +54 -0
  297. package/engine/topologies/tilt/common/utils_env.star +92 -0
  298. package/engine/topologies/tilt/common/utils_output.star +99 -0
  299. package/engine/topologies/tilt/config/AGENTS.md +68 -0
  300. package/engine/topologies/tilt/config/defaults.star +5 -0
  301. package/engine/topologies/tilt/config/feature_flags.star +12 -0
  302. package/engine/topologies/tilt/config/global.star +57 -0
  303. package/engine/topologies/tilt/config/profiles.star +398 -0
  304. package/engine/topologies/tilt/generators/agents_md.star +64 -0
  305. package/engine/topologies/tilt/generators/api_gateway.star +147 -0
  306. package/engine/topologies/tilt/generators/index.star +126 -0
  307. package/engine/topologies/tilt/generators/infisical/README.md +424 -0
  308. package/engine/topologies/tilt/generators/infisical/examples.star +314 -0
  309. package/engine/topologies/tilt/generators/infisical/index.star +59 -0
  310. package/engine/topologies/tilt/generators/infisical/machine_identity.star +422 -0
  311. package/engine/topologies/tilt/generators/infisical/organization.star +536 -0
  312. package/engine/topologies/tilt/generators/infisical/path_manager.star +478 -0
  313. package/engine/topologies/tilt/generators/infisical/secrets_generator.star +422 -0
  314. package/engine/topologies/tilt/generators/nginx_conf.star +145 -0
  315. package/engine/topologies/tilt/generators/npmrc.star +132 -0
  316. package/engine/topologies/tilt/generators/tsconfig.star +25 -0
  317. package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +73 -0
  318. package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +137 -0
  319. package/engine/topologies/tilt/generators/typescript/common.star +9 -0
  320. package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +78 -0
  321. package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +140 -0
  322. package/engine/topologies/tilt/generators/typescript/include.star +25 -0
  323. package/engine/topologies/tilt/generators/typescript/playwright_config.star +42 -0
  324. package/engine/topologies/tilt/generators/typescript/prisma_config.star +51 -0
  325. package/engine/topologies/tilt/generators/validators.star +868 -0
  326. package/engine/topologies/tilt/generators/vite/backend.star +80 -0
  327. package/engine/topologies/tilt/generators/vite/frameworks/lit.star +92 -0
  328. package/engine/topologies/tilt/generators/vite/frameworks/preact.star +94 -0
  329. package/engine/topologies/tilt/generators/vite/frameworks/qwik.star +94 -0
  330. package/engine/topologies/tilt/generators/vite/frameworks/react.star +128 -0
  331. package/engine/topologies/tilt/generators/vite/frameworks/solid.star +94 -0
  332. package/engine/topologies/tilt/generators/vite/frameworks/svelte.star +94 -0
  333. package/engine/topologies/tilt/generators/vite/frameworks/vanilla.star +92 -0
  334. package/engine/topologies/tilt/generators/vite/frameworks/vue.star +94 -0
  335. package/engine/topologies/tilt/generators/vite/frontend.star +153 -0
  336. package/engine/topologies/tilt/generators/vite/generators.star +45 -0
  337. package/engine/topologies/tilt/generators/vite/helpers.star +256 -0
  338. package/engine/topologies/tilt/generators/vite/library.star +67 -0
  339. package/engine/topologies/tilt/generators/vite/sdk.star +75 -0
  340. package/engine/topologies/tilt/generators/vite/templates.star +460 -0
  341. package/engine/topologies/tilt/generators/vite_config.star +24 -0
  342. package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
  343. package/engine/topologies/tilt/manifest/README.md +679 -0
  344. package/engine/topologies/tilt/manifest/__init__.star +220 -0
  345. package/engine/topologies/tilt/manifest/constants.star +262 -0
  346. package/engine/topologies/tilt/manifest/errors.star +268 -0
  347. package/engine/topologies/tilt/manifest/integration.star +348 -0
  348. package/engine/topologies/tilt/manifest/json_to_yaml.py +61 -0
  349. package/engine/topologies/tilt/manifest/loader.star +239 -0
  350. package/engine/topologies/tilt/manifest/mapper.star +229 -0
  351. package/engine/topologies/tilt/manifest/parser.star +490 -0
  352. package/engine/topologies/tilt/manifest/schema.star +502 -0
  353. package/engine/topologies/tilt/manifest/tests/test_integration.star +278 -0
  354. package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +475 -0
  355. package/engine/topologies/tilt/manifest/tests/test_manifest.star +319 -0
  356. package/engine/topologies/tilt/manifest/tests/test_validator.star +472 -0
  357. package/engine/topologies/tilt/manifest/validator.star +744 -0
  358. package/engine/topologies/tilt/manifest/yaml_to_json.py +20 -0
  359. package/engine/topologies/tilt/resources/AGENTS.md +71 -0
  360. package/engine/topologies/tilt/resources/build_concurrency.star +56 -0
  361. package/engine/topologies/tilt/resources/conditions.star +5 -0
  362. package/engine/topologies/tilt/resources/databases.star +246 -0
  363. package/engine/topologies/tilt/resources/declaration.star +5 -0
  364. package/engine/topologies/tilt/resources/deps.star +5 -0
  365. package/engine/topologies/tilt/resources/infra-loader.star +504 -0
  366. package/engine/topologies/tilt/resources/libs.star +32 -0
  367. package/engine/topologies/tilt/resources/libs_discovery.star +104 -0
  368. package/engine/topologies/tilt/resources/libs_paths.star +81 -0
  369. package/engine/topologies/tilt/resources/libs_resource_definition.star +153 -0
  370. package/engine/topologies/tilt/resources/libs_setup.star +166 -0
  371. package/engine/topologies/tilt/resources/libs_tsconfig.star +39 -0
  372. package/engine/topologies/tilt/resources/orchestrator/apply.star +79 -0
  373. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +864 -0
  374. package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +90 -0
  375. package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +150 -0
  376. package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +38 -0
  377. package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +46 -0
  378. package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +193 -0
  379. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
  380. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +23 -0
  381. package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +136 -0
  382. package/engine/topologies/tilt/resources/orchestrator/generators/env.star +219 -0
  383. package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +172 -0
  384. package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +577 -0
  385. package/engine/topologies/tilt/resources/orchestrator/helpers.star +35 -0
  386. package/engine/topologies/tilt/resources/orchestrator.star +56 -0
  387. package/engine/topologies/tilt/resources/ordering.star +5 -0
  388. package/engine/topologies/tilt/resources/shared-platform-postgres.star +30 -0
  389. package/engine/topologies/tilt/resources/triggers.star +5 -0
  390. package/engine/topologies/tilt/resources/watchers.star +304 -0
  391. package/engine/where-things-live.star +719 -0
  392. package/examples/tdk-example/LICENSE +21 -0
  393. package/examples/tdk-example/README.md +23 -0
  394. package/examples/tdk-example/TILT_SERVICE_DEFAULTS.star +42 -0
  395. package/examples/tdk-example/TILT_TECH_STACK.star +67 -0
  396. package/examples/tdk-example/Tiltfile +25 -0
  397. package/examples/tdk-example/services/platform/messaging/docker-compose.yml +26 -0
  398. package/examples/tdk-example/services/shop/orders-api/package.json +20 -0
  399. package/examples/tdk-example/services/shop/orders-api/service.json +14 -0
  400. package/examples/tdk-example/services/shop/orders-api/src/index.ts +81 -0
  401. package/examples/tdk-example/services/shop/orders-app/index.html +12 -0
  402. package/examples/tdk-example/services/shop/orders-app/package.json +23 -0
  403. package/examples/tdk-example/services/shop/orders-app/public/.gitkeep +0 -0
  404. package/examples/tdk-example/services/shop/orders-app/service.json +9 -0
  405. package/examples/tdk-example/services/shop/orders-app/src/main.tsx +9 -0
  406. package/examples/tdk-example/services/shop/orders-app/src/orders.tsx +67 -0
  407. package/examples/tdk-example/services/shop/orders-app/src/style.css +15 -0
  408. package/examples/tdk-example/services/shop/orders-worker/package.json +18 -0
  409. package/examples/tdk-example/services/shop/orders-worker/service.json +13 -0
  410. package/examples/tdk-example/services/shop/orders-worker/src/index.ts +33 -0
  411. package/ext/Tiltfile +66 -0
  412. package/ext/ide-components/README.md +221 -0
  413. package/ext/ide-components/code_viewer/server.py +208 -0
  414. package/ext/ide-components/config_inspector/server.py +1052 -0
  415. package/ext/ide-components/file_browser/server.py +287 -0
  416. package/ext/ide-components/shared/config_service.py +471 -0
  417. package/ext/ide-components/shared/file_utils.py +300 -0
  418. package/ext/ide-components/shared/http_utils.py +234 -0
  419. package/ext/ide-components/shared/static/styles.css +1334 -0
  420. package/ext/ide-components/shared/syntax_highlighter.py +142 -0
  421. package/ext/ide-components/shared/template_engine.py +125 -0
  422. package/ext/ide-components/shared/templates/base.html +121 -0
  423. package/ext/ide-components/shared/test_config_service.py +328 -0
  424. package/ext/ide-components/shared/tilt_integration.py +160 -0
  425. package/ext/ui-enhancements/cron-status-server.sh +51 -0
  426. package/ext/ui-enhancements/cron-status-tracker.sh +148 -0
  427. package/ext/ui-enhancements/extension.yaml +36 -0
  428. package/ext/ui-enhancements/tiltfile.py +101 -0
  429. package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
  430. package/ext/ui-enhancements/ui/help-panel.css +279 -0
  431. package/ext/ui-enhancements/ui/icons.css +125 -0
  432. package/ext/ui-enhancements/ui/tooltips.css +114 -0
  433. package/package.json +94 -4
  434. package/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
  435. package/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
  436. package/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
  437. package/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
  438. package/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
  439. package/specs/specs/TILT_SERVICE_DEFAULTS.star +207 -0
  440. package/specs/specs/TILT_TECH_STACK.star +161 -0
@@ -0,0 +1,504 @@
1
+ # Copyright (c) 2026 Flisk contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 🏗️ TILT SDK - INFRASTRUCTURE LOADER
5
+ # =============================================================================
6
+ # Path: .tilt/provisioner/infra-loader.star
7
+ # Purpose: Load and configure infrastructure services
8
+ # =============================================================================
9
+ #
10
+ # This module centralizes infrastructure loading:
11
+ # - Database (PostgreSQL, Redis)
12
+ # - Messaging (Redis, NATS, Kafka)
13
+ # - Secrets (Infisical)
14
+ # - Registry (Verdaccio)
15
+ # - Proxy (Traefik)
16
+ # - Monitoring (SigNoz, ELK)
17
+ # - CDC (Debezium)
18
+ #
19
+ # Usage:
20
+ # Infra.load_all(should_enable_fn)
21
+ # =============================================================================
22
+
23
+ load("../common/utils_debug.star", "debug_log")
24
+ load("./build_concurrency.star", "configure_build_concurrency")
25
+ load("../../platform/docker/constants.star", "PlatformDockerConstants")
26
+ load("../../platform/docker/compose/traefik_standalone.star", "generate_standalone_traefik_compose")
27
+ load("../../platform/docker/networking/sablier_container_cycle.star", "sablier_middleware_suffix")
28
+ load("../../platform/registries/verdaccio_loader.star", "load_verdaccio")
29
+
30
+ # =============================================================================
31
+ # 🗃️ DATABASE MANAGEMENT
32
+ # =============================================================================
33
+
34
+ def _file_exists(path):
35
+ """Check if a file exists."""
36
+ result = str(local("test -f '{path}' && echo 'yes' || echo 'no'".format(path=path), quiet=True, echo_off=True)).strip()
37
+ return result == 'yes'
38
+
39
+
40
+ def _compose_has_service(compose_path, service_name):
41
+ """Check whether a Compose file declares a named service."""
42
+ document = read_yaml(compose_path, default={})
43
+ services = document.get('services', {}) if type(document) == 'dict' else {}
44
+ return service_name in services
45
+
46
+
47
+ def _docker_compose(compose_paths, env_file, infra):
48
+ """docker_compose() wrapper for a shared platform stack, in its own Compose project.
49
+
50
+ Without project_name, Compose names the project after the file's directory, so every
51
+ Flisk project on one Docker daemon shares `database-management`, `traefik` and so on.
52
+ Then one project's `up` can recreate or remove another project's services.
53
+ Tilt's builtin rejects env_file=None outright (it type-checks the kwarg as path|string,
54
+ not Optional), so the keyword must be omitted entirely rather than passed as None.
55
+ """
56
+ project_name = PlatformDockerConstants.infra_compose_project_name(infra)
57
+ if env_file:
58
+ docker_compose(compose_paths, project_name=project_name, env_file=env_file)
59
+ else:
60
+ docker_compose(compose_paths, project_name=project_name)
61
+
62
+
63
+ def _generate_database_management_compose():
64
+ """Generate the stack-feature compose for local PostgreSQL."""
65
+ name = PlatformDockerConstants.PROJECT_NAME
66
+ database_network = PlatformDockerConstants.NETWORK_DATABASE
67
+ return """###############################################################################
68
+ # SYSTEM-GENERATED - DO NOT EDIT
69
+ # Stack feature: database-management
70
+ # Source: .tdk/project.json stacks.*.services includes "database-management"
71
+ ###############################################################################
72
+
73
+ services:
74
+ postgres:
75
+ image: postgres:16-alpine
76
+ container_name: {name}_postgres
77
+ restart: unless-stopped
78
+ environment:
79
+ POSTGRES_USER: {name}
80
+ POSTGRES_PASSWORD: ${{DB_PASSWORD}}
81
+ POSTGRES_DB: postgres
82
+ ports:
83
+ - "{bind_address}:{host_port}:5432"
84
+ volumes:
85
+ - {name}_postgres_data:/var/lib/postgresql/data
86
+ networks:
87
+ - database
88
+ healthcheck:
89
+ test: ["CMD-SHELL", "pg_isready -U {name} -d postgres"]
90
+ interval: 5s
91
+ timeout: 5s
92
+ retries: 20
93
+
94
+ networks:
95
+ database:
96
+ name: {database_network}
97
+ external: true
98
+
99
+ volumes:
100
+ {name}_postgres_data:
101
+ """.format(name=name, database_network=database_network, host_port=os.environ.get('TDK_POSTGRES_PORT', '15432'), bind_address=os.environ.get('TDK_BIND_ADDRESS', '127.0.0.1'))
102
+
103
+
104
+ def _ensure_database_management_compose(root_prefix, write_fn):
105
+ """Ensure the database-management stack feature has its compose file.
106
+
107
+ write_fn is expected to be Utils.write_file_if_changed, which prepends
108
+ TDK_PROJECT_ROOT to relative paths — the same base as root_prefix when
109
+ the Tiltfile sets TDK_PROJECT_ROOT = PROJECT_ROOT. A custom write_fn that
110
+ does not prepend may write a different file; if the path we return is
111
+ absolute and still missing after the relative write, write that exact
112
+ path once so the exists-check and the write cannot diverge.
113
+ """
114
+ compose_rel = "services/platform/database-management/docker-compose.yml"
115
+ compose_file = root_prefix + compose_rel if root_prefix else compose_rel
116
+ if _file_exists(compose_file):
117
+ return compose_file
118
+ if write_fn:
119
+ write_fn(compose_rel, _generate_database_management_compose())
120
+ if not _file_exists(compose_file) and compose_file.startswith('/'):
121
+ write_fn(compose_file, _generate_database_management_compose())
122
+ return compose_file
123
+
124
+ # No module-level mutable registration flag: Tilt freezes Starlark globals after
125
+ # module load, so writing a key on a global dict raises "cannot insert into
126
+ # frozen hash table". Feature-on (`_load_database_management`) and force-start
127
+ # (`force_start_platform_postgres`) are mutually exclusive via should_enable —
128
+ # the orchestrator only force-starts when database-management is off — so each
129
+ # Tiltfile evaluation registers `postgres` at most once on its own path.
130
+
131
+
132
+ def _register_platform_postgres(should_enable, root_prefix="", env_file=None, write_fn=None, required=False):
133
+ """Materialize the platform compose and register the shared `postgres` Tilt resource.
134
+
135
+ Does NOT load messaging, kafka, redis, nats, provision-db, or Prisma.
136
+
137
+ When `required` is true (dependsOn force-start path), a missing compose after
138
+ ensure is a hard failure — not a silent skip — so Tilt never waits on a
139
+ `postgres` resource that has no compose definition.
140
+ """
141
+ postgres_compose = _ensure_database_management_compose(root_prefix, write_fn)
142
+ if _file_exists(postgres_compose):
143
+ debug_log("INFRA: Loading postgres compose from {}".format(postgres_compose))
144
+ _docker_compose(postgres_compose, env_file, 'database-management')
145
+ dc_resource('postgres', labels=['infra.tools'], resource_deps=['init-networks'], auto_init=True)
146
+ return
147
+ message = "Shared platform Postgres compose was not materialized at {}".format(postgres_compose)
148
+ if required:
149
+ fail(message + " (write_fn present: {}). Refusing to register a postgres Tilt resource with no compose.".format(write_fn != None))
150
+ debug_log("INFRA: Skipping postgres (compose file not found): {}".format(message))
151
+
152
+
153
+ def force_start_platform_postgres(should_enable, root_prefix="", env_file=None, write_fn=None):
154
+ """Force-start the shared platform Postgres for a run whose selected resources
155
+ depend on `postgres` / `database-management` while `database-management` is off.
156
+
157
+ Reuses the existing platform compose path and the existing `postgres` Tilt
158
+ resource — no second image, port, migrator, or Prisma resource.
159
+
160
+ The orchestrator MUST pass the same `write_fn` the feature path uses
161
+ (`ctx['write_file']`) so `services/platform/database-management/docker-compose.yml`
162
+ is materialized when missing. A failed materialize fails the run.
163
+ """
164
+ if env_file == None:
165
+ candidate_env_file = root_prefix + '.env' if root_prefix else '.env'
166
+ env_file = candidate_env_file if _file_exists(candidate_env_file) else None
167
+ print("🗃️ Force-starting shared platform Postgres (selected dependsOn postgres/database-management)")
168
+ _register_platform_postgres(should_enable, root_prefix, env_file, write_fn, required=True)
169
+
170
+
171
+ def _load_database_management(should_enable, root_prefix="", env_file=None, write_fn=None):
172
+ """Load database and messaging infrastructure."""
173
+ if not should_enable('database-management'):
174
+ debug_log("INFRA: database-management not enabled")
175
+ return
176
+
177
+ print("🗃️ Loading database management services...")
178
+
179
+ # Load postgres from the database-management stack feature compose.
180
+ _register_platform_postgres(should_enable, root_prefix, env_file, write_fn)
181
+
182
+ # Load messaging if compose file exists
183
+ messaging_compose = root_prefix + 'services/platform/messaging/docker-compose.yml'
184
+ if _file_exists(messaging_compose):
185
+ debug_log("INFRA: Loading messaging compose from {}".format(messaging_compose))
186
+ _docker_compose(messaging_compose, env_file, 'messaging')
187
+ # Register only services present in the project compose file. Minimal
188
+ # NATS-only examples should not need to add an unrelated Redis broker.
189
+ if _compose_has_service(messaging_compose, 'redis'):
190
+ dc_resource('redis', labels=['infra.messaging'], auto_init=False)
191
+ if _compose_has_service(messaging_compose, 'nats'):
192
+ dc_resource('nats', labels=['infra.messaging'], auto_init=True)
193
+ else:
194
+ debug_log("INFRA: Skipping messaging (compose file not found)")
195
+
196
+ # Only create kafka resources if debezium is enabled AND messaging exists
197
+ cdc_enabled = should_enable('debezium')
198
+ if cdc_enabled and _file_exists(messaging_compose):
199
+ dc_resource('kafka', labels=['cdc'], resource_deps=['zookeeper'], auto_init=True)
200
+ dc_resource('zookeeper', labels=['cdc'], auto_init=True)
201
+
202
+
203
+ # =============================================================================
204
+ # 📦 VERDACCIO (NPM Registry)
205
+ # =============================================================================
206
+ # Loader lives in ../../platform/registries/verdaccio_loader.star (a free-tier
207
+ # stub in this public repo; the paid CLI overlay swaps it for the real loader
208
+ # — see that module's header comment).
209
+
210
+ _load_verdaccio = load_verdaccio
211
+
212
+
213
+ # =============================================================================
214
+ # 🔐 INFISICAL (Secrets Management)
215
+ # =============================================================================
216
+
217
+ def _load_infisical(should_enable, root_prefix="", env_file=None):
218
+ """Load Infisical secrets management."""
219
+ if not should_enable('infisical'):
220
+ return
221
+
222
+ compose_file = root_prefix + 'docker-compose.infisical.yml'
223
+ if not _file_exists(compose_file):
224
+ debug_log("INFRA: Skipping Infisical (compose file not found)")
225
+ return
226
+
227
+ print("🔐 Loading Infisical...")
228
+ _docker_compose(compose_file, env_file, 'infisical')
229
+ dc_resource('infisical-db', labels=['infra.tools', 'secrets'], resource_deps=['init-networks'], auto_init=True)
230
+ dc_resource('infisical-redis', labels=['infra.tools', 'secrets'], resource_deps=['init-networks'], auto_init=True)
231
+ dc_resource('infisical', labels=['infra.tools', 'secrets'], resource_deps=['init-networks', 'infisical-db', 'infisical-redis'], auto_init=True)
232
+
233
+
234
+ # =============================================================================
235
+ # 🌐 PROXY (Traefik)
236
+ # =============================================================================
237
+
238
+ def _load_standalone_traefik(root_prefix, env_file, write_fn):
239
+ """Generate and load a self-contained Traefik compose for standalone projects."""
240
+ compose_rel = ".tdk/.tdk-out/docker-compose.traefik.yml"
241
+ # The free-tier stub always reports "disabled"; the licensed module reports
242
+ # enabled for a manifest that opts in. Probing it keeps this file free of any
243
+ # license logic while starting the sablier containers only when they can work.
244
+ _, sablier_enabled = sablier_middleware_suffix({"sablier": {"enable": True}}, "probe")
245
+ content = generate_standalone_traefik_compose(
246
+ sablier_enabled,
247
+ os.environ.get('TDK_HTTP_PORT', '8080'),
248
+ os.environ.get('TDK_HTTPS_PORT', '8443'),
249
+ os.environ.get('TDK_BIND_ADDRESS', '127.0.0.1'),
250
+ )
251
+ if write_fn:
252
+ write_fn(compose_rel, content)
253
+ compose_file = root_prefix + compose_rel if root_prefix else compose_rel
254
+ print("🌐 Loading standalone Traefik from {}".format(compose_file))
255
+ _docker_compose(compose_file, env_file, 'traefik')
256
+ dc_resource(
257
+ "traefik",
258
+ labels=["infra.tools"],
259
+ resource_deps=["init-networks"],
260
+ auto_init=True,
261
+ )
262
+
263
+
264
+ def _load_proxy(should_enable, root_prefix="", env_file=None, write_fn=None):
265
+ """Load Traefik reverse proxy with proper health check sequencing."""
266
+ if not should_enable('proxy'):
267
+ debug_log("INFRA: proxy not enabled")
268
+ return
269
+
270
+ compose_files = [
271
+ root_prefix + 'shared-product-engineering/introvertic/infra/docker-compose.traefik.yml',
272
+ root_prefix + 'services/platform/proxy/docker-compose.core.yml',
273
+ root_prefix + 'services/platform/proxy/docker-compose.utilities.yml',
274
+ root_prefix + 'services/platform/proxy/docker-compose.redirects.yml',
275
+ root_prefix + 'services/platform/proxy/docker-compose.docs.yml',
276
+ ]
277
+ missing = [path for path in compose_files if not _file_exists(path)]
278
+ if missing:
279
+ debug_log("INFRA: Platform proxy compose missing ({}), using standalone Traefik".format(missing[0]))
280
+ _load_standalone_traefik(root_prefix, env_file, write_fn)
281
+ return
282
+
283
+ print("🌐 Loading proxy services from Introvertic Infra...")
284
+ print(" → Primary: shared-product-engineering/introvertic/infra/docker-compose.traefik.yml")
285
+ print(" → Override flags: TRAEFIK_LOG_LEVEL, TRAEFIK_ENABLE_DASHBOARD, etc.")
286
+ print(" → Traefik will wait for postgres and nats to be healthy")
287
+ print(" → Services configured with 60s startup grace period")
288
+
289
+ # Use introvertic/infra traefik configuration (primary)
290
+ # Keep legacy core.yml for network definitions during migration
291
+ _docker_compose(compose_files, env_file, 'proxy')
292
+
293
+ # Traefik depends on core infrastructure being healthy (not just started) to prevent 504s
294
+ dc_resource('traefik',
295
+ labels=['infra.tools'],
296
+ resource_deps=['init-networks', 'postgres', 'nats'],
297
+ auto_init=True)
298
+ dc_resource('dashy',
299
+ labels=['infra.tools'],
300
+ resource_deps=['traefik'],
301
+ auto_init=False)
302
+ dc_resource('main-redirect',
303
+ labels=['infra.tools'],
304
+ resource_deps=['traefik'],
305
+ auto_init=False)
306
+ dc_resource('traefik-pages',
307
+ labels=['infra.tools'],
308
+ resource_deps=['traefik'],
309
+ auto_init=False)
310
+ dc_resource('tilt-proxy',
311
+ labels=['infra.tools'],
312
+ resource_deps=['traefik'],
313
+ auto_init=False)
314
+
315
+
316
+ # =============================================================================
317
+ # 📊 MONITORING (SigNoz, SkyWalking)
318
+ # =============================================================================
319
+
320
+ def _load_monitoring(should_enable, root_prefix="", env_file=None):
321
+ """Load monitoring and observability stack."""
322
+ if not should_enable('monitoring'):
323
+ return
324
+
325
+ print("📊 Loading monitoring services...")
326
+ _docker_compose(root_prefix + 'services/platform/monitoring/docker-compose.yml', env_file, 'monitoring')
327
+ for svc in ['signoz-frontend', 'signoz-otel-collector', 'signoz-query-service']:
328
+ dc_resource(svc, labels=['observability.apm'], auto_init=True)
329
+ dc_resource('clickhouse', labels=['observability.storage'], auto_init=True)
330
+ dc_resource('elasticsearch', labels=['observability.storage'], auto_init=True)
331
+ dc_resource('skywalking-oap', labels=['observability.apm'], resource_deps=['elasticsearch'], auto_init=True)
332
+ dc_resource('skywalking-ui', labels=['observability.apm'], resource_deps=['skywalking-oap'], auto_init=True)
333
+
334
+
335
+ # =============================================================================
336
+ # 🔄 DEBEZIUM (CDC)
337
+ # =============================================================================
338
+
339
+ def _load_debezium(should_enable, root_prefix="", env_file=None):
340
+ """Load Debezium Change Data Capture."""
341
+ if not should_enable('debezium'):
342
+ return
343
+
344
+ print("🔄 Loading Enhanced Debezium...")
345
+ _docker_compose(root_prefix + 'services/platform/cdc/docker-compose.enhanced.yml', env_file, 'cdc')
346
+ dc_resource('nats-http-bridge', labels=['cdc'], resource_deps=['nats'], auto_init=True)
347
+ dc_resource('debezium-connect', labels=['cdc'], resource_deps=['kafka', 'postgres', 'nats-http-bridge'], auto_init=True)
348
+ dc_resource('enhanced-connector-setup', labels=['cdc'], resource_deps=['debezium-connect', 'postgres', 'nats-http-bridge'], auto_init=False)
349
+
350
+
351
+ # =============================================================================
352
+ # 📊 ELK STACK
353
+ # =============================================================================
354
+
355
+ def _load_elk(should_enable, root_prefix="", env_file=None):
356
+ """Load ELK logging stack."""
357
+ if not should_enable('elk'):
358
+ return
359
+
360
+ print("📊 Loading ELK stack...")
361
+ _docker_compose(root_prefix + 'docker/elk-compose.yml', env_file, 'elk')
362
+ dc_resource('elasticsearch', labels=['observability.elk'], auto_init=True)
363
+ dc_resource('logstash', labels=['observability.elk', 'processor', 'logs'], resource_deps=['elasticsearch'], auto_init=True)
364
+ dc_resource('kibana', labels=['observability.elk', 'frontend', 'dashboard'], resource_deps=['elasticsearch'], auto_init=True)
365
+
366
+
367
+ # =============================================================================
368
+ # 🌐 NETWORK INITIALIZATION
369
+ # =============================================================================
370
+
371
+ def _init_networks(fix_docker_networks_fn):
372
+ """Initialize Docker networks."""
373
+ local_resource('init-networks',
374
+ cmd=fix_docker_networks_fn(),
375
+ labels=['infra.setup'],
376
+ auto_init=True,
377
+ resource_deps=[]
378
+ )
379
+
380
+
381
+ # =============================================================================
382
+ # 🏗️ GOLDEN IMAGE (Base Docker Image)
383
+ # =============================================================================
384
+
385
+ def _load_golden_image(should_enable, docker_provider, project_root='.'):
386
+ """Build the golden base image for faster service builds.
387
+
388
+ project_root must be passed through here the same way every other
389
+ infra loader below receives it (as root_prefix) - local_resource cmds
390
+ run relative to the Tiltfile's own directory (.tdk/.tdk-out/), not
391
+ the project root, so an unprefixed project-root-relative path like
392
+ GOLDEN_DOCKERFILE resolves to the wrong file otherwise.
393
+ """
394
+ if not should_enable('golden-image'):
395
+ return None
396
+
397
+ print("🏗️ Building golden base image...")
398
+ return docker_provider.golden_image.build(project_root=project_root)
399
+
400
+
401
+ def _generate_golden_dockerfile(should_enable, docker_provider, write_fn):
402
+ """Generate the golden-layers.Dockerfile if it doesn't exist.
403
+
404
+ Args:
405
+ should_enable: Function that takes service name and returns bool
406
+ docker_provider: Docker provider struct with golden_image
407
+ write_fn: File writing function for output
408
+ """
409
+ if not should_enable('golden-image'):
410
+ return
411
+
412
+ dockerfile_path = '.tdk/.tdk-out/golden-layers.Dockerfile'
413
+ content = docker_provider.golden_image.generate_dockerfile()
414
+ write_fn(dockerfile_path, content)
415
+
416
+
417
+ # =============================================================================
418
+ # 🎯 MAIN LOADER
419
+ # =============================================================================
420
+
421
+ def load_all_infrastructure(should_enable, fix_docker_networks_fn=None, docker_provider=None, write_fn=None, project_root=None, env_file=None):
422
+ """
423
+ Load all infrastructure services based on configuration.
424
+
425
+ Args:
426
+ should_enable: Function that takes service name and returns bool
427
+ fix_docker_networks_fn: Function to fix Docker networks (optional)
428
+ docker_provider: Docker provider struct (optional, for golden image)
429
+ write_fn: File writing function (optional, for golden image)
430
+ project_root: Path to project root from Flisk working directory (optional, e.g., "../../")
431
+ env_file: Path to .env file for docker-compose (optional, defaults to project_root + '.env')
432
+ """
433
+ # Initialize networks first
434
+ if fix_docker_networks_fn:
435
+ debug_log("INFRA: Initializing networks...")
436
+ _init_networks(fix_docker_networks_fn)
437
+ debug_log("INFRA: Networks initialized")
438
+ else:
439
+ debug_log("INFRA: SKIPPING network initialization (no fix_docker_networks_fn)")
440
+
441
+ # These stacks both define an `elasticsearch` resource (and host port 9200).
442
+ # Running both at once causes compose/resource collisions and unstable startup.
443
+ if should_enable('monitoring') and should_enable('elk'):
444
+ fail("Incompatible flags: 'monitoring' and 'elk' cannot both be enabled at the same time. Disable one of them.")
445
+
446
+ # Size Tilt's parallel image builds to the Docker engine before any build is queued
447
+ configure_build_concurrency()
448
+
449
+ # Build golden image before other infrastructure (if enabled)
450
+ golden_image_resource = None
451
+ if docker_provider and write_fn:
452
+ _generate_golden_dockerfile(should_enable, docker_provider, write_fn)
453
+ golden_image_resource = _load_golden_image(should_enable, docker_provider, project_root=project_root or '.')
454
+
455
+ # Get project root prefix for paths (e.g., "../../" from .tdk/.tdk-out/)
456
+ # Ensure root_prefix ends with / for proper path concatenation
457
+ root_prefix = project_root if project_root else ""
458
+ if root_prefix and not root_prefix.endswith('/'):
459
+ root_prefix = root_prefix + '/'
460
+
461
+ # Load environment file for docker-compose variables
462
+ # Use provided env_file or construct default from root_prefix.
463
+ # `docker compose ... --env-file <path>` hard-fails if that path doesn't exist, and
464
+ # .env is gitignored (with no .env.example shipped) across every Flisk example repo, so
465
+ # a fresh clone must fall back to no --env-file flag rather than a dangling path.
466
+ if env_file == None:
467
+ candidate_env_file = root_prefix + '.env' if root_prefix else '.env'
468
+ env_file = candidate_env_file if _file_exists(candidate_env_file) else None
469
+
470
+ # Load infrastructure in order
471
+ _load_database_management(should_enable, root_prefix, env_file, write_fn)
472
+ _load_verdaccio(should_enable, root_prefix, env_file)
473
+ _load_infisical(should_enable, root_prefix, env_file)
474
+ _load_proxy(should_enable, root_prefix, env_file, write_fn)
475
+ _load_monitoring(should_enable, root_prefix, env_file)
476
+ _load_debezium(should_enable, root_prefix, env_file)
477
+ _load_elk(should_enable, root_prefix, env_file)
478
+
479
+ return golden_image_resource
480
+
481
+
482
+ # =============================================================================
483
+ # 📦 INFRA STRUCT (Public API)
484
+ # =============================================================================
485
+
486
+ Infra = struct(
487
+ # Main loader
488
+ load_all = load_all_infrastructure,
489
+ init_networks = _init_networks,
490
+
491
+ # Individual loaders (for granular control)
492
+ load_database = _load_database_management,
493
+ load_verdaccio = _load_verdaccio,
494
+ load_infisical = _load_infisical,
495
+ load_proxy = _load_proxy,
496
+ load_monitoring = _load_monitoring,
497
+ load_debezium = _load_debezium,
498
+ load_elk = _load_elk,
499
+ load_golden_image = _load_golden_image,
500
+
501
+ # Shared platform Postgres start signal (dependsOn postgres/database-management
502
+ # when the database-management feature is off). Idempotent; no messaging/kafka/Prisma.
503
+ force_start_postgres = force_start_platform_postgres,
504
+ )
@@ -0,0 +1,32 @@
1
+ # Copyright (c) 2026 Flisk Landscape contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 📚 TILT SDK - LIBRARIES LIFECYCLE MODULE
5
+ # =============================================================================
6
+ # Purpose: Public API facade for library management modules.
7
+ # =============================================================================
8
+
9
+ load('./libs_paths.star', 'LibsPaths')
10
+ load('./libs_discovery.star', 'LibsDiscovery')
11
+ load('./libs_resource_definition.star', 'LibsResourceDefinition')
12
+ load('./libs_setup.star', 'LibsSetup')
13
+ load('./libs_tsconfig.star', 'LibsTSConfig')
14
+
15
+
16
+ Libs = struct(
17
+ # Path resolution
18
+ get_path = LibsPaths.get_path,
19
+
20
+ # Dependency discovery
21
+ discover_resource_libs = LibsDiscovery.discover_resource_libs,
22
+ discover_deps_from_json = LibsDiscovery.discover_deps_from_json,
23
+ get_resource_paths = LibsPaths.get_resource_paths,
24
+ get_deps_mapping = LibsPaths.get_deps_mapping,
25
+
26
+ # Resource definition
27
+ define_resource = LibsResourceDefinition.define_resource,
28
+ setup_all = LibsSetup.setup_all,
29
+
30
+ # TSConfig factory
31
+ make_smart_tsconfig = LibsTSConfig.make_smart_tsconfig,
32
+ )
@@ -0,0 +1,104 @@
1
+ # Copyright (c) 2026 Flisk Landscape contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 🔍 TILT SDK - LIBRARY DEPENDENCY DISCOVERY
5
+ # =============================================================================
6
+
7
+ load('./libs_paths.star', 'LibsPaths')
8
+
9
+ _get_lib_path_from_package_name = LibsPaths.get_path
10
+ _read_package_json_deps = LibsPaths.read_package_json_deps
11
+
12
+
13
+ def discover_resource_libraries(ctx, resource_paths, max_depth=10):
14
+ """
15
+ Recursively discovers all internal library dependencies for given service paths.
16
+
17
+ Returns:
18
+ Dict of {package_name: {'name': str, 'path': str, 'label': str, 'tilt_resource': str}}
19
+ """
20
+ needed_libs = {}
21
+ visited = {}
22
+
23
+ queue = []
24
+ for resource_path in resource_paths:
25
+ pkg_path = resource_path + '/package.json'
26
+ queue.append((pkg_path, 0))
27
+
28
+ iteration = 0
29
+ max_iterations = 1000
30
+
31
+ while len(queue) > 0 and iteration < max_iterations:
32
+ iteration = iteration + 1
33
+
34
+ current = queue[0]
35
+ queue = queue[1:]
36
+
37
+ pkg_path = current[0]
38
+ depth = current[1]
39
+
40
+ if pkg_path in visited:
41
+ continue
42
+ visited[pkg_path] = True
43
+
44
+ if depth > max_depth:
45
+ continue
46
+
47
+ internal_deps = _read_package_json_deps(ctx, pkg_path)
48
+
49
+ for dep_name in internal_deps:
50
+ if dep_name in needed_libs:
51
+ continue
52
+
53
+ lib_info = _get_lib_path_from_package_name(ctx, dep_name)
54
+ lib_path = lib_info[0]
55
+ lib_label = lib_info[1]
56
+ tilt_resource = lib_info[2]
57
+
58
+ if lib_path == None:
59
+ continue
60
+
61
+ lib_name = lib_path.split('/')[-1]
62
+ lib_internal_deps = _read_package_json_deps(ctx, lib_path + '/package.json')
63
+
64
+ needed_libs[dep_name] = {
65
+ 'name': lib_name,
66
+ 'path': lib_path,
67
+ 'label': lib_label,
68
+ 'package_name': dep_name,
69
+ 'tilt_resource': tilt_resource,
70
+ 'internal_deps': lib_internal_deps,
71
+ }
72
+
73
+ lib_pkg_path = lib_path + '/package.json'
74
+ if lib_pkg_path not in visited:
75
+ queue.append((lib_pkg_path, depth + 1))
76
+
77
+ return needed_libs
78
+
79
+
80
+ def discover_dependencies_from_json(ctx, resource_path):
81
+ """
82
+ Discovers library dependencies for a SINGLE service from its package.json.
83
+
84
+ Returns:
85
+ List of Tilt resource names: ['lib-platform-...', ...]
86
+ """
87
+ pkg_path = resource_path + '/package.json'
88
+ internal_deps = _read_package_json_deps(ctx, pkg_path)
89
+
90
+ tilt_resources = []
91
+ for dep_name in internal_deps:
92
+ lib_info = _get_lib_path_from_package_name(ctx, dep_name)
93
+ tilt_resource = lib_info[2]
94
+
95
+ if tilt_resource != None and tilt_resource not in tilt_resources:
96
+ tilt_resources.append(tilt_resource)
97
+
98
+ return tilt_resources
99
+
100
+
101
+ LibsDiscovery = struct(
102
+ discover_resource_libs = discover_resource_libraries,
103
+ discover_deps_from_json = discover_dependencies_from_json,
104
+ )