@flisk-sh/flisk 0.0.0-stage → 1.3.189

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-QWYXYAX6.js +510 -0
  170. package/cli/dist-bundle/cli.js +2017 -0
  171. package/cli/dist-bundle/cold-preflight-MM46GFQA.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,63 @@
1
+ export class Cache {
2
+ data;
3
+ options;
4
+ constructor(options) {
5
+ this.data = new Map();
6
+ this.options = options;
7
+ }
8
+ has(key) {
9
+ const entry = this.data.get(key);
10
+ if (!entry)
11
+ return false;
12
+ const isExpired = Date.now() - entry.timestamp > this.options.ttlMs;
13
+ if (isExpired) {
14
+ this.data.delete(key);
15
+ return false;
16
+ }
17
+ return true;
18
+ }
19
+ get(key) {
20
+ if (!this.has(key)) {
21
+ return undefined;
22
+ }
23
+ return this.data.get(key)?.value;
24
+ }
25
+ set(key, value) {
26
+ this.data.set(key, {
27
+ value,
28
+ timestamp: Date.now(),
29
+ });
30
+ }
31
+ delete(key) {
32
+ this.data.delete(key);
33
+ }
34
+ clear() {
35
+ this.data.clear();
36
+ }
37
+ keys() {
38
+ const validKeys = [];
39
+ for (const key of this.data.keys()) {
40
+ if (this.has(key)) {
41
+ validKeys.push(key);
42
+ }
43
+ }
44
+ return validKeys;
45
+ }
46
+ size() {
47
+ return this.keys().length;
48
+ }
49
+ }
50
+ export function createCacheValidator(ttlMs) {
51
+ let lastUpdated = 0;
52
+ return {
53
+ isValid() {
54
+ return Date.now() - lastUpdated < ttlMs;
55
+ },
56
+ markUpdated() {
57
+ lastUpdated = Date.now();
58
+ },
59
+ reset() {
60
+ lastUpdated = 0;
61
+ },
62
+ };
63
+ }
@@ -0,0 +1,257 @@
1
+ // Copyright (c) 2026 Flisk Landscape contributors
2
+ // SPDX-License-Identifier: MIT
3
+ import { execFileSync } from "node:child_process";
4
+ import { readFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ import { checkDockerCompose, checkDockerRuntime, checkDockerVersions, checkTilt, DOCTOR_FIXES, } from "../commands/doctor.js";
7
+ import { BUN_FLOOR_LABEL, bunMeetsFloor } from "./bun-floor.js";
8
+ import { projectNeedsBun } from "./bun-requirement.js";
9
+ import { PROJECT_JSON } from "./constants.js";
10
+ import { checkNatsBroker } from "./doctor-wiring.js";
11
+ import { getHostPortPlan } from "./host-port-config.js";
12
+ import { findProjectRoot } from "./paths.js";
13
+ import { discoverResourcesFromRoot } from "./services.js";
14
+ import { findOnPath } from "./which.js";
15
+ /** Checks that only the local runtime (starting a stack) needs. */
16
+ export const RUNTIME_CHECK_IDS = ["docker", "compose", "tilt"];
17
+ /** Checks that writing project configuration needs. */
18
+ export const SCAFFOLD_CHECK_IDS = ["node", "bun", "ports"];
19
+ /** Every check that blocks a cold start, in report order. */
20
+ export const MACHINE_CHECK_IDS = [
21
+ "node",
22
+ ...RUNTIME_CHECK_IDS,
23
+ "bun",
24
+ "ports",
25
+ ];
26
+ /** Converts a doctor check result into the preflight's compact display item. */
27
+ function item(id, result) {
28
+ return {
29
+ id,
30
+ ok: result.didPass || Boolean(result.isSkipped),
31
+ message: result.message,
32
+ fix: result.fix,
33
+ };
34
+ }
35
+ /** Returns whether a Node version is below the CLI's 22.12 minimum. */
36
+ export function nodeTooOld(version) {
37
+ const [major = 0, minor = 0] = String(version)
38
+ .split(".")
39
+ .map((part) => Number.parseInt(part, 10));
40
+ return (!Number.isFinite(major) || !Number.isFinite(minor) || major < 22 || (major === 22 && minor < 12));
41
+ }
42
+ async function safeCheck(id, check, fallback) {
43
+ try {
44
+ return item(id, await check());
45
+ }
46
+ catch {
47
+ return { id, ok: false, message: fallback };
48
+ }
49
+ }
50
+ /** Requires a Docker engine and Compose version check to complete successfully. */
51
+ export function requireVerifiedDockerVersions(result) {
52
+ if (!result.isSkipped)
53
+ return result;
54
+ return {
55
+ ...result,
56
+ didPass: false,
57
+ isSkipped: false,
58
+ message: `Could not verify Docker Engine/Compose minimum versions: ${result.message}`,
59
+ fix: result.fix ?? "Start Docker and ensure Docker Engine 25+ and Compose 2.20.2+ are installed.",
60
+ };
61
+ }
62
+ function usesPrisma(projectRoot) {
63
+ try {
64
+ return discoverResourcesFromRoot(projectRoot).some((resource) => {
65
+ return resource.config?.featuresEnabled?.includes("prisma") ?? false;
66
+ });
67
+ }
68
+ catch {
69
+ return false;
70
+ }
71
+ }
72
+ export async function runColdPreflight(opts = {}) {
73
+ const cwd = opts.cwd ?? process.cwd();
74
+ const scope = opts.scope ?? "runtime";
75
+ const projectRoot = findProjectRoot(cwd);
76
+ const inProject = Boolean(projectRoot);
77
+ const items = [];
78
+ const nodeVersion = process.versions.node;
79
+ items.push({
80
+ id: "node",
81
+ ok: !nodeTooOld(nodeVersion),
82
+ message: nodeVersion,
83
+ fix: nodeTooOld(nodeVersion)
84
+ ? `Install Node.js 22.12+ (current: ${nodeVersion}). https://nodejs.org`
85
+ : undefined,
86
+ });
87
+ // The runtime executables are only probed when the command actually starts a
88
+ // stack. Scaffolding a project must not depend on a running Docker daemon.
89
+ if (scope === "runtime") {
90
+ items.push(await safeCheck("docker", checkDockerRuntime, "Docker daemon is not running"));
91
+ items.push(await safeCheck("compose", async () => {
92
+ const [compose, versions] = await Promise.all([
93
+ checkDockerCompose(),
94
+ checkDockerVersions(),
95
+ ]);
96
+ if (!compose.didPass)
97
+ return compose;
98
+ return requireVerifiedDockerVersions(versions);
99
+ }, "Docker Engine or Compose version check failed"));
100
+ items.push(await safeCheck("tilt", checkTilt, "Tilt CLI not found"));
101
+ }
102
+ // Outside a project Bun stays required: `flisk project` is about to create services that need it.
103
+ const bunNeeded = projectRoot ? projectNeedsBun(discoverResourcesFromRoot(projectRoot)) : true;
104
+ let bun = false;
105
+ const bunPath = bunNeeded ? findOnPath("bun") : undefined;
106
+ if (bunPath) {
107
+ try {
108
+ const version = execFileSync(bunPath, ["--version"], {
109
+ encoding: "utf-8",
110
+ timeout: 3000,
111
+ }).trim();
112
+ bun = bunMeetsFloor(version);
113
+ }
114
+ catch {
115
+ /* reported as a failed runtime check */
116
+ }
117
+ }
118
+ items.push(bunNeeded
119
+ ? {
120
+ id: "bun",
121
+ ok: bun,
122
+ message: bun
123
+ ? `Bun ${BUN_FLOOR_LABEL} is available on PATH`
124
+ : `Bun ${BUN_FLOOR_LABEL} not found on PATH`,
125
+ fix: bun ? undefined : "curl -fsSL https://bun.sh/install | bash",
126
+ }
127
+ : { id: "bun", ok: true, message: "Bun not needed: no generated JS services" });
128
+ try {
129
+ // Scaffolding must not talk to Docker at all, so the port plan is planned
130
+ // from the host ports alone.
131
+ const plan = await getHostPortPlan(projectRoot ?? cwd, scope === "scaffold" ? { inspectDocker: false } : {});
132
+ items.push({
133
+ id: "ports",
134
+ ok: true,
135
+ message: `HTTP ${plan.ingressHttp}, HTTPS ${plan.ingressHttps}, Postgres ${plan.postgres}`,
136
+ });
137
+ }
138
+ catch (error) {
139
+ items.push({
140
+ id: "ports",
141
+ ok: false,
142
+ message: error instanceof Error ? error.message : String(error),
143
+ fix: "Set TDK_HTTP_PORT, TDK_HTTPS_PORT, or TDK_POSTGRES_PORT to available host ports.",
144
+ });
145
+ }
146
+ // Project wiring (NATS, Prisma database) describes a running stack, so it is
147
+ // only probed for the runtime scope.
148
+ if (projectRoot && scope === "runtime") {
149
+ const nats = await safeCheck("nats", () => checkNatsBroker(projectRoot), "NATS broker check failed");
150
+ if (!nats.ok)
151
+ items.push(nats);
152
+ if (usesPrisma(projectRoot)) {
153
+ let dbUp = false;
154
+ try {
155
+ const config = JSON.parse(readFileSync(join(projectRoot, ".tdk", PROJECT_JSON), "utf-8"));
156
+ const projectName = String(config?.project?.name ?? "").replace(/-/g, "_");
157
+ if (projectName) {
158
+ const running = execFileSync(findOnPath("docker") ?? "docker", [
159
+ "ps",
160
+ "--filter",
161
+ `label=com.docker.compose.project=${projectName}`,
162
+ "--filter",
163
+ "label=com.docker.compose.service=postgres",
164
+ "--filter",
165
+ "health=healthy",
166
+ "--format",
167
+ "{{.Names}}",
168
+ ], { encoding: "utf-8", timeout: 3000 }).trim();
169
+ dbUp = running.length > 0;
170
+ }
171
+ }
172
+ catch {
173
+ /* Docker unavailable is already represented by the machine checks. */
174
+ }
175
+ if (!dbUp)
176
+ items.push({
177
+ id: "prisma",
178
+ ok: false,
179
+ message: "A Prisma resource is configured, but the project Postgres service is not healthy",
180
+ fix: "Run `flisk up` to start the bundled Postgres, then check `flisk doctor`.",
181
+ });
182
+ }
183
+ }
184
+ const failures = items.filter((check) => !check.ok).slice(0, 8);
185
+ const blockingIds = scope === "scaffold" ? SCAFFOLD_CHECK_IDS : MACHINE_CHECK_IDS;
186
+ const machineFailed = failures.some((check) => blockingIds.includes(check.id));
187
+ const bunFailed = failures.some((check) => check.id === "bun");
188
+ const header = failures.length
189
+ ? machineFailed
190
+ ? scope === "scaffold"
191
+ ? bunFailed
192
+ ? `Project setup blocked. Bun ${BUN_FLOOR_LABEL} must be installed on PATH.\nFix the machine checks below.`
193
+ : "Project setup blocked. Fix the machine checks below."
194
+ : bunFailed
195
+ ? `Cold start blocked. Bun ${BUN_FLOOR_LABEL} must be installed on PATH.\nPrisma/NATS configuration is project-specific and generated after \`flisk project\`. Fix the machine checks below.`
196
+ : "Cold start blocked. Bun/Prisma/NATS are not the first failure.\nThey are generated after `flisk project`. Fix the machine checks below."
197
+ : "Machine is ready. Project wiring is not."
198
+ : "";
199
+ const footer = failures.length
200
+ ? ""
201
+ : inProject
202
+ ? "Environment ready for Flisk"
203
+ : "This machine is ready for Flisk.\nNext: flisk project --yes";
204
+ return { ok: failures.length === 0, inProject, items: failures, header, footer };
205
+ }
206
+ /** Formats only failed preflight checks and the applicable readiness message. */
207
+ export function formatColdPreflight(result, options = {}) {
208
+ const lines = [result.header];
209
+ for (const check of result.items) {
210
+ lines.push(`FAIL ${check.id.padEnd(7)} ${check.message}`);
211
+ if (check.fix)
212
+ lines.push(` ${check.fix}`);
213
+ }
214
+ if (result.footer && (options.includeSuccessFooter ?? true))
215
+ lines.push(result.footer);
216
+ return lines.filter(Boolean).join("\n");
217
+ }
218
+ /** Exits before machine-dependent command work when any machine check fails. */
219
+ export async function assertMachineReadyOrExit(opts = {}) {
220
+ const scope = opts.scope ?? "runtime";
221
+ const result = await runColdPreflight({ scope });
222
+ const blockingIds = scope === "scaffold" ? SCAFFOLD_CHECK_IDS : MACHINE_CHECK_IDS;
223
+ const machineFailure = result.items.some((check) => blockingIds.includes(check.id));
224
+ if (machineFailure) {
225
+ console.error(formatColdPreflight(result));
226
+ process.exit(1);
227
+ }
228
+ }
229
+ /**
230
+ * Reports which runtime executables are installed.
231
+ *
232
+ * It only looks at `PATH`: no Docker daemon is contacted, so a machine without
233
+ * Docker still gets a usable answer.
234
+ */
235
+ export function detectRuntimePrerequisites(find = findOnPath) {
236
+ return {
237
+ hasDockerCli: Boolean(find("docker")),
238
+ hasTiltCli: Boolean(find("tilt")),
239
+ };
240
+ }
241
+ /**
242
+ * Builds the next-step lines shown after project setup.
243
+ *
244
+ * Docker and Tilt are only needed to start the stack, so a missing runtime is
245
+ * reported as a hint instead of a failure.
246
+ */
247
+ export function formatRuntimeNextSteps(status) {
248
+ const lines = [];
249
+ if (!status.hasDockerCli) {
250
+ lines.push(`Docker is not installed. ${DOCTOR_FIXES.dockerMissing}`);
251
+ }
252
+ if (!status.hasTiltCli) {
253
+ lines.push(`Tilt is not installed. ${DOCTOR_FIXES.tiltMissing}`);
254
+ }
255
+ lines.push("Docker and Tilt are only needed to start the stack: start them, then run `flisk doctor` (readiness) and `flisk up`.");
256
+ return lines;
257
+ }
@@ -0,0 +1,57 @@
1
+ import { showErrorAndExit } from "./errors.js";
2
+ import { showCancelled } from "./formatting.js";
3
+ import { promptConfirm } from "./prompt.js";
4
+ export const YES_OPTION_FLAGS = "-y, --yes";
5
+ export const YES_OPTION_DESCRIPTION = "Skip prompts and confirmations; use defaults";
6
+ /**
7
+ * Registers the standard `-y, --yes` flag on a Commander command with shared help text.
8
+ */
9
+ export function addYesOption(command, description = YES_OPTION_DESCRIPTION) {
10
+ return command.option(YES_OPTION_FLAGS, description, false);
11
+ }
12
+ export async function confirmAction(message, defaultValue = true) {
13
+ const confirm = await promptConfirm({ message, initial: defaultValue });
14
+ if (!confirm) {
15
+ showCancelled();
16
+ }
17
+ return confirm;
18
+ }
19
+ export function assertValid(validation, exitCode = 1) {
20
+ if (!validation.valid) {
21
+ showErrorAndExit(validation.error ?? "Validation failed", exitCode);
22
+ }
23
+ }
24
+ /**
25
+ * Early return for `--dry-run`. Prints the standard `Dry run - ...` / `Would run: ...` pair, or, when the command
26
+ * has a plan of its own to show (a list of files, say), calls `printPlan` instead. Returns true when it handled the run.
27
+ */
28
+ export function handleDryRun(options, description, command, printPlan) {
29
+ if (options.dryRun) {
30
+ if (printPlan) {
31
+ printPlan();
32
+ }
33
+ else {
34
+ console.log(`Dry run - ${description}`);
35
+ console.log(`Would run: ${command}`);
36
+ }
37
+ return true;
38
+ }
39
+ return false;
40
+ }
41
+ /**
42
+ * Prompt for confirmation with cancellation handling.
43
+ * Displays a confirmation prompt and exits/cancels if user declines.
44
+ * @param message - The confirmation message to display
45
+ * @param onCancel - Optional callback when user cancels (defaults to returning false)
46
+ * @returns Promise<boolean> - true if confirmed, false if cancelled (with callback)
47
+ */
48
+ export async function confirmOrCancel(message, onCancel) {
49
+ const confirmed = await confirmAction(message, true);
50
+ if (!confirmed) {
51
+ if (onCancel) {
52
+ onCancel();
53
+ }
54
+ return false;
55
+ }
56
+ return true;
57
+ }
@@ -0,0 +1,160 @@
1
+ // Name of the doctor check that verifies a container runtime is reachable.
2
+ // It is looked up by name in doctor-report.ts, so both sides must use this
3
+ // constant instead of a bare string literal.
4
+ export const CONTAINER_RUNTIME_CHECK = "Container Runtime";
5
+ // Resource type id for services the user brings themselves. Referenced by
6
+ // value in several modules, so a typo in one copy would compile and silently
7
+ // stop matching. `types/index.ts` keeps its own literal: it is the leaf module
8
+ // that defines ResourceType, so importing this file back would be circular.
9
+ // Typed as the literal (not the wider ResourceType union): computed keys built
10
+ // from it stay narrow enough to satisfy Record<ResourceType, ...>.
11
+ export const BRING_YOUR_OWN_TYPE = "bring-your-own";
12
+ // Compile-time check that the literal above really is a ResourceType member.
13
+ const _bringYourOwnIsResourceType = BRING_YOUR_OWN_TYPE;
14
+ // Stack feature id for the shared platform database.
15
+ export const DATABASE_MANAGEMENT_FEATURE = "database-management";
16
+ // Root .tiltignore written by the generator and checked by doctor drift.
17
+ export const TILTIGNORE_FILE = ".tiltignore";
18
+ // Manifest file name for a resource, used by discovery and the resource command.
19
+ export const SERVICE_JSON = "service.json";
20
+ // Compose file name for service resources and platform features.
21
+ export const DOCKER_COMPOSE_FILE = "docker-compose.yml";
22
+ // Directory where generated manifests, configs, and Dockerfiles live within each resource.
23
+ export const AUTOGENERATED_DIR = ".autogenerated";
24
+ export const TECH_STACK_FILE = "TILT_TECH_STACK.star";
25
+ export const RESOURCE_DEFAULTS_FILE = "TILT_RESOURCE_DEFAULTS.star";
26
+ // Flisk project manifest file name. The canonical project config lives at
27
+ // `<project-root>/.tdk/project.json` — discovery, doctor, generator, config
28
+ // edits, and stack-features all read/write it. Referenced by value across
29
+ // these modules, so a typo in one copy would compile and silently stop
30
+ // matching (or worse, read a different file). Keep the literal here and
31
+ // import it everywhere it's needed.
32
+ export const PROJECT_JSON = "project.json";
33
+ // Manifest file name for Node / JavaScript packages and root workspace.
34
+ export const PACKAGE_JSON = "package.json";
35
+ export const MASTER_CONFIG_FILES = [
36
+ TECH_STACK_FILE,
37
+ RESOURCE_DEFAULTS_FILE,
38
+ "spec.master",
39
+ ];
40
+ export const VALID_RESOURCE_TYPES = [
41
+ "backend",
42
+ "frontend",
43
+ "library",
44
+ "sdk",
45
+ "worker",
46
+ "migrator",
47
+ "mcp",
48
+ "agent",
49
+ BRING_YOUR_OWN_TYPE,
50
+ ];
51
+ // Frontend/library/sdk services are served statically or consumed as
52
+ // packages, so they never need a "start" script - only backend/worker/
53
+ // migrator processes are run in production via `<runtime> run start`.
54
+ // bring-your-own doesn't generate application code, so no scripts required.
55
+ export const REQUIRED_PACKAGE_SCRIPTS = {
56
+ backend: ["dev", "build", "start"],
57
+ worker: ["dev", "build", "start"],
58
+ migrator: ["dev", "build", "start"],
59
+ mcp: ["dev", "build", "start"],
60
+ agent: ["dev", "build", "start"],
61
+ frontend: ["dev", "build"],
62
+ library: ["dev", "build"],
63
+ sdk: ["dev", "build"],
64
+ [BRING_YOUR_OWN_TYPE]: [],
65
+ };
66
+ // Version specifiers that pin nothing at all - a fresh `bun install`/`npm install`
67
+ // can pull a different (possibly breaking) version on every run.
68
+ export const UNPINNED_DEPENDENCY_VERSIONS = new Set(["latest", "*"]);
69
+ export const OPTIONAL_INFRA_SERVICES = [
70
+ "monitoring",
71
+ "elk",
72
+ "debezium",
73
+ "golden_image",
74
+ "verdaccio",
75
+ ];
76
+ export const PORT_RANGES = {
77
+ frontend: { base: 3000, min: 3000, max: 3999, range: "3000-3999" },
78
+ backend: { base: 4000, min: 4000, max: 4999, range: "4000-4999" },
79
+ // An MCP server is an HTTP service, so it shares the backend-compatible range with bring-your-own.
80
+ mcp: { base: 4000, min: 4000, max: 5999, range: "4000-5999" },
81
+ // An agent serves /health and /ready over HTTP (see agent-runtimes/custom.ts), so it shares the same range.
82
+ agent: { base: 4000, min: 4000, max: 5999, range: "4000-5999" },
83
+ [BRING_YOUR_OWN_TYPE]: { base: 4000, min: 4000, max: 5999, range: "4000-5999" },
84
+ worker: { base: 6000, min: 6000, max: 6999, range: "6000-6999" },
85
+ health: { base: 5000, min: 5000, max: 5999, range: "5000-5999" },
86
+ migrator: { base: 7000, min: 7000, max: 7999, range: "7000-7999" },
87
+ };
88
+ export const STANDARD_PORTS = {
89
+ tiltUi: 10350,
90
+ traefik: 8080,
91
+ };
92
+ export const QUICKSTART_DOCS_URL = "https://tdk-landscape.github.io/tdk-website/docs/quickstart/";
93
+ export const BASE_DOMAIN_DEFAULT = "tdk-project.localhost";
94
+ export const APP_SUBDOMAIN_PREFIX = "app";
95
+ export const API_SUBDOMAIN_PREFIX = "api";
96
+ export function getBaseDomain() {
97
+ const override = process.env.TDK_SERVICE_BASE_URL ?? process.env.TDK_PUBLIC_HOST;
98
+ if (override) {
99
+ try {
100
+ const u = new URL(override.includes("://") ? override : `http://${override}`);
101
+ return u.hostname;
102
+ }
103
+ catch {
104
+ return override.replace(/^https?:\/\//, "").split("/")[0];
105
+ }
106
+ }
107
+ return BASE_DOMAIN_DEFAULT;
108
+ }
109
+ export function frontendBaseUrl(protocol = "http") {
110
+ return `${protocol}://${APP_SUBDOMAIN_PREFIX}.${getBaseDomain()}`;
111
+ }
112
+ export function apiBaseUrl(protocol = "http") {
113
+ return `${protocol}://${API_SUBDOMAIN_PREFIX}.${getBaseDomain()}`;
114
+ }
115
+ export const SKIP_DIRECTORIES = [
116
+ "node_modules",
117
+ ".git",
118
+ ".tilt",
119
+ ".tilt-engine",
120
+ "dist",
121
+ "build",
122
+ ".prisma",
123
+ ".turbo",
124
+ "coverage",
125
+ "tmp",
126
+ "temp",
127
+ "__tests__",
128
+ "test",
129
+ "tests",
130
+ ".github",
131
+ ".vscode",
132
+ "docs",
133
+ ];
134
+ export const AUTOGENERATED_FILE_PATTERNS = [
135
+ "Dockerfile",
136
+ DOCKER_COMPOSE_FILE,
137
+ "docker-compose.yaml",
138
+ "Tiltfile",
139
+ "vite.config.ts",
140
+ "tsconfig.json",
141
+ "tsconfig.build.json",
142
+ ];
143
+ // Stack emojis - generic, no hardcoded service names
144
+ // Users can add their own stack emojis via project config
145
+ const STACK_EMOJIS = {
146
+ infra: "🏗️",
147
+ core: "🔧",
148
+ api: "⚡",
149
+ app: "🎨",
150
+ orchestrator: "⚙️",
151
+ };
152
+ export function getStackEmoji(stackName) {
153
+ const lowerName = stackName.toLowerCase();
154
+ for (const [key, emoji] of Object.entries(STACK_EMOJIS)) {
155
+ if (lowerName.includes(key)) {
156
+ return emoji;
157
+ }
158
+ }
159
+ return "📦";
160
+ }
@@ -0,0 +1,71 @@
1
+ import { findProjectRoot } from "./paths.js";
2
+ import { discoverResources, discoverResourcesWithProblems, discoverStacks, getAllStacks, warnAboutSkippedFiles, } from "./services.js";
3
+ const cachedContexts = new Map();
4
+ /**
5
+ * Invalidate cached discovery contexts.
6
+ *
7
+ * Lifetime and invalidation contract:
8
+ * Discovery contexts are cached per `projectRoot` for the duration of a command invocation
9
+ * or process to eliminate repeated recursive filesystem traversals.
10
+ *
11
+ * Mutation contract:
12
+ * Any command that creates, mutates, or removes service manifests (`service.json`) or project
13
+ * templates (e.g. `flisk resource`, `flisk project example`, `flisk config migrate`) MUST call
14
+ * `clearDiscoveryCache()` so that subsequent discovery operations within the same process
15
+ * observe the updated filesystem state.
16
+ *
17
+ * @param projectRoot Optional project root to invalidate. If omitted, all cached contexts are cleared.
18
+ */
19
+ export function clearDiscoveryCache(projectRoot) {
20
+ if (projectRoot !== undefined) {
21
+ cachedContexts.delete(projectRoot);
22
+ }
23
+ else {
24
+ cachedContexts.clear();
25
+ }
26
+ }
27
+ /**
28
+ * Create or retrieve the cached discovery context for the current project root.
29
+ *
30
+ * Caches discovery results (resources, problems, stacks, etc.) per project root to prevent
31
+ * redundant disk scans during multi-phase command lifecycles (e.g. `flisk up`).
32
+ *
33
+ * Different project roots maintain separate cache entries and never cross project boundaries.
34
+ *
35
+ * @param forceRefresh When true, bypasses any cached entry and forces a fresh filesystem scan.
36
+ */
37
+ export function createDiscoveryContext(forceRefresh = false) {
38
+ const projectRoot = findProjectRoot();
39
+ const cacheKey = projectRoot ?? "";
40
+ if (!forceRefresh) {
41
+ const cached = cachedContexts.get(cacheKey);
42
+ if (cached) {
43
+ return cached;
44
+ }
45
+ }
46
+ const { resources, problems } = projectRoot
47
+ ? discoverResourcesWithProblems(projectRoot)
48
+ : { resources: discoverResources(), problems: [] };
49
+ const stacks = discoverStacks(resources);
50
+ const stackNames = getAllStacks(resources);
51
+ warnAboutSkippedFiles(problems);
52
+ const unassignedResources = resources.filter((r) => !r.stack);
53
+ const resourcesByStack = new Map();
54
+ for (const resource of resources) {
55
+ if (resource.stack) {
56
+ const stackResources = resourcesByStack.get(resource.stack) || [];
57
+ stackResources.push(resource);
58
+ resourcesByStack.set(resource.stack, stackResources);
59
+ }
60
+ }
61
+ const context = {
62
+ resources,
63
+ problems,
64
+ stacks,
65
+ stackNames,
66
+ unassignedResources,
67
+ resourcesByStack,
68
+ };
69
+ cachedContexts.set(cacheKey, context);
70
+ return context;
71
+ }