@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,89 @@
1
+ ---
2
+ title: Tilt Library Build Caching
3
+ status: backlog
4
+ created: 2026-03-31
5
+ updated: 2026-03-31
6
+ ---
7
+
8
+ # Tilt Library Build Caching
9
+
10
+ ## Overview
11
+
12
+ These scripts implement intelligent caching for library builds to avoid unnecessary rebuilds and republishes during `tilt up`.
13
+
14
+ ## How It Works
15
+
16
+ ### Check Script (`check-lib-publish.sh`)
17
+
18
+ 1. **Registry Check**: Queries Verdaccio to see if the package version is already published
19
+ 2. **Source Hash Check**: Computes a SHA-256 hash of all source files (src/, package.json, tsconfig.json)
20
+ 3. **Comparison**: Compares current hash with cached hash from last successful build
21
+ 4. **Decision**:
22
+ - If package published AND sources unchanged → **Skip rebuild** (exit 1)
23
+ - If package not published OR sources changed → **Rebuild needed** (exit 0)
24
+
25
+ ### Build Script (`build-and-publish-lib.sh`)
26
+
27
+ 1. Calls `check-lib-publish.sh` to determine if rebuild needed
28
+ 2. If skip indicated, exits early
29
+ 3. If rebuild needed:
30
+ - Runs full build pipeline (install, tsc, link, publish)
31
+ - Saves source hash to `.tilt-cache/source-hash.txt` on success
32
+ - Links package to consumer services if specified
33
+
34
+ ## Cache Location
35
+
36
+ Each library maintains its own cache:
37
+ ```
38
+ shared-platform-engineering/platform-logger/
39
+ ├── .tilt-cache/
40
+ │ └── source-hash.txt # SHA-256 hash of source files
41
+ ├── src/
42
+ ├── package.json
43
+ └── tsconfig.json
44
+ ```
45
+
46
+ ## Benefits
47
+
48
+ - **Faster `tilt up`**: Libraries only rebuild when sources actually change
49
+ - **Idempotent**: Running `tilt up` multiple times doesn't cause unnecessary work
50
+ - **Version Safety**: Warns if sources changed but version not bumped
51
+ - **Verdaccio-aware**: Checks actual registry state, not just local build state
52
+
53
+ ## Manual Cache Clearing
54
+
55
+ To force a rebuild of a specific library:
56
+ ```bash
57
+ rm -rf shared-platform-engineering/platform-logger/.tilt-cache
58
+ ```
59
+
60
+ To clear all library caches:
61
+ ```bash
62
+ find . -type d -name '.tilt-cache' -path '*/shared-*' -exec rm -rf {} +
63
+ ```
64
+
65
+ ## Troubleshooting
66
+
67
+ ### Library not rebuilding when it should
68
+
69
+ 1. Check if version was bumped in package.json
70
+ 2. Verify source files are actually changing
71
+ 3. Clear cache and rebuild: `rm -rf <lib-path>/.tilt-cache && tilt up`
72
+
73
+ ### "Version already published" warning
74
+
75
+ This means source files changed but package.json version wasn't bumped. Either:
76
+ - Bump the version if this is a real change
77
+ - Revert source changes if they were experimental
78
+ - Manually unpublish from Verdaccio if needed
79
+
80
+ ## Implementation Details
81
+
82
+ **Cache Key**: SHA-256 hash of concatenated contents of:
83
+ - All files in `src/` directory
84
+ - `package.json`
85
+ - `tsconfig.json`
86
+
87
+ **Registry Check**: HTTP GET to `<verdaccio-url>/<package-name>/<version>`
88
+ - 200 = published
89
+ - 404 = not published
@@ -0,0 +1,207 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2026 Flisk Landscape contributors
3
+ # SPDX-License-Identifier: MIT
4
+ # =============================================================================
5
+ # Library Build & Publish with Caching
6
+ # =============================================================================
7
+ # Intelligently builds and publishes libraries only when needed
8
+ # =============================================================================
9
+
10
+ set -euo pipefail
11
+
12
+ LIB_PATH="${1:?Library path required}"
13
+ REGISTRY="${2:-http://localhost:4873}"
14
+ PACKAGE_NAME="${3:?Package name required}"
15
+ CONSUMER_PATHS="${4:-}" # Optional: comma-separated list of consumer paths
16
+
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+ WORKSPACE_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
19
+
20
+ if [[ "${LIB_PATH}" = /* ]]; then
21
+ LIB_ABS_PATH="${LIB_PATH}"
22
+ else
23
+ LIB_ABS_PATH="${WORKSPACE_ROOT}/${LIB_PATH}"
24
+ fi
25
+
26
+ CACHE_DIR="${LIB_ABS_PATH}/.tilt-cache"
27
+
28
+ # Check if rebuild/republish is needed
29
+ if ! "${SCRIPT_DIR}/check-lib-publish.sh" "${LIB_ABS_PATH}" "${REGISTRY}"; then
30
+ # Script exited with 1 (skip rebuild)
31
+ exit 0
32
+ fi
33
+
34
+ # Rebuild needed - run full pipeline
35
+ cd "${LIB_ABS_PATH}"
36
+
37
+ EFFECTIVE_REGISTRY="${REGISTRY%/}"
38
+ if ! curl -sf --max-time 3 "${EFFECTIVE_REGISTRY}/-/ping" >/dev/null 2>&1; then
39
+ for fallback_registry in "http://localhost:4873" "http://verdaccio.localhost:4873"; do
40
+ if curl -sf --max-time 3 "${fallback_registry}/-/ping" >/dev/null 2>&1; then
41
+ echo "⚠️ Registry ${EFFECTIVE_REGISTRY} is unreachable, falling back to ${fallback_registry}"
42
+ EFFECTIVE_REGISTRY="${fallback_registry}"
43
+ break
44
+ fi
45
+ done
46
+ fi
47
+
48
+ echo "📦 Installing dependencies..."
49
+ NPMRC_FOR_INSTALL=""
50
+ if [[ "${EFFECTIVE_REGISTRY}" == *"host.docker.internal"* ]]; then
51
+ if [[ -f "${LIB_ABS_PATH}/autogenerated/.npmrc.docker.autogenerated" ]]; then
52
+ NPMRC_FOR_INSTALL="${LIB_ABS_PATH}/autogenerated/.npmrc.docker.autogenerated"
53
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc.docker" ]]; then
54
+ NPMRC_FOR_INSTALL="${LIB_ABS_PATH}/.npmrc.docker"
55
+ fi
56
+ fi
57
+
58
+ if [[ -z "${NPMRC_FOR_INSTALL}" ]]; then
59
+ if [[ -f "${LIB_ABS_PATH}/autogenerated/.npmrc.autogenerated" ]]; then
60
+ NPMRC_FOR_INSTALL="${LIB_ABS_PATH}/autogenerated/.npmrc.autogenerated"
61
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc" ]]; then
62
+ NPMRC_FOR_INSTALL="${LIB_ABS_PATH}/.npmrc"
63
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc.docker" ]]; then
64
+ NPMRC_FOR_INSTALL="${LIB_ABS_PATH}/.npmrc.docker"
65
+ fi
66
+ fi
67
+
68
+ run_bun_install_with_retry() {
69
+ local npmrc_path="${1:-}"
70
+ local registry="${2:-}"
71
+ local attempt=1
72
+ local max_attempts=3
73
+ local exit_code=1
74
+ local install_env=()
75
+
76
+ if [[ -n "${registry}" ]]; then
77
+ install_env+=("npm_config_registry=${registry}")
78
+ if [[ "${PACKAGE_NAME}" == @*/* ]]; then
79
+ local package_scope="${PACKAGE_NAME%%/*}"
80
+ install_env+=("npm_config_${package_scope}:registry=${registry}")
81
+ fi
82
+ fi
83
+
84
+ while [[ ${attempt} -le ${max_attempts} ]]; do
85
+ set +e
86
+ if [[ -n "${npmrc_path}" ]]; then
87
+ env "${install_env[@]}" NPM_CONFIG_USERCONFIG="${npmrc_path}" bun install
88
+ exit_code=$?
89
+ else
90
+ env "${install_env[@]}" bun install
91
+ exit_code=$?
92
+ fi
93
+ set -e
94
+
95
+ if [[ ${exit_code} -eq 0 ]]; then
96
+ return 0
97
+ fi
98
+
99
+ if [[ ${attempt} -lt ${max_attempts} ]]; then
100
+ echo "⚠️ bun install failed (attempt ${attempt}/${max_attempts}), retrying..."
101
+ sleep $((attempt * 2))
102
+ fi
103
+
104
+ attempt=$((attempt + 1))
105
+ done
106
+
107
+ return ${exit_code}
108
+ }
109
+
110
+ set +e
111
+ run_bun_install_with_retry "${NPMRC_FOR_INSTALL}" "${EFFECTIVE_REGISTRY}"
112
+ INSTALL_EXIT_CODE=$?
113
+ set -e
114
+
115
+ if [[ ${INSTALL_EXIT_CODE} -ne 0 ]]; then
116
+ RETRY_REGISTRY=""
117
+ RETRY_NPMRC=""
118
+ for fallback_registry in "http://localhost:4873" "http://verdaccio.localhost:4873" "https://registry.npmjs.org"; do
119
+ if [[ "${fallback_registry}" != "${EFFECTIVE_REGISTRY}" ]] && curl -sf --max-time 3 "${fallback_registry}/-/ping" >/dev/null 2>&1; then
120
+ RETRY_REGISTRY="${fallback_registry}"
121
+ break
122
+ fi
123
+ done
124
+
125
+ if [[ -n "${RETRY_REGISTRY}" ]]; then
126
+ if [[ "${RETRY_REGISTRY}" == *"host.docker.internal"* ]]; then
127
+ if [[ -f "${LIB_ABS_PATH}/autogenerated/.npmrc.docker.autogenerated" ]]; then
128
+ RETRY_NPMRC="${LIB_ABS_PATH}/autogenerated/.npmrc.docker.autogenerated"
129
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc.docker" ]]; then
130
+ RETRY_NPMRC="${LIB_ABS_PATH}/.npmrc.docker"
131
+ fi
132
+ fi
133
+ if [[ -z "${RETRY_NPMRC}" ]]; then
134
+ if [[ -f "${LIB_ABS_PATH}/autogenerated/.npmrc.autogenerated" ]]; then
135
+ RETRY_NPMRC="${LIB_ABS_PATH}/autogenerated/.npmrc.autogenerated"
136
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc" ]]; then
137
+ RETRY_NPMRC="${LIB_ABS_PATH}/.npmrc"
138
+ elif [[ -f "${LIB_ABS_PATH}/.npmrc.docker" ]]; then
139
+ RETRY_NPMRC="${LIB_ABS_PATH}/.npmrc.docker"
140
+ fi
141
+ fi
142
+
143
+ echo "⚠️ bun install failed, retrying with fallback registry ${RETRY_REGISTRY}"
144
+ run_bun_install_with_retry "${RETRY_NPMRC}" "${RETRY_REGISTRY}"
145
+ EFFECTIVE_REGISTRY="${RETRY_REGISTRY}"
146
+ else
147
+ exit ${INSTALL_EXIT_CODE}
148
+ fi
149
+ fi
150
+
151
+ echo "🔨 Building package..."
152
+ if grep -q '"build":' package.json; then
153
+ bun run build
154
+ else
155
+ if [ -f ".autogenerated/tsconfig.autogenerated.json" ]; then
156
+ bunx tsc -p .autogenerated/tsconfig.autogenerated.json --declaration --declarationMap --rootDir src --outDir dist
157
+ else
158
+ bunx tsc -p tsconfig.json --declaration --declarationMap --rootDir src --outDir dist
159
+ fi
160
+ fi
161
+
162
+ echo "🔗 Linking package..."
163
+ bun link
164
+
165
+ echo "📤 Publishing to registry..."
166
+ # npm may prefer scoped registry config over --registry, so force both default
167
+ # and scope-specific registry to avoid publishing to a different host.
168
+ NPM_CONFIG_OVERRIDES=("npm_config_registry=${EFFECTIVE_REGISTRY}")
169
+ if [[ "${PACKAGE_NAME}" == @*/* ]]; then
170
+ PACKAGE_SCOPE="${PACKAGE_NAME%%/*}"
171
+ NPM_CONFIG_OVERRIDES+=("npm_config_${PACKAGE_SCOPE}:registry=${EFFECTIVE_REGISTRY}")
172
+ fi
173
+
174
+ # Try to unpublish first (ignore errors)
175
+ env "${NPM_CONFIG_OVERRIDES[@]}" npm unpublish --force --registry "${EFFECTIVE_REGISTRY}" >/dev/null 2>&1 || true
176
+ env "${NPM_CONFIG_OVERRIDES[@]}" npm publish --registry "${EFFECTIVE_REGISTRY}" --fetch-retries=1 --fetch-timeout=10000 --fetch-retry-mintimeout=1000 --fetch-retry-maxtimeout=5000
177
+
178
+ # Save source hash to mark successful build
179
+ mkdir -p "${CACHE_DIR}"
180
+ PACKAGE_JSON="${LIB_ABS_PATH}/package.json"
181
+ TSCONFIG_PATH="${LIB_ABS_PATH}/.autogenerated/tsconfig.autogenerated.json"
182
+ if [ -f "${TSCONFIG_PATH}" ]; then
183
+ find "${LIB_ABS_PATH}/src" "${PACKAGE_JSON}" "${TSCONFIG_PATH}" -type f 2>/dev/null | \
184
+ sort | \
185
+ xargs cat 2>/dev/null | \
186
+ shasum -a 256 | \
187
+ awk '{print $1}' > "${CACHE_DIR}/source-hash.txt"
188
+ else
189
+ find "${LIB_ABS_PATH}/src" "${PACKAGE_JSON}" "${LIB_ABS_PATH}/tsconfig.json" -type f 2>/dev/null | \
190
+ sort | \
191
+ xargs cat 2>/dev/null | \
192
+ shasum -a 256 | \
193
+ awk '{print $1}' > "${CACHE_DIR}/source-hash.txt"
194
+ fi
195
+
196
+ # Link to consumers if specified
197
+ if [[ -n "${CONSUMER_PATHS}" ]]; then
198
+ IFS=',' read -ra CONSUMERS <<< "${CONSUMER_PATHS}"
199
+ for consumer in "${CONSUMERS[@]}"; do
200
+ if [[ -n "${consumer}" ]]; then
201
+ echo "🔗 Linking to consumer: ${consumer}"
202
+ (cd "${WORKSPACE_ROOT}/${consumer}" && bun link "${PACKAGE_NAME}") || true
203
+ fi
204
+ done
205
+ fi
206
+
207
+ echo "✅ ${PACKAGE_NAME} build and publish complete"
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2026 Flisk Landscape contributors
3
+ # SPDX-License-Identifier: MIT
4
+ # =============================================================================
5
+ # Library Build/Publish Cache Checker
6
+ # =============================================================================
7
+ # Checks if a library needs to be rebuilt and republished to Verdaccio.
8
+ # The SOURCE HASH is the primary gate — if sources haven't changed since the
9
+ # last successful build+publish, skip entirely (regardless of registry state).
10
+ # Returns: 0 if rebuild needed, 1 if can skip
11
+ # =============================================================================
12
+
13
+ set -euo pipefail
14
+
15
+ LIB_PATH="${1:?Library path required}"
16
+ REGISTRY="${2:-http://localhost:4873}"
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+ WORKSPACE_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
19
+
20
+ if [[ "${LIB_PATH}" = /* ]]; then
21
+ LIB_ABS_PATH="${LIB_PATH}"
22
+ else
23
+ LIB_ABS_PATH="${WORKSPACE_ROOT}/${LIB_PATH}"
24
+ fi
25
+
26
+ CACHE_DIR="${LIB_ABS_PATH}/.tilt-cache"
27
+
28
+ # Colors for output
29
+ GREEN='\033[0;32m'
30
+ YELLOW='\033[1;33m'
31
+ NC='\033[0m' # No Color
32
+
33
+ # Ensure cache directory exists
34
+ mkdir -p "${CACHE_DIR}"
35
+
36
+ # Read package.json to get name and version
37
+ PACKAGE_JSON="${LIB_ABS_PATH}/package.json"
38
+ if [[ ! -f "${PACKAGE_JSON}" ]]; then
39
+ echo -e "${YELLOW}⚠️ package.json not found at ${PACKAGE_JSON}${NC}"
40
+ exit 0 # Needs rebuild
41
+ fi
42
+
43
+ PACKAGE_NAME=$(grep -o '"name"[[:space:]]*:[[:space:]]*"[^"]*"' "${PACKAGE_JSON}" | sed 's/"name"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/')
44
+ PACKAGE_VERSION=$(grep -o '"version"[[:space:]]*:[[:space:]]*"[^"]*"' "${PACKAGE_JSON}" | sed 's/"version"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/')
45
+
46
+ # ---------------------------------------------------------------------------
47
+ # PRIMARY CHECK: Source hash comparison (works offline, no registry needed)
48
+ # ---------------------------------------------------------------------------
49
+ SOURCE_HASH_FILE="${CACHE_DIR}/source-hash.txt"
50
+
51
+ # Calculate hash of source files (src/, package.json, tsconfig.json)
52
+ TSCONFIG_PATH="${LIB_ABS_PATH}/.autogenerated/tsconfig.autogenerated.json"
53
+ if [ -f "${TSCONFIG_PATH}" ]; then
54
+ CURRENT_HASH=$(find "${LIB_ABS_PATH}/src" "${PACKAGE_JSON}" "${TSCONFIG_PATH}" -type f 2>/dev/null | \
55
+ sort | \
56
+ xargs cat 2>/dev/null | \
57
+ shasum -a 256 | \
58
+ awk '{print $1}')
59
+ else
60
+ CURRENT_HASH=$(find "${LIB_ABS_PATH}/src" "${PACKAGE_JSON}" "${LIB_ABS_PATH}/tsconfig.json" -type f 2>/dev/null | \
61
+ sort | \
62
+ xargs cat 2>/dev/null | \
63
+ shasum -a 256 | \
64
+ awk '{print $1}')
65
+ fi
66
+
67
+ if [[ -f "${SOURCE_HASH_FILE}" ]]; then
68
+ CACHED_HASH=$(cat "${SOURCE_HASH_FILE}")
69
+
70
+ if [[ "${CURRENT_HASH}" == "${CACHED_HASH}" ]]; then
71
+ # Source unchanged since last successful build+publish — skip
72
+ echo -e "${GREEN}✓ ${PACKAGE_NAME}@${PACKAGE_VERSION} sources unchanged (hash match) - skipping build${NC}"
73
+ exit 1 # Skip rebuild
74
+ fi
75
+ fi
76
+
77
+ # ---------------------------------------------------------------------------
78
+ # Hash mismatch or no cached hash — rebuild needed
79
+ # ---------------------------------------------------------------------------
80
+ if [[ -f "${SOURCE_HASH_FILE}" ]]; then
81
+ echo -e "${YELLOW}⚠️ ${PACKAGE_NAME}@${PACKAGE_VERSION} sources changed — rebuilding${NC}"
82
+ else
83
+ echo -e "${YELLOW}⚠️ ${PACKAGE_NAME}@${PACKAGE_VERSION} no cached hash found — initial build${NC}"
84
+ fi
85
+
86
+ echo "🔨 Building ${PACKAGE_NAME}@${PACKAGE_VERSION}..."
87
+ exit 0 # Needs rebuild
@@ -0,0 +1,265 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2026 Flisk contributors
3
+ # SPDX-License-Identifier: MIT
4
+ # ====================================================================
5
+ # Container Debug Helper Script
6
+ # Provides easy access to debugging running or failed Docker containers
7
+ # ====================================================================
8
+
9
+ set -euo pipefail
10
+
11
+ # Colors for output
12
+ RED='\033[0;31m'
13
+ GREEN='\033[0;32m'
14
+ YELLOW='\033[1;33m'
15
+ BLUE='\033[0;34m'
16
+ NC='\033[0m' # No Color
17
+
18
+ # Container name filter: project name from .tdk/project.json (override with TDK_PROJECT_NAME)
19
+ PROJECT_FILTER="${TDK_PROJECT_NAME:-$(sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' .tdk/project.json 2>/dev/null | head -1)}"
20
+ PROJECT_FILTER="${PROJECT_FILTER:-tdk-project}"
21
+ PROJECT_FILTER="${PROJECT_FILTER//-/[-_]}"
22
+
23
+ # Help text
24
+ show_help() {
25
+ cat << EOF
26
+ ${GREEN}Container Debug Helper${NC}
27
+
28
+ ${BLUE}Usage:${NC}
29
+ $0 [OPTIONS] [RESOURCE_NAME]
30
+
31
+ ${BLUE}Options:${NC}
32
+ -l, --list List all running containers with their status
33
+ -s, --shell SERVICE Start an interactive shell in SERVICE
34
+ -f, --failed Show failed build containers
35
+ -c, --command CMD Run a specific command in the container
36
+ -v, --verbose Show verbose output
37
+ -h, --help Show this help message
38
+
39
+ ${BLUE}Examples:${NC}
40
+ # List all running containers
41
+ $0 --list
42
+
43
+ # Open shell in identity service
44
+ $0 --shell identity-db-migrator
45
+
46
+ # Run a diagnostic command
47
+ $0 -s identity-db-migrator -c "bun install --verbose"
48
+
49
+ # Check network connectivity
50
+ $0 -s identity-db-migrator -c "nc -zv registry.npmjs.org 443"
51
+
52
+ # View package.json
53
+ $0 -s identity-db-migrator -c "cat package.json"
54
+
55
+ ${BLUE}Common Debug Commands:${NC}
56
+ # Network diagnostics
57
+ nc -zv registry.npmjs.org 443
58
+ nslookup registry.npmjs.org
59
+ curl -I https://registry.npmjs.org
60
+
61
+ # Bun diagnostics
62
+ bun --version
63
+ bun install --verbose --dry-run
64
+ cat .npmrc
65
+ cat bunfig.toml
66
+
67
+ # File system
68
+ ls -la node_modules
69
+ du -sh node_modules
70
+ df -h
71
+
72
+ EOF
73
+ }
74
+
75
+ # List containers
76
+ list_containers() {
77
+ echo -e "${GREEN}=== Running Containers ===${NC}"
78
+ docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" | grep -iE "$PROJECT_FILTER"
79
+
80
+ echo ""
81
+ echo -e "${YELLOW}=== Recently Exited Containers ===${NC}"
82
+ docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" | grep -iE "$PROJECT_FILTER" | grep -i "exited"
83
+ }
84
+
85
+ # Get container ID from service name
86
+ get_container_id() {
87
+ local resource_name="$1"
88
+ local container_id=$(docker ps -aq --filter "name=${resource_name}" | head -n1)
89
+
90
+ if [ -z "$container_id" ]; then
91
+ echo -e "${RED}Error: No container found for service '${resource_name}'${NC}" >&2
92
+ echo -e "${YELLOW}Tip: Run '$0 --list' to see available containers${NC}" >&2
93
+ return 1
94
+ fi
95
+
96
+ echo "$container_id"
97
+ }
98
+
99
+ # Start interactive shell
100
+ start_shell() {
101
+ local resource_name="$1"
102
+ local container_id=$(get_container_id "$resource_name") || return 1
103
+
104
+ echo -e "${GREEN}Starting interactive shell in ${resource_name}...${NC}"
105
+ echo -e "${BLUE}Container ID: ${container_id}${NC}"
106
+ echo ""
107
+
108
+ # Try sh first (alpine), then bash
109
+ if docker exec -it "$container_id" sh -c "command -v bash" >/dev/null 2>&1; then
110
+ docker exec -it "$container_id" bash
111
+ else
112
+ docker exec -it "$container_id" sh
113
+ fi
114
+ }
115
+
116
+ # Run specific command
117
+ run_command() {
118
+ local resource_name="$1"
119
+ local command="$2"
120
+ local container_id=$(get_container_id "$resource_name") || return 1
121
+
122
+ echo -e "${GREEN}Running command in ${resource_name}:${NC} ${command}"
123
+ echo -e "${BLUE}Container ID: ${container_id}${NC}"
124
+ echo ""
125
+
126
+ docker exec -it "$container_id" sh -c "$command"
127
+ }
128
+
129
+ # Show failed containers
130
+ show_failed() {
131
+ echo -e "${RED}=== Failed/Exited Containers ===${NC}"
132
+ docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" | grep -iE "$PROJECT_FILTER" | grep -iE "(exited|error)"
133
+
134
+ echo ""
135
+ echo -e "${YELLOW}To inspect logs of a failed container:${NC}"
136
+ echo " docker logs <container_name>"
137
+ echo ""
138
+ echo -e "${YELLOW}To restart a failed container:${NC}"
139
+ echo " docker start -ai <container_name>"
140
+ }
141
+
142
+ # Quick diagnostics menu
143
+ diagnostics_menu() {
144
+ local resource_name="$1"
145
+
146
+ echo -e "${GREEN}=== Quick Diagnostics Menu ===${NC}"
147
+ echo "1) Check network connectivity"
148
+ echo "2) View package.json and config files"
149
+ echo "3) Test bun installation (dry-run)"
150
+ echo "4) Check disk space and cache"
151
+ echo "5) View environment variables"
152
+ echo "6) Interactive shell"
153
+ echo "q) Quit"
154
+ echo ""
155
+ read -p "Select option: " choice
156
+
157
+ case $choice in
158
+ 1)
159
+ echo -e "${BLUE}Testing network connectivity...${NC}"
160
+ run_command "$resource_name" "nc -zv registry.npmjs.org 443 && nc -zv Flisk-verdaccio 4873"
161
+ ;;
162
+ 2)
163
+ echo -e "${BLUE}Viewing configuration files...${NC}"
164
+ run_command "$resource_name" "echo '=== package.json ===' && cat package.json && echo '' && echo '=== .npmrc ===' && cat .npmrc && echo '' && echo '=== bunfig.toml ===' && cat bunfig.toml"
165
+ ;;
166
+ 3)
167
+ echo -e "${BLUE}Testing bun installation (dry-run)...${NC}"
168
+ run_command "$resource_name" "bun install --verbose --dry-run"
169
+ ;;
170
+ 4)
171
+ echo -e "${BLUE}Checking disk space and cache...${NC}"
172
+ run_command "$resource_name" "df -h && echo '' && echo '=== Cache ===' && ls -lh /cache/bun && echo '' && echo '=== node_modules ===' && ls -lh node_modules | head -20"
173
+ ;;
174
+ 5)
175
+ echo -e "${BLUE}Environment variables:${NC}"
176
+ run_command "$resource_name" "env | sort"
177
+ ;;
178
+ 6)
179
+ start_shell "$resource_name"
180
+ ;;
181
+ q|Q)
182
+ exit 0
183
+ ;;
184
+ *)
185
+ echo -e "${RED}Invalid option${NC}"
186
+ ;;
187
+ esac
188
+ }
189
+
190
+ # Main script logic
191
+ main() {
192
+ local action=""
193
+ local resource_name=""
194
+ local command=""
195
+ local verbose=false
196
+
197
+ # Parse arguments
198
+ while [[ $# -gt 0 ]]; do
199
+ case $1 in
200
+ -l|--list)
201
+ action="list"
202
+ shift
203
+ ;;
204
+ -s|--shell)
205
+ action="shell"
206
+ resource_name="$2"
207
+ shift 2
208
+ ;;
209
+ -f|--failed)
210
+ action="failed"
211
+ shift
212
+ ;;
213
+ -c|--command)
214
+ command="$2"
215
+ shift 2
216
+ ;;
217
+ -v|--verbose)
218
+ verbose=true
219
+ shift
220
+ ;;
221
+ -h|--help)
222
+ show_help
223
+ exit 0
224
+ ;;
225
+ *)
226
+ if [ -z "$resource_name" ]; then
227
+ resource_name="$1"
228
+ action="menu"
229
+ fi
230
+ shift
231
+ ;;
232
+ esac
233
+ done
234
+
235
+ # Execute action
236
+ case $action in
237
+ list)
238
+ list_containers
239
+ ;;
240
+ shell)
241
+ if [ -n "$command" ]; then
242
+ run_command "$resource_name" "$command"
243
+ else
244
+ start_shell "$resource_name"
245
+ fi
246
+ ;;
247
+ failed)
248
+ show_failed
249
+ ;;
250
+ menu)
251
+ diagnostics_menu "$resource_name"
252
+ ;;
253
+ "")
254
+ echo -e "${YELLOW}No action specified. Use --help for usage information.${NC}"
255
+ list_containers
256
+ ;;
257
+ *)
258
+ echo -e "${RED}Unknown action: $action${NC}"
259
+ show_help
260
+ exit 1
261
+ ;;
262
+ esac
263
+ }
264
+
265
+ main "$@"