@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,265 @@
1
+ #!/usr/bin/env starlark
2
+ # Copyright (c) 2026 Flisk contributors
3
+ # SPDX-License-Identifier: MIT
4
+ # =============================================================================
5
+ # 🗺️ TOPOLOGIES - DISCOVERY CONFIG
6
+ # =============================================================================
7
+
8
+ load("./constants.star", "RESOURCES_ROOT")
9
+ load("../engine/topologies/platform/docker/constants.star", "PlatformDockerConstants")
10
+
11
+ # NOTE: DEFAULTS and focus lists are now loaded dynamically in resource_registry.star
12
+ # from the project's spec.master (using TDK_PROJECT_ROOT environment variable).
13
+ # This allows per-project resource configuration.
14
+
15
+ # Default empty values - will be populated by _load_project_defaults() in resource_registry.star
16
+ DEFAULTS = {}
17
+ FOCUS_PRE_ALPHA = []
18
+ FOCUS_ALPHA = []
19
+ FOCUS_BETA = []
20
+
21
+ # Export a function to load project-specific defaults
22
+ def load_project_defaults(project_root):
23
+ """
24
+ Load DEFAULTS and focus lists from project spec.master.
25
+ Called by resource_registry.star during initialization.
26
+
27
+ Returns struct with loaded values or None if spec.master not found.
28
+ """
29
+ if not project_root:
30
+ return None
31
+
32
+ # Check multiple locations for spec.master (in order of preference)
33
+ spec_paths = [
34
+ project_root + "/.tdk/.tdk-out/generated/spec.master", # New unified output folder
35
+ project_root + "/spec.master", # Original location (legacy)
36
+ ]
37
+
38
+ spec_path = None
39
+ for path in spec_paths:
40
+ check_cmd = "test -f '{}' && echo 'yes' || echo 'no'".format(path)
41
+ exists = str(local(check_cmd, quiet=True, echo_off=True)).strip() == 'yes'
42
+ if exists:
43
+ spec_path = path
44
+ break
45
+
46
+ if not spec_path:
47
+ return None
48
+
49
+ # Read and parse the spec.master file
50
+ # Since we can't dynamically load, we parse it manually
51
+ spec_content_raw = read_file(spec_path, default="")
52
+ if not spec_content_raw:
53
+ return None
54
+
55
+ # Ensure content is a string (read_file may return bytes)
56
+ spec_content = str(spec_content_raw)
57
+
58
+ # Extract PRE_ALPHA_RESOURCES from the file
59
+ # This is a simple parser for the expected format
60
+ defaults = {}
61
+ pre_alpha = []
62
+ alpha = []
63
+ beta = []
64
+
65
+ # Parse PRE_ALPHA_RESOURCES
66
+ if "PRE_ALPHA_RESOURCES" in spec_content:
67
+ # Extract the dict content between { and }
68
+ start = spec_content.find("PRE_ALPHA_RESOURCES = {")
69
+ if start != -1:
70
+ start = spec_content.find("{", start)
71
+ end = spec_content.find("}", start)
72
+ if start != -1 and end != -1:
73
+ dict_content = spec_content[start+1:end]
74
+ # Parse "key": True/False entries
75
+ for line in dict_content.split("\n"):
76
+ line = line.strip()
77
+ if line and not line.startswith("#"):
78
+ # Extract key before colon
79
+ if '"' in line or "'" in line:
80
+ # Find quoted key
81
+ quote_char = '"' if '"' in line else "'"
82
+ key_start = line.find(quote_char)
83
+ key_end = line.find(quote_char, key_start + 1)
84
+ if key_start != -1 and key_end != -1:
85
+ key = line[key_start+1:key_end]
86
+ # Check if value is True
87
+ if "True" in line:
88
+ defaults[key] = True
89
+ pre_alpha.append(key)
90
+
91
+ # Parse ALPHA_RESOURCES
92
+ if "ALPHA_RESOURCES" in spec_content:
93
+ start = spec_content.find("ALPHA_RESOURCES = {")
94
+ if start != -1:
95
+ start = spec_content.find("{", start)
96
+ end = spec_content.find("}", start)
97
+ if start != -1 and end != -1:
98
+ dict_content = spec_content[start+1:end]
99
+ for line in dict_content.split("\n"):
100
+ line = line.strip()
101
+ if line and not line.startswith("#"):
102
+ if '"' in line or "'" in line:
103
+ quote_char = '"' if '"' in line else "'"
104
+ key_start = line.find(quote_char)
105
+ key_end = line.find(quote_char, key_start + 1)
106
+ if key_start != -1 and key_end != -1:
107
+ key = line[key_start+1:key_end]
108
+ if "True" in line:
109
+ defaults[key] = True
110
+ alpha.append(key)
111
+
112
+ # Parse BETA_RESOURCES
113
+ if "BETA_RESOURCES" in spec_content:
114
+ start = spec_content.find("BETA_RESOURCES = {")
115
+ if start != -1:
116
+ start = spec_content.find("{", start)
117
+ end = spec_content.find("}", start)
118
+ if start != -1 and end != -1:
119
+ dict_content = spec_content[start+1:end]
120
+ for line in dict_content.split("\n"):
121
+ line = line.strip()
122
+ if line and not line.startswith("#"):
123
+ if '"' in line or "'" in line:
124
+ quote_char = '"' if '"' in line else "'"
125
+ key_start = line.find(quote_char)
126
+ key_end = line.find(quote_char, key_start + 1)
127
+ if key_start != -1 and key_end != -1:
128
+ key = line[key_start+1:key_end]
129
+ if "True" in line:
130
+ defaults[key] = True
131
+ beta.append(key)
132
+
133
+ return struct(
134
+ DEFAULTS = defaults,
135
+ FOCUS_PRE_ALPHA = pre_alpha,
136
+ FOCUS_ALPHA = pre_alpha + alpha,
137
+ FOCUS_BETA = pre_alpha + alpha + beta,
138
+ )
139
+
140
+ # -----------------------------------------------------------------------------
141
+ # 🎛️ RESOURCE DEFAULTS
142
+ # -----------------------------------------------------------------------------
143
+ # LOADED FROM: spec.master (searched in order):
144
+ # 1. .tdk/.tdk-out/generated/spec.master (new unified output folder)
145
+ # 2. spec.master (legacy location in project root)
146
+ # PURPOSE: Single source of truth for resource enable/disable configuration
147
+ #
148
+ # 📖 To modify which resources run, edit: spec.master
149
+ # -----------------------------------------------------------------------------
150
+
151
+
152
+ def get_global_config():
153
+ verdaccio_url_docker = os.environ.get(
154
+ "VERDACCIO_URL_DOCKER",
155
+ PlatformDockerConstants.VERDACCIO_URL_DOCKER,
156
+ )
157
+ # Verdaccio is a premium feature — only enabled when a license key is present.
158
+ # Without a key, scoped packages fall back to the public npm registry.
159
+ verdaccio_license_key = os.environ.get("TDK_LICENSE_KEY", "")
160
+ verdaccio_enabled = verdaccio_license_key != ""
161
+ return {
162
+ "verdaccio_url_local": PlatformDockerConstants.VERDACCIO_URL_LOCAL,
163
+ "verdaccio_url_docker": verdaccio_url_docker,
164
+ "verdaccio_enabled": verdaccio_enabled,
165
+ "npm_registry": PlatformDockerConstants.VERDACCIO_NPM_REGISTRY,
166
+ "internal_scope": "@" + PlatformDockerConstants.PROJECT_NAME + "/",
167
+ "library_roots": {
168
+ "platform": "shared-platform-engineering",
169
+ "product": "shared-product-engineering",
170
+ "ddd": "shared-ddd-layers",
171
+ },
172
+ # Relative to .tilt/topologies/tilt/discovery/
173
+ "resources_root": RESOURCES_ROOT,
174
+ "database": PlatformDockerConstants.DB_CONFIG,
175
+ "docker": {
176
+ "base_image": PlatformDockerConstants.BUN_IMAGE,
177
+ "nginx_image": "nginx:alpine",
178
+ "golden_l1_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l1:latest",
179
+ "golden_l2_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l2:latest",
180
+ "golden_l3_backend_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l3-backend:latest",
181
+ "golden_l3_frontend_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l3-frontend:latest",
182
+ "golden_l3_migrator_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l3-backend:latest",
183
+ "golden_l4_backend_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l4-backend:latest",
184
+ "golden_l4_frontend_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l4-frontend:latest",
185
+ "golden_l4_migrator_image": PlatformDockerConstants.PROJECT_NAME_HYPHEN + "-l4-migrator:latest",
186
+ "network_prefix": PlatformDockerConstants.PROJECT_NAME + "_",
187
+ },
188
+ "ports": {
189
+ "backend": 3000,
190
+ "frontend": 80,
191
+ "postgres": 5432,
192
+ "nats": 4222,
193
+ "verdaccio": PlatformDockerConstants.VERDACCIO_PORT,
194
+ },
195
+ }
196
+
197
+
198
+ GLOBAL_CONFIG = get_global_config()
199
+
200
+ INFRA_RESOURCES = [
201
+ {"name": "database-management", "memory": 1152},
202
+ {"name": "proxy", "memory": 384},
203
+ {"name": "api-gateway", "memory": 512},
204
+ {"name": "verdaccio", "memory": 128},
205
+ {"name": "infisical", "memory": 192},
206
+ {"name": "monitoring", "memory": 1536},
207
+ {"name": "elk", "memory": 1024},
208
+ {"name": "debezium", "memory": 448},
209
+ ]
210
+
211
+ CORE_INFRA = [
212
+ "init-networks",
213
+ "golden-layers-build",
214
+ "postgres",
215
+ "nats",
216
+ "traefik",
217
+ ]
218
+
219
+ INFRA_STACK_MAP = {
220
+ "golden-layers-build": "golden-image",
221
+ "postgres": "database-management",
222
+ "nats": "database-management",
223
+ "redis": "database-management",
224
+ "traefik": "proxy",
225
+ "verdaccio": "verdaccio",
226
+ "infisical": "infisical",
227
+ }
228
+
229
+ OPTIONAL_INFRA = {
230
+ "monitoring": ["signoz-frontend", "signoz-otel-collector", "signoz-query-service", "clickhouse", "elasticsearch", "skywalking-oap", "skywalking-ui"],
231
+ "infisical": ["infisical", "infisical-db", "infisical-redis"],
232
+ "elk": ["elasticsearch", "logstash", "kibana"],
233
+ "debezium": ["kafka", "zookeeper", "nats-http-bridge", "debezium-connect", "enhanced-connector-setup"],
234
+ }
235
+
236
+ # -----------------------------------------------------------------------------
237
+ # 📚 LIBRARY DEFINITIONS
238
+ # -----------------------------------------------------------------------------
239
+ # Libraries are auto-discovered from the filesystem in libraries.star.
240
+ # Only non-auto-discoverable definitions (e.g. DDD layer paths) live here.
241
+ # -----------------------------------------------------------------------------
242
+
243
+ DDD_LIBS = [
244
+ {"name": "domain", "path": "shared-ddd-layers/domain"},
245
+ {"name": "infrastructure", "path": "shared-ddd-layers/infrastructure"},
246
+ {"name": "application", "path": "shared-ddd-layers/application"},
247
+ {"name": "presentation", "path": "shared-ddd-layers/presentation"},
248
+ ]
249
+
250
+ # Export DEFAULTS and focus filters for use by other modules via Config struct
251
+ # Note: These will be populated by load_project_defaults() in resource_registry.star
252
+ Config = struct(
253
+ load_project_defaults = load_project_defaults,
254
+ DEFAULTS = DEFAULTS,
255
+ FOCUS_PRE_ALPHA = FOCUS_PRE_ALPHA,
256
+ FOCUS_ALPHA = FOCUS_ALPHA,
257
+ FOCUS_BETA = FOCUS_BETA,
258
+ GLOBAL = GLOBAL_CONFIG,
259
+ INFRA_RESOURCES = INFRA_RESOURCES,
260
+ CORE_INFRA = CORE_INFRA,
261
+ INFRA_STACK_MAP = INFRA_STACK_MAP,
262
+ OPTIONAL_INFRA = OPTIONAL_INFRA,
263
+ DDD_LIBS = DDD_LIBS,
264
+
265
+ )
@@ -0,0 +1,167 @@
1
+ # Copyright (c) 2026 Flisk contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # =============================================================================
4
+ # 📍 TOPOLOGIES - DISCOVERY CONSTANTS
5
+ # =============================================================================
6
+
7
+ # Import manifest filename from local manifest folder (self-contained)
8
+ load("./manifest/constants.star",
9
+ _manifest_file="MANIFEST_FILENAME",
10
+ _manifest_file_yaml="MANIFEST_FILENAME_YAML"
11
+ )
12
+
13
+ # Re-export for consumers of this module
14
+ MANIFEST_FILENAME = _manifest_file
15
+ MANIFEST_FILENAME_YAML = _manifest_file_yaml
16
+
17
+ # NOTE: These paths are resolved relative to the TILTFILE directory (project root)
18
+ # NOT relative to this module's location
19
+ RESOURCES_ROOT = "services/product"
20
+ RESOURCES_ROOT_PREFIX = ""
21
+
22
+ # Check for project-specific discovery patterns
23
+ def _get_project_discovery_roots():
24
+ """Get discovery roots from project spec.master if available."""
25
+ project_root = os.environ.get('TDK_PROJECT_ROOT', '')
26
+ if not project_root:
27
+ return []
28
+
29
+ # Try to read spec.master for custom discovery patterns
30
+ spec_paths = [
31
+ project_root + "/.tdk/.tdk-out/spec.master",
32
+ project_root + "/spec.master",
33
+ ]
34
+
35
+ for spec_path in spec_paths:
36
+ check_cmd = "test -f '{}' && echo 'yes' || echo 'no'".format(spec_path)
37
+ exists = str(local(check_cmd, quiet=True, echo_off=True)).strip() == 'yes'
38
+ if exists:
39
+ # Read and parse spec.master for RESOURCE_PATTERNS
40
+ spec_content = str(read_file(spec_path, default=""))
41
+ if "RESOURCE_PATTERNS" in spec_content:
42
+ # Extract patterns from the array
43
+ start = spec_content.find("RESOURCE_PATTERNS = [")
44
+ if start != -1:
45
+ start = spec_content.find("[", start)
46
+ end = spec_content.find("]", start)
47
+ if start != -1 and end != -1:
48
+ array_content = spec_content[start+1:end]
49
+ patterns = []
50
+ for part in array_content.split(","):
51
+ part = part.strip().strip("'").strip('"').strip()
52
+ if part and not part.startswith("#"):
53
+ patterns.append(part)
54
+ if patterns:
55
+
56
+ return patterns
57
+ return []
58
+
59
+ # Get project-specific roots or fall back to defaults
60
+ _PROJECT_DISCOVERY_ROOTS = _get_project_discovery_roots()
61
+
62
+ def _get_enabled_project_stacks():
63
+ """Read enabled stack names from .tdk/project.json phases.*.enabledStacks."""
64
+ project_root = os.environ.get('TDK_PROJECT_ROOT', '')
65
+ if not project_root:
66
+ return []
67
+
68
+ project_config_path = project_root + "/.tdk/project.json"
69
+ exists = str(local("test -f '{}' && echo 'yes' || echo 'no'".format(project_config_path), quiet=True, echo_off=True)).strip() == 'yes'
70
+ if not exists:
71
+ return []
72
+
73
+ project_config = read_json(project_config_path)
74
+ phases = project_config.get("phases", {})
75
+ enabled = []
76
+ seen = {}
77
+ for phase_name in ["pre_alpha", "alpha", "beta"]:
78
+ phase = phases.get(phase_name, {})
79
+ for stack in phase.get("enabledStacks", []):
80
+ if stack and stack not in seen:
81
+ enabled.append(stack)
82
+ seen[stack] = True
83
+ return enabled
84
+
85
+ def _expand_enabled_stack_roots(roots):
86
+ """Narrow broad services/*/* discovery to the stacks enabled in project.json."""
87
+ enabled_stacks = _get_enabled_project_stacks()
88
+ if not enabled_stacks:
89
+ return roots
90
+
91
+ expanded = []
92
+ for root in roots:
93
+ if root == "services/*/*":
94
+ for stack in enabled_stacks:
95
+ expanded.append("services/" + stack)
96
+ else:
97
+ expanded.append(root)
98
+ return expanded
99
+
100
+ # Phase 2: Universal Discovery - Scan roots configuration
101
+ # Each root is scanned for service.json files
102
+ # Paths are relative to PROJECT_ROOT (where Tiltfile is located)
103
+ _DISCOVERY_ROOTS_RAW = _expand_enabled_stack_roots(_PROJECT_DISCOVERY_ROOTS) if _PROJECT_DISCOVERY_ROOTS else [
104
+ RESOURCES_ROOT, # services/product/*/*/
105
+ "services/platform", # services/platform/*/*/
106
+ "shared-product-engineering", # shared-product-engineering/*/
107
+ "cli-platform-engineering", # cli-platform-engineering/*/
108
+ ]
109
+
110
+ # SAFETY: Filter out tdk-cli's own directories to prevent self-modification
111
+ # The CLI should never scan or write to its own installation directory
112
+ def _filter_cli_dirs(roots):
113
+ """Remove tdk-cli internal directories from scan roots."""
114
+ filtered = []
115
+ for root in roots:
116
+ # Skip if path contains tdk-cli internal paths
117
+ if "tdk-cli" in root and "discovery" in root:
118
+ print("⚠️ Skipping tdk-cli internal directory: {}".format(root))
119
+ continue
120
+ if root.startswith("discovery/") or root == "discovery":
121
+ print("⚠️ Skipping discovery directory: {}".format(root))
122
+ continue
123
+ filtered.append(root)
124
+ return filtered
125
+
126
+ DISCOVERY_SCAN_ROOTS = _filter_cli_dirs(_DISCOVERY_ROOTS_RAW)
127
+
128
+ # Phase 2: Explicit stack extraction patterns for each root type
129
+ # Documents HOW to extract stack from different directory structures
130
+ SCAN_ROOT_PATTERNS = {
131
+ RESOURCES_ROOT: {
132
+ "stack_depth": -3, # services/product/{STACK}/{service}/
133
+ "description": "Stack-grouped services (product)"
134
+ },
135
+ "services/platform": {
136
+ "stack_depth": -2, # services/platform/{SERVICE}/ (flat)
137
+ "description": "Flat platform services"
138
+ },
139
+ "shared-product-engineering": {
140
+ "stack_depth": -2, # shared-product-engineering/{SERVICE}/ (flat)
141
+ "description": "Shared libraries (flat)"
142
+ },
143
+ "cli-platform-engineering": {
144
+ "stack_depth": -2, # cli-platform-engineering/{SERVICE}/ (flat)
145
+ "description": "CLI tools (flat)"
146
+ },
147
+ }
148
+
149
+ # Phase 2: Performance guardrails (Phase 3 optimization baseline)
150
+ MAX_SCAN_TIMEOUT_MS = 5000 # 5 seconds per root (warn if exceeded)
151
+ MAX_MANIFESTS_PER_ROOT = 110 # Warn if root has more manifests
152
+
153
+ # Autogenerated files directory (relative to this file's location)
154
+ PRODUCT_SNAPSHOT_DIR = ".tdk/.tdk-out/product_autogenerated_resource_manifests"
155
+
156
+ PRODUCT_SNAPSHOT_FILES = {
157
+ "services": "services.autogenerated.star",
158
+ "dependencies": "resource_dependencies.autogenerated.star",
159
+ "aliases": "resource_aliases.autogenerated.star",
160
+ "paths": "resource_paths.autogenerated.star",
161
+ "index": "index.autogenerated.star",
162
+ "readme": "README.autogenerated.md",
163
+ }
164
+
165
+ PRODUCT_TOPOLOGY_DIR = ".tdk/.tdk-out/product_autogenerated_services_list"
166
+ PRODUCT_STACKS_INDEX_FILE = "stacks.autogenerated.star"
167
+ PRODUCT_STACK_RESOURCES_FILE = "resources.autogenerated.star"
@@ -0,0 +1,213 @@
1
+ # Copyright (c) 2026 Flisk Landscape contributors
2
+ # SPDX-License-Identifier: MIT
3
+ # Deterministic Tilt Configuration for Flisk Landscape
4
+ # Inspired by Mira Murati's "Defeating Nondeterminism" philosophy
5
+ # Goal: Same filesystem state + same environment = identical Tilt output
6
+
7
+ # =============================================================================
8
+ # DETERMINISTIC MODE SETTINGS
9
+ # =============================================================================
10
+ # Set TILT_DETERMINISTIC=true to enable strict deterministic mode
11
+ # This ensures "same input, same output" guarantees
12
+ # =============================================================================
13
+
14
+ # Read deterministic mode flag
15
+ _DETERMINISTIC_MODE = os.environ.get('TILT_DETERMINISTIC', 'false').lower() == 'true'
16
+
17
+ if _DETERMINISTIC_MODE:
18
+ print("🔒 DETERMINISTIC MODE ENABLED")
19
+ print(" └─ Same filesystem state + same environment = identical output")
20
+ print(" └─ All operations are ordered, reproducible, and invariant")
21
+
22
+ # =============================================================================
23
+ # DETERMINISTIC FILE DISCOVERY
24
+ # =============================================================================
25
+
26
+ def deterministic_find(path, pattern):
27
+ """Deterministic file discovery - always returns sorted results.
28
+
29
+ Args:
30
+ path: Directory to search
31
+ pattern: File pattern to match
32
+
33
+ Returns:
34
+ Sorted list of files (alphabetical, cross-platform consistent)
35
+ """
36
+ # Always use | sort to ensure alphabetical ordering
37
+ # This makes output invariant to filesystem ordering (ext4 vs APFS vs NTFS)
38
+ cmd = "find {} -type f -name '{}' 2>/dev/null | sort".format(path, pattern)
39
+ result = str(local(cmd, quiet=True, echo_off=True)).strip()
40
+ if result:
41
+ return result.split('\n')
42
+ return []
43
+
44
+ def deterministic_resource_discovery(scan_roots):
45
+ """Deterministically discover resources across all scan roots.
46
+
47
+ Args:
48
+ scan_roots: List of directories to scan for service.json files
49
+
50
+ Returns:
51
+ Sorted list of resource paths (guaranteed order across runs)
52
+ """
53
+ all_resources = []
54
+
55
+ # Process scan roots in fixed order (not parallel)
56
+ for root in sorted(scan_roots):
57
+ resources = deterministic_find(root, 'service.json')
58
+ all_resources.extend(resources)
59
+
60
+ # Final sort to ensure absolute ordering
61
+ return sorted(all_resources)
62
+
63
+ # =============================================================================
64
+ # DETERMINISTIC LOCAL EXECUTION
65
+ # =============================================================================
66
+
67
+ def deterministic_local(cmd, **kwargs):
68
+ """Execute local command in deterministic mode.
69
+
70
+ In deterministic mode:
71
+ - Commands run sequentially (not parallel)
72
+ - Output is normalized (timestamps, PIDs, temp paths)
73
+ - Cache is used when available
74
+
75
+ Args:
76
+ cmd: Command to execute
77
+ **kwargs: Additional arguments for local()
78
+
79
+ Returns:
80
+ Command output (normalized in deterministic mode)
81
+ """
82
+ # Force quiet mode and no echo for determinism
83
+ kwargs['quiet'] = True
84
+ kwargs['echo_off'] = True
85
+
86
+ if _DETERMINISTIC_MODE:
87
+ # In deterministic mode, we could add:
88
+ # - Output normalization
89
+ # - Result caching
90
+ # - Strict ordering
91
+ pass
92
+
93
+ return local(cmd, **kwargs)
94
+
95
+ # =============================================================================
96
+ # DETERMINISTIC RESOURCE ORDERING
97
+ # =============================================================================
98
+
99
+ def sort_resources_by_name(resources):
100
+ """Sort resources alphabetically for deterministic ordering.
101
+
102
+ Args:
103
+ resources: List of resource dictionaries or names
104
+
105
+ Returns:
106
+ Sorted list (by name)
107
+ """
108
+ if resources and isinstance(resources[0], dict):
109
+ return sorted(resources, key=lambda x: x.get('name', ''))
110
+ return sorted(resources)
111
+
112
+ # =============================================================================
113
+ # DETERMINISTIC ENVIRONMENT
114
+ # =============================================================================
115
+
116
+ def get_deterministic_env():
117
+ """Get environment variables that affect determinism.
118
+
119
+ Returns:
120
+ Dict of environment variables that must be constant for reproducibility
121
+ """
122
+ env_keys = [
123
+ 'TILT_DETERMINISTIC',
124
+ 'TILT_TRIGGER_MODE',
125
+ 'MOCK_TIKKIE',
126
+ 'INFISICAL_ENABLED',
127
+ 'VERBOSE',
128
+ 'AUTO_DISCOVER',
129
+ 'TILT_MAX_PARALLEL_UPDATES',
130
+ ]
131
+ return {k: os.environ.get(k, '') for k in env_keys}
132
+
133
+ def validate_deterministic_env():
134
+ """Validate that environment is suitable for deterministic runs.
135
+
136
+ Returns:
137
+ True if environment is deterministic, False otherwise
138
+ """
139
+ if not _DETERMINISTIC_MODE:
140
+ return True
141
+
142
+ # Check for sources of nondeterminism
143
+ warnings = []
144
+
145
+ # Parallel updates can cause ordering differences
146
+ parallel = os.environ.get('TILT_MAX_PARALLEL_UPDATES', '')
147
+ if parallel and int(parallel) > 1:
148
+ warnings.append("TILT_MAX_PARALLEL_UPDATES > 1 may cause ordering differences")
149
+
150
+ # Auto trigger mode can cause timing-dependent behavior
151
+ if os.environ.get('TILT_TRIGGER_MODE', 'manual') != 'manual':
152
+ warnings.append("TILT_TRIGGER_MODE=auto may cause timing-dependent behavior")
153
+
154
+ if warnings:
155
+ print("⚠️ Deterministic mode warnings:")
156
+ for w in warnings:
157
+ print(" - {}".format(w))
158
+
159
+ return len(warnings) == 0
160
+
161
+ # =============================================================================
162
+ # DETERMINISTIC MANIFEST GENERATION
163
+ # =============================================================================
164
+
165
+ def deterministic_yaml_generation(resource_paths):
166
+ """Generate YAML manifests deterministically from JSON manifests.
167
+
168
+ Args:
169
+ resource_paths: List of service.json paths
170
+
171
+ Returns:
172
+ List of generated/verified YAML paths
173
+ """
174
+ yaml_paths = []
175
+
176
+ # Process in sorted order for determinism
177
+ for resource_json in sorted(resource_paths):
178
+ resource_dir = os.path.dirname(resource_json)
179
+ resource_yaml = os.path.join(resource_dir, 'service.yaml')
180
+
181
+ # Check if regeneration needed
182
+ needs_regen = False
183
+ if not os.path.exists(resource_yaml):
184
+ needs_regen = True
185
+ else:
186
+ # Compare modification times
187
+ json_stat = os.stat(resource_json)
188
+ yaml_stat = os.path.exists(resource_yaml) and os.stat(resource_yaml)
189
+ if yaml_stat and json_stat.st_mtime > yaml_stat.st_mtime:
190
+ needs_regen = True
191
+
192
+ yaml_paths.append(resource_yaml)
193
+
194
+ return sorted(yaml_paths)
195
+
196
+ # =============================================================================
197
+ # EXPORTS
198
+ # =============================================================================
199
+
200
+ DETERMINISTIC_EXPORTS = {
201
+ 'deterministic_find': deterministic_find,
202
+ 'deterministic_resource_discovery': deterministic_resource_discovery,
203
+ 'deterministic_local': deterministic_local,
204
+ 'sort_resources_by_name': sort_resources_by_name,
205
+ 'get_deterministic_env': get_deterministic_env,
206
+ 'validate_deterministic_env': validate_deterministic_env,
207
+ 'deterministic_yaml_generation': deterministic_yaml_generation,
208
+ 'DETERMINISTIC_MODE': _DETERMINISTIC_MODE,
209
+ }
210
+
211
+ print("📋 Deterministic Tilt utilities loaded")
212
+ if _DETERMINISTIC_MODE:
213
+ print(" └─ All operations will be ordered and reproducible")