@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,422 @@
1
+ # Copyright (c) 2026 Flisk Landscape contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 🔐 INFISICAL SECRETS GENERATOR
5
+ # =============================================================================
6
+ # Generates secret injection configuration for services
7
+ # Replaces: Shell-based infisical-entrypoint.sh injection
8
+ # =============================================================================
9
+ #
10
+ # This module generates:
11
+ # - Environment variable mappings for secret paths
12
+ # - Docker Compose secret injection configuration
13
+ # - Kubernetes secret references (future)
14
+ # - Local development .env templates
15
+ #
16
+ # Usage:
17
+ # load("./infisical/secrets_generator.star", "SecretsGenerator")
18
+ # config = SecretsGenerator.generate_for_service("my-service", "/services/my-service")
19
+ # =============================================================================
20
+
21
+ def _get_timestamp():
22
+ """Get current timestamp string"""
23
+ return str(local("date +%Y-%m-%dT%H:%M:%S", quiet=True)).strip()
24
+
25
+ # =============================================================================
26
+ # Secret Path Configuration
27
+ # =============================================================================
28
+
29
+ DEFAULT_SECRET_KEYS = [
30
+ "DATABASE_URL",
31
+ "JWT_SECRET",
32
+ "RESOURCE_API_KEY",
33
+ "REDIS_URL",
34
+ "NATS_URL",
35
+ "STRIPE_SECRET_KEY",
36
+ "STRIPE_WEBHOOK_SECRET",
37
+ "API_GATEWAY_TOKEN",
38
+ ]
39
+
40
+ # Required secrets for each service type
41
+ RESOURCE_TYPE_SECRETS = {
42
+ "backend": [
43
+ "DATABASE_URL",
44
+ "JWT_SECRET",
45
+ "RESOURCE_API_KEY",
46
+ ],
47
+ "frontend": [
48
+ "API_GATEWAY_TOKEN",
49
+ ],
50
+ "api-gateway": [
51
+ "JWT_SECRET",
52
+ "RESOURCE_API_KEY",
53
+ ],
54
+ "payment": [
55
+ "DATABASE_URL",
56
+ "JWT_SECRET",
57
+ "RESOURCE_API_KEY",
58
+ "STRIPE_SECRET_KEY",
59
+ "STRIPE_WEBHOOK_SECRET",
60
+ ],
61
+ "notification": [
62
+ "DATABASE_URL",
63
+ "JWT_SECRET",
64
+ "RESOURCE_API_KEY",
65
+ "SMTP_PASSWORD",
66
+ "SENDGRID_API_KEY",
67
+ ],
68
+ }
69
+
70
+ # =============================================================================
71
+ # Secret Injection Patterns
72
+ # =============================================================================
73
+
74
+ def _generate_docker_compose_env(resource_name, secret_path, additional_vars=None):
75
+ """
76
+ Generate Docker Compose environment section for secret injection.
77
+
78
+ Args:
79
+ resource_name: Name of the service
80
+ secret_path: Infisical path (e.g., /services/my-service)
81
+ additional_vars: Additional environment variables dict
82
+
83
+ Returns:
84
+ Dictionary for docker-compose environment section
85
+ """
86
+ env = {
87
+ # Core Infisical configuration
88
+ "RESOURCE_NAME": resource_name,
89
+ "INFISICAL_SECRET_PATH": secret_path,
90
+
91
+ # Token injection (from host env or Infisical)
92
+ "INFISICAL_TOKEN": "${INFISICAL_TOKEN:-}",
93
+ "INFISICAL_CLIENT_ID": "${INFISICAL_CLIENT_ID:-}",
94
+ "INFISICAL_CLIENT_SECRET": "${INFISICAL_CLIENT_SECRET:-}",
95
+
96
+ # API configuration
97
+ "INFISICAL_API_URL": "${INFISICAL_API_URL:-http://infisical:8080}",
98
+ "INFISICAL_PROJECT_ID": "${INFISICAL_PROJECT_ID:-}",
99
+ "INFISICAL_ENVIRONMENT": "${INFISICAL_ENVIRONMENT:-dev}",
100
+
101
+ # Fallback policy: this generator only feeds local Tilt/docker-compose dev
102
+ # environments (see topologies/platform/docker/compose/compose.star). There's
103
+ # rarely a real Infisical server running locally, so default to allowing the
104
+ # entrypoint to fall back to the plain env vars already in the compose file
105
+ # instead of failing to start. Production/CI paths (Kubernetes secrets, etc.)
106
+ # are generated separately and are unaffected by this default.
107
+ "INFISICAL_ALLOW_FALLBACK": "${INFISICAL_ALLOW_FALLBACK:-true}",
108
+ }
109
+
110
+ if additional_vars:
111
+ env.update(additional_vars)
112
+
113
+ return env
114
+
115
+ def _generate_entrypoint_env(resource_name, secret_path, command):
116
+ """
117
+ Generate environment for entrypoint.sh-based secret injection.
118
+
119
+ This is the zero-code pattern - entrypoint handles all secret fetching.
120
+
121
+ Args:
122
+ resource_name: Name of the service
123
+ secret_path: Infisical path
124
+ command: Command to run after secret injection
125
+
126
+ Returns:
127
+ Dict with entrypoint configuration
128
+ """
129
+ return {
130
+ "RESOURCE_NAME": resource_name,
131
+ "INFISICAL_SECRET_PATH": secret_path,
132
+ "INFISICAL_TOKEN": "${INFISICAL_TOKEN:-}",
133
+ "INFISICAL_CLIENT_ID": "${INFISICAL_CLIENT_ID:-}",
134
+ "INFISICAL_CLIENT_SECRET": "${INFISICAL_CLIENT_SECRET:-}",
135
+ "INFISICAL_API_URL": "${INFISICAL_API_URL:-http://infisical:8080}",
136
+ "INFISICAL_PROJECT_ID": "${INFISICAL_PROJECT_ID:-}",
137
+ "INFISICAL_ENVIRONMENT": "${INFISICAL_ENVIRONMENT:-dev}",
138
+ "ENTRYPOINT_COMMAND": command,
139
+ "INFISICAL_ALLOW_FALLBACK": "false",
140
+ }
141
+
142
+ def _generate_kubernetes_secret_ref(resource_name, secret_path):
143
+ """
144
+ Generate Kubernetes secret reference configuration.
145
+
146
+ Args:
147
+ resource_name: Name of the service
148
+ secret_path: Infisical path
149
+
150
+ Returns:
151
+ Dict with Kubernetes secret configuration
152
+ """
153
+ return {
154
+ "apiVersion": "v1",
155
+ "kind": "Secret",
156
+ "metadata": {
157
+ "name": "{}-secrets".format(resource_name),
158
+ "annotations": {
159
+ "infisical.path": secret_path,
160
+ "infisical.operator.kubernetes.io/auto-reload": "true",
161
+ },
162
+ },
163
+ "type": "Opaque",
164
+ }
165
+
166
+ # =============================================================================
167
+ # Local Development Configuration
168
+ # =============================================================================
169
+
170
+ def _generate_local_env_template(resource_name, secret_path, resource_type="backend"):
171
+ """
172
+ Generate .env file template for local development.
173
+
174
+ Args:
175
+ resource_name: Name of the service
176
+ secret_path: Infisical path
177
+ resource_type: Type of service for determining required secrets
178
+
179
+ Returns:
180
+ String content for .env file
181
+ """
182
+ required_secrets = RESOURCE_TYPE_SECRETS.get(resource_type, RESOURCE_TYPE_SECRETS["backend"])
183
+ timestamp = _get_timestamp()
184
+
185
+ lines = [
186
+ "# Infisical Local Development Configuration",
187
+ "# Service: {}".format(resource_name),
188
+ "# Path: {}".format(secret_path),
189
+ "# Generated: {}".format(timestamp),
190
+ "#",
191
+ "# ⚠️ SECURITY WARNING: Do not commit this file to Git!",
192
+ "# This file should be in .gitignore",
193
+ "",
194
+ "# Infisical Connection",
195
+ "INFISICAL_API_URL=http://localhost:8089",
196
+ "INFISICAL_ENVIRONMENT=dev",
197
+ "INFISICAL_SECRET_PATH={}".format(secret_path),
198
+ "RESOURCE_NAME={}".format(resource_name),
199
+ "",
200
+ "# Authentication (Machine Identity)",
201
+ "# Get these from Infisical Dashboard > Identities > machine1",
202
+ "INFISICAL_CLIENT_ID=your-client-id-here",
203
+ "INFISICAL_CLIENT_SECRET=your-client-secret-here",
204
+ "INFISICAL_PROJECT_ID=your-project-id-here",
205
+ "",
206
+ "# Required Secrets (to be fetched from Infisical):",
207
+ ]
208
+
209
+ for secret in required_secrets:
210
+ lines.append("# {}=__will_be_fetched_from_infisical__".format(secret))
211
+
212
+ lines.extend([
213
+ "",
214
+ "# Tilt Integration (optional)",
215
+ "# These are injected by Tilt during local development",
216
+ "TILT_ENV=local",
217
+ "TILT_HOST=localhost",
218
+ ])
219
+
220
+ return "\n".join(lines)
221
+
222
+ # =============================================================================
223
+ # Validation
224
+ # =============================================================================
225
+
226
+ def _validate_secret_path(secret_path):
227
+ """
228
+ Validate Infisical secret path format.
229
+
230
+ Args:
231
+ secret_path: Path to validate
232
+
233
+ Returns:
234
+ Tuple (is_valid, error_message)
235
+ """
236
+ if not secret_path:
237
+ return False, "Secret path cannot be empty"
238
+
239
+ if not secret_path.startswith("/"):
240
+ return False, "Secret path must start with /"
241
+
242
+ # Valid characters: alphanumeric, hyphen, underscore, forward slash
243
+ valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_/"
244
+ invalid = []
245
+ for i in range(len(secret_path)):
246
+ c = secret_path[i]
247
+ if c not in valid_chars:
248
+ invalid.append(c)
249
+ if len(invalid) > 0:
250
+ return False, "Invalid characters in path: {}".format(invalid)
251
+
252
+ # Path depth limit (Infisical limitation)
253
+ parts = []
254
+ for x in secret_path.split("/"):
255
+ if x:
256
+ parts.append(x)
257
+ depth = len(parts)
258
+ if depth > 20:
259
+ return False, "Path depth exceeds maximum (20)"
260
+
261
+ return True, ""
262
+
263
+ def _validate_resource_name(resource_name):
264
+ """
265
+ Validate service name format.
266
+
267
+ Args:
268
+ resource_name: Name to validate
269
+
270
+ Returns:
271
+ Tuple (is_valid, error_message)
272
+ """
273
+ if not resource_name:
274
+ return False, "Service name cannot be empty"
275
+
276
+ # Valid characters: alphanumeric, hyphen, underscore
277
+ valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
278
+ invalid = []
279
+ for i in range(len(resource_name)):
280
+ c = resource_name[i]
281
+ if c not in valid_chars:
282
+ invalid.append(c)
283
+ if len(invalid) > 0:
284
+ return False, "Invalid characters in service name: {}".format(invalid)
285
+
286
+ if len(resource_name) > 64:
287
+ return False, "Service name too long (max 64 characters)"
288
+
289
+ return True, ""
290
+
291
+ # =============================================================================
292
+ # Main Generator Functions
293
+ # =============================================================================
294
+
295
+ def generate_for_service(resource_name, secret_path, resource_type="backend", command=None, additional_vars=None):
296
+ """
297
+ Generate complete secret injection configuration for a service.
298
+
299
+ This is the main entry point for secret generation.
300
+
301
+ Args:
302
+ resource_name: Name of the service (e.g., "user-management-backend")
303
+ secret_path: Infisical path (e.g., "/services/user")
304
+ resource_type: Type of service (backend, frontend, api-gateway, payment, notification)
305
+ command: Command to run after secret injection (for entrypoint pattern)
306
+ additional_vars: Additional environment variables
307
+
308
+ Returns:
309
+ Dict with all secret configurations:
310
+ {
311
+ "resource_name": str,
312
+ "secret_path": str,
313
+ "resource_type": str,
314
+ "validation": {"valid": bool, "errors": [str]},
315
+ "docker_compose": {"environment": dict},
316
+ "entrypoint": {"environment": dict},
317
+ "kubernetes": {"secret_ref": dict},
318
+ "local_template": str,
319
+ "required_secrets": [str],
320
+ }
321
+ """
322
+ # Validate inputs
323
+ path_valid, path_error = _validate_secret_path(secret_path)
324
+ name_valid, name_error = _validate_resource_name(resource_name)
325
+
326
+ errors = []
327
+ if not path_valid:
328
+ errors.append(path_error)
329
+ if not name_valid:
330
+ errors.append(name_error)
331
+
332
+ validation = {
333
+ "valid": path_valid and name_valid,
334
+ "errors": errors,
335
+ }
336
+
337
+ # Generate configurations
338
+ docker_compose_env = _generate_docker_compose_env(resource_name, secret_path, additional_vars)
339
+
340
+ entrypoint_env = None
341
+ if command:
342
+ entrypoint_env = _generate_entrypoint_env(resource_name, secret_path, command)
343
+
344
+ k8s_secret = _generate_kubernetes_secret_ref(resource_name, secret_path)
345
+ local_template = _generate_local_env_template(resource_name, secret_path, resource_type)
346
+ required_secrets = RESOURCE_TYPE_SECRETS.get(resource_type, RESOURCE_TYPE_SECRETS["backend"])
347
+
348
+ return {
349
+ "resource_name": resource_name,
350
+ "secret_path": secret_path,
351
+ "resource_type": resource_type,
352
+ "validation": validation,
353
+ "docker_compose": {
354
+ "environment": docker_compose_env,
355
+ },
356
+ "entrypoint": {
357
+ "environment": entrypoint_env,
358
+ } if entrypoint_env else None,
359
+ "kubernetes": {
360
+ "secret_ref": k8s_secret,
361
+ },
362
+ "local_template": local_template,
363
+ "required_secrets": required_secrets,
364
+ }
365
+
366
+ def generate_for_services_batch(services_config):
367
+ """
368
+ Generate secret configurations for multiple services.
369
+
370
+ Args:
371
+ services_config: List of dicts with keys:
372
+ - name: Service name
373
+ - path: Infisical path
374
+ - type: Service type (optional, default "backend")
375
+ - command: Entrypoint command (optional)
376
+ - additional_vars: Additional env vars (optional)
377
+
378
+ Returns:
379
+ Dict mapping service names to their configurations
380
+ """
381
+ results = {}
382
+
383
+ for config in services_config:
384
+ name = config.get("name")
385
+ path = config.get("path")
386
+ svc_type = config.get("type", "backend")
387
+ command = config.get("command")
388
+ additional = config.get("additional_vars")
389
+
390
+ if not name or not path:
391
+ results[name or "unknown"] = {
392
+ "validation": {"valid": False, "errors": ["Missing name or path"]},
393
+ }
394
+ continue
395
+
396
+ results[name] = generate_for_service(name, path, svc_type, command, additional)
397
+
398
+ return results
399
+
400
+ # =============================================================================
401
+ # Public API
402
+ # =============================================================================
403
+
404
+ SecretsGenerator = struct(
405
+ # Main generator functions
406
+ generate_for_service=generate_for_service,
407
+ generate_for_services_batch=generate_for_services_batch,
408
+
409
+ # Validation
410
+ validate_secret_path=_validate_secret_path,
411
+ validate_resource_name=_validate_resource_name,
412
+
413
+ # Configuration constants
414
+ DEFAULT_SECRET_KEYS=DEFAULT_SECRET_KEYS,
415
+ RESOURCE_TYPE_SECRETS=RESOURCE_TYPE_SECRETS,
416
+
417
+ # Individual generators (for advanced use)
418
+ generate_docker_compose_env=_generate_docker_compose_env,
419
+ generate_entrypoint_env=_generate_entrypoint_env,
420
+ generate_kubernetes_secret_ref=_generate_kubernetes_secret_ref,
421
+ generate_local_env_template=_generate_local_env_template,
422
+ )
@@ -0,0 +1,145 @@
1
+ # Copyright (c) 2026 Flisk Landscape contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 🌐 TILT SDK - NGINX PROVIDER
5
+ # =============================================================================
6
+ # Path: .tilt/providers/nginx.star
7
+ # Purpose: Generate nginx configs for frontend services
8
+ # =============================================================================
9
+
10
+
11
+ # === INLINED CONSTANTS for pure extension loading ===
12
+ BASE_PORT_FRONTEND = 3000
13
+ OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
14
+ # === END INLINED CONSTANTS ===
15
+
16
+
17
+ load('../../../topologies/tilt/common/utils.star', 'Utils')
18
+ load('../../../topologies/tilt/manifest/constants.star', 'GENERATED_CONFIG_FILENAMES')
19
+
20
+ # NOTE: api_gateway.star loaded by caller to avoid circular imports
21
+
22
+
23
+ def api_proxy_location(backend_name, port=BASE_PORT_FRONTEND, base_path='', stack=''):
24
+ """Return nginx location /api block that proxy_passes to the given backend (Vite-proxy style in prod)."""
25
+ return """
26
+ location /api {{
27
+ proxy_pass http://{backend}:{port};
28
+ proxy_http_version 1.1;
29
+ proxy_set_header Host $host;
30
+ proxy_set_header X-Real-IP $remote_addr;
31
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32
+ proxy_set_header X-Forwarded-Proto $scheme;
33
+ }}""".format(backend=backend_name, port=port)
34
+
35
+
36
+ def generate_frontend_nginx(manifest, write_fn=None, referer_map_block=''):
37
+ """
38
+ Generate nginx config for frontend services.
39
+
40
+ Args:
41
+ manifest: Service manifest dict
42
+ write_fn: Function to write files
43
+ referer_map_block: Generated referer map block (from ApiGateway)
44
+
45
+ Output:
46
+ {resource_path}/.autogenerated/nginx.autogenerated.conf
47
+ """
48
+ if manifest.get('appType') != 'frontend':
49
+ return ''
50
+
51
+ resource_path = manifest.get('_resource_path', '')
52
+ app_name = manifest.get('appName', 'unknown-frontend')
53
+ backend_name = manifest.get('backendName', 'backend')
54
+ header = Utils.get_template_header(
55
+ 'nginx',
56
+ 'Nginx.frontend()',
57
+ app_name,
58
+ 'Output: .autogenerated/' + GENERATED_CONFIG_FILENAMES['nginx'],
59
+ )
60
+
61
+ base_path = manifest.get('basePath', '')
62
+ stack = manifest.get('stack', '')
63
+ port = manifest.get('port', BASE_PORT_FRONTEND)
64
+ # NOTE: referer_map_block now passed as parameter to avoid circular import
65
+
66
+ conf = """{header}
67
+ # Docker DNS resolver
68
+ resolver 127.0.0.11 valid=30s ipv6=off;
69
+
70
+ {referer_map_block}
71
+
72
+ server {{
73
+ listen 80;
74
+ server_name _;
75
+ root /usr/share/nginx/html;
76
+ index index.html;
77
+
78
+ gzip on;
79
+ gzip_vary on;
80
+ gzip_min_length 1024;
81
+ gzip_proxied any;
82
+ gzip_comp_level 6;
83
+ gzip_types
84
+ text/plain
85
+ text/css
86
+ text/xml
87
+ text/javascript
88
+ application/json
89
+ application/javascript
90
+ application/xml+rss
91
+ application/atom+xml
92
+ image/svg+xml;
93
+
94
+ location / {{
95
+ try_files $uri $uri/ /index.html;
96
+ add_header Cache-Control "no-cache, no-store, must-revalidate" always;
97
+ add_header Pragma "no-cache" always;
98
+ add_header Expires "0" always;
99
+ }}
100
+
101
+ location ~* \\.(js|css)$ {{
102
+ expires 2m;
103
+ add_header Cache-Control "public, max-age=120, must-revalidate";
104
+ add_header Last-Modified $date_gmt;
105
+ add_header ETag off;
106
+ if_modified_since off;
107
+ }}
108
+
109
+ location ~* \\.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {{
110
+ expires 1y;
111
+ add_header Cache-Control "public, immutable";
112
+ }}
113
+
114
+ add_header X-Frame-Options "SAMEORIGIN" always;
115
+ add_header X-Content-Type-Options "nosniff" always;
116
+ add_header X-XSS-Protection "1; mode=block" always;
117
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
118
+
119
+ location /api {{
120
+ proxy_pass $api_backend;
121
+ proxy_http_version 1.1;
122
+ proxy_set_header Host $host;
123
+ proxy_set_header X-Real-IP $remote_addr;
124
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
125
+ proxy_set_header X-Forwarded-Proto $scheme;
126
+ proxy_set_header X-Referer $http_referer;
127
+ }}
128
+
129
+ location /health {{
130
+ access_log off;
131
+ return 200 "healthy\\n";
132
+ add_header Content-Type text/plain;
133
+ }}
134
+ }}""".format(header=header, referer_map_block=referer_map_block)
135
+
136
+ if write_fn:
137
+ write_fn(resource_path + '/' + OUTPUT.AUTOGENERATED_FOLDER + '/' + GENERATED_CONFIG_FILENAMES['nginx'], conf)
138
+
139
+ return conf
140
+
141
+
142
+ Nginx = struct(
143
+ api_proxy_location = api_proxy_location,
144
+ frontend = generate_frontend_nginx,
145
+ )
@@ -0,0 +1,132 @@
1
+ # Copyright (c) 2026 Flisk contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 📦 TILT SDK - NPM/BUN CONFIG PROVIDER
5
+ # =============================================================================
6
+ # Path: .tilt/providers/npmrc.star
7
+ # Purpose: Generate .npmrc and bunfig.toml for Verdaccio registry
8
+ # =============================================================================
9
+ #
10
+ # Generates configuration files for:
11
+ # - .npmrc / .npmrc.docker.autogenerated - NPM registry configuration
12
+ # - bunfig.toml / bunfig.docker.autogenerated.toml - Bun package manager configuration
13
+ #
14
+ # These files ensure services can install @{npm_scope}/* packages from
15
+ # the local Verdaccio registry during development.
16
+ # =============================================================================
17
+
18
+ load("../../../topologies/tilt/common/utils.star", "Utils")
19
+
20
+ # Output folder constant (consistent with other generators)
21
+ OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
22
+
23
+ # Load npm scope from project.json (or use project name as default)
24
+ # Use TDK_PROJECT_ROOT env var set by Tilt, fallback to current directory
25
+ def _load_npm_scope():
26
+ project_root = os.environ.get('TDK_PROJECT_ROOT', '')
27
+ project_json_path = '.tdk/project.json'
28
+ if project_root:
29
+ project_json_path = project_root + '/' + project_json_path
30
+
31
+ if os.path.exists(project_json_path):
32
+ _project_json = read_json(project_json_path)
33
+ return _project_json.get('project', {}).get('name', 'tdk-project')
34
+ return 'tdk-project'
35
+
36
+ _NPM_SCOPE = _load_npm_scope()
37
+ load("../../../topologies/tilt/manifest/constants.star", "PACKAGE_CONFIG_FILENAMES")
38
+
39
+ # =============================================================================
40
+ # 📝 NPMRC GENERATORS
41
+ # =============================================================================
42
+
43
+ def generate_npmrc(resource_path, registry_url, is_docker, write_fn, verdaccio_enabled=True):
44
+ """
45
+ Generate .npmrc for NPM registry configuration.
46
+
47
+ Args:
48
+ resource_path: Path to service directory
49
+ registry_url: Verdaccio registry URL
50
+ is_docker: If True, generates .npmrc.docker.autogenerated, else .npmrc
51
+ write_fn: File writer function
52
+ verdaccio_enabled: If False, scoped packages fall back to public npm (default True)
53
+ """
54
+ target_dir = resource_path + "/" + OUTPUT.AUTOGENERATED_FOLDER
55
+ generated_filename = PACKAGE_CONFIG_FILENAMES['npmrc_docker_autogenerated'] if is_docker else PACKAGE_CONFIG_FILENAMES['npmrc']
56
+ header = Utils.get_template_header("npmrc", target_dir + "/" + generated_filename)
57
+
58
+ if verdaccio_enabled:
59
+ # Verdaccio's default policy permits anonymous reads and requires
60
+ # authentication only for publishing. Keep user credentials in the
61
+ # user's npm config; generated project files must not contain defaults.
62
+ content = """{header}
63
+ registry=https://registry.npmjs.org/
64
+ @{npm_scope}:registry={registry_url}/
65
+ @tdk-landscape:registry={registry_url}/
66
+ @identity:registry={registry_url}/""".format(header=header, registry_url=registry_url, npm_scope=_NPM_SCOPE)
67
+ else:
68
+ # Verdaccio not enabled (no license key) — all scopes use public npm
69
+ content = """{header}
70
+ registry=https://registry.npmjs.org/
71
+ @{npm_scope}:registry=https://registry.npmjs.org/
72
+ @tdk-landscape:registry=https://registry.npmjs.org/
73
+ @identity:registry=https://registry.npmjs.org/""".format(header=header, npm_scope=_NPM_SCOPE)
74
+
75
+ filename = generated_filename
76
+ write_fn(target_dir + '/' + filename, content)
77
+
78
+
79
+ # =============================================================================
80
+ # 📝 BUNFIG GENERATORS
81
+ # =============================================================================
82
+
83
+ def generate_bunfig(resource_path, registry_url, is_docker, write_fn, verdaccio_enabled=True):
84
+ """
85
+ Generate bunfig.toml for Bun package manager configuration.
86
+
87
+ Args:
88
+ resource_path: Path to service directory
89
+ registry_url: Verdaccio registry URL
90
+ is_docker: If True, generates bunfig.docker.autogenerated.toml, else bunfig.toml
91
+ write_fn: File writer function
92
+ verdaccio_enabled: If False, scoped packages fall back to public npm (default True)
93
+ """
94
+ target_dir = resource_path + "/" + OUTPUT.AUTOGENERATED_FOLDER
95
+ generated_filename = PACKAGE_CONFIG_FILENAMES['bunfig_docker_autogenerated'] if is_docker else PACKAGE_CONFIG_FILENAMES['bunfig']
96
+ header = Utils.get_template_header("bunfig", target_dir + "/" + generated_filename)
97
+
98
+ if verdaccio_enabled:
99
+ content = """{header}
100
+ [install]
101
+ linker = "isolated"
102
+ linkWorkspacePackages = true
103
+ registry = "https://registry.npmjs.org"
104
+
105
+ [install.scopes]
106
+ "@{npm_scope}" = {{ url = "{registry_url}/" }}
107
+ "@tdk-landscape" = {{ url = "{registry_url}/" }}
108
+ "@identity" = {{ url = "{registry_url}/" }}
109
+
110
+ """.format(header=header, registry_url=registry_url, npm_scope=_NPM_SCOPE)
111
+ else:
112
+ # Verdaccio not enabled (no license key) — all scopes use public npm
113
+ content = """{header}
114
+ [install]
115
+ linker = "isolated"
116
+ linkWorkspacePackages = true
117
+ registry = "https://registry.npmjs.org"
118
+
119
+ """.format(header=header)
120
+
121
+ filename = generated_filename
122
+ write_fn(target_dir + '/' + filename, content)
123
+
124
+
125
+ # =============================================================================
126
+ # 🎯 PUBLIC API - Struct-based Exports
127
+ # =============================================================================
128
+
129
+ PackageConfig = struct(
130
+ npmrc = generate_npmrc,
131
+ bunfig = generate_bunfig,
132
+ )