@flisk-sh/flisk 0.0.0-stage → 1.3.190
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +492 -0
- package/LICENSE +21 -0
- package/README.md +479 -2
- package/Tiltfile +151 -0
- package/cli/bin/flisk.js +42 -0
- package/cli/dist/agent-runtimes/custom.js +335 -0
- package/cli/dist/agent-runtimes/registry.js +34 -0
- package/cli/dist/backend-frameworks/elysia.js +38 -0
- package/cli/dist/backend-frameworks/express.js +49 -0
- package/cli/dist/backend-frameworks/fastify.js +43 -0
- package/cli/dist/backend-frameworks/h3.js +37 -0
- package/cli/dist/backend-frameworks/koa.js +47 -0
- package/cli/dist/backend-frameworks/mcp.js +86 -0
- package/cli/dist/backend-frameworks/nestjs.js +55 -0
- package/cli/dist/backend-frameworks/registry.js +134 -0
- package/cli/dist/backend-frameworks/types.js +1 -0
- package/cli/dist/backend-languages/bun.js +76 -0
- package/cli/dist/backend-languages/go.js +125 -0
- package/cli/dist/backend-languages/node.js +122 -0
- package/cli/dist/backend-languages/python.js +94 -0
- package/cli/dist/backend-languages/registry.js +37 -0
- package/cli/dist/backend-languages/rust.js +82 -0
- package/cli/dist/backend-languages/types.js +1 -0
- package/cli/dist/cli.js +29 -0
- package/cli/dist/commands/__tests__/project-e2e-helpers.js +49 -0
- package/cli/dist/commands/__tests__/ui-loading-screen.test.js +16 -0
- package/cli/dist/commands/agent.js +182 -0
- package/cli/dist/commands/completion-candidates.js +116 -0
- package/cli/dist/commands/completion.js +843 -0
- package/cli/dist/commands/config.js +362 -0
- package/cli/dist/commands/doctor.js +1504 -0
- package/cli/dist/commands/down.js +114 -0
- package/cli/dist/commands/eject.js +108 -0
- package/cli/dist/commands/help.js +152 -0
- package/cli/dist/commands/import.js +164 -0
- package/cli/dist/commands/logs.js +119 -0
- package/cli/dist/commands/maintainers.js +102 -0
- package/cli/dist/commands/mcp.js +28 -0
- package/cli/dist/commands/networks.js +306 -0
- package/cli/dist/commands/project.js +447 -0
- package/cli/dist/commands/projects.js +103 -0
- package/cli/dist/commands/registry.js +53 -0
- package/cli/dist/commands/resource.js +992 -0
- package/cli/dist/commands/resources.js +127 -0
- package/cli/dist/commands/restart.js +89 -0
- package/cli/dist/commands/runtime.js +75 -0
- package/cli/dist/commands/stack.js +171 -0
- package/cli/dist/commands/stacks.js +71 -0
- package/cli/dist/commands/status.js +211 -0
- package/cli/dist/commands/ui.js +725 -0
- package/cli/dist/commands/up.js +609 -0
- package/cli/dist/commands/upgrade.js +840 -0
- package/cli/dist/commands/version.js +10 -0
- package/cli/dist/components/Accessible.js +11 -0
- package/cli/dist/components/BaseTooltip.js +30 -0
- package/cli/dist/components/DetailPanel.js +33 -0
- package/cli/dist/components/FileTree.js +51 -0
- package/cli/dist/components/ResourceSelectInput.js +42 -0
- package/cli/dist/components/ResourceTable.js +35 -0
- package/cli/dist/components/ServiceIssues.js +13 -0
- package/cli/dist/components/TUIHeader.js +27 -0
- package/cli/dist/components/TabBar.js +27 -0
- package/cli/dist/components/Tooltip.js +13 -0
- package/cli/dist/components/index.js +11 -0
- package/cli/dist/components/ui-theme.js +120 -0
- package/cli/dist/config/platform-standards.js +182 -0
- package/cli/dist/frontend-frameworks/lit.js +64 -0
- package/cli/dist/frontend-frameworks/preact.js +62 -0
- package/cli/dist/frontend-frameworks/qwik.js +61 -0
- package/cli/dist/frontend-frameworks/react.js +69 -0
- package/cli/dist/frontend-frameworks/registry.js +83 -0
- package/cli/dist/frontend-frameworks/solid.js +62 -0
- package/cli/dist/frontend-frameworks/svelte.js +67 -0
- package/cli/dist/frontend-frameworks/tanstack-router.js +101 -0
- package/cli/dist/frontend-frameworks/types.js +1 -0
- package/cli/dist/frontend-frameworks/vanilla.js +59 -0
- package/cli/dist/frontend-frameworks/vue.js +72 -0
- package/cli/dist/generator/__tests__/golden-helpers.js +43 -0
- package/cli/dist/generator/extension-fetch.js +291 -0
- package/cli/dist/generator/resource-templates.js +133 -0
- package/cli/dist/generator/template-engine.js +801 -0
- package/cli/dist/index.js +10 -0
- package/cli/dist/mcp/server.js +101 -0
- package/cli/dist/mcp/tools.js +351 -0
- package/cli/dist/program.js +37 -0
- package/cli/dist/types/index.js +38 -0
- package/cli/dist/utils/agent-host.js +36 -0
- package/cli/dist/utils/atomic-write.js +36 -0
- package/cli/dist/utils/bun-floor.js +9 -0
- package/cli/dist/utils/bun-requirement.js +10 -0
- package/cli/dist/utils/cache.js +63 -0
- package/cli/dist/utils/cold-preflight.js +257 -0
- package/cli/dist/utils/command-helpers.js +57 -0
- package/cli/dist/utils/constants.js +160 -0
- package/cli/dist/utils/discovery-context.js +71 -0
- package/cli/dist/utils/discovery-paths.js +93 -0
- package/cli/dist/utils/docker.js +34 -0
- package/cli/dist/utils/doctor-crashloop.js +161 -0
- package/cli/dist/utils/doctor-fix.js +391 -0
- package/cli/dist/utils/doctor-host.js +66 -0
- package/cli/dist/utils/doctor-report.js +78 -0
- package/cli/dist/utils/doctor-runtime.js +880 -0
- package/cli/dist/utils/doctor-starlark.js +132 -0
- package/cli/dist/utils/doctor-wiring.js +698 -0
- package/cli/dist/utils/down-cleanup.js +125 -0
- package/cli/dist/utils/env-validator.js +266 -0
- package/cli/dist/utils/errors.js +175 -0
- package/cli/dist/utils/exec-async.js +31 -0
- package/cli/dist/utils/file-helpers.js +104 -0
- package/cli/dist/utils/formatting.js +165 -0
- package/cli/dist/utils/generated-paths.js +51 -0
- package/cli/dist/utils/help-command.js +11 -0
- package/cli/dist/utils/host-port-config.js +140 -0
- package/cli/dist/utils/host-port-plan.js +100 -0
- package/cli/dist/utils/json-output.js +29 -0
- package/cli/dist/utils/machine-output.js +33 -0
- package/cli/dist/utils/paths.js +43 -0
- package/cli/dist/utils/platform.js +58 -0
- package/cli/dist/utils/port-assignment.js +75 -0
- package/cli/dist/utils/port-conflict-fix.js +25 -0
- package/cli/dist/utils/port-fallback-notice.js +17 -0
- package/cli/dist/utils/port-listener-probe.js +20 -0
- package/cli/dist/utils/project-config-defaults.js +17 -0
- package/cli/dist/utils/project-features.js +91 -0
- package/cli/dist/utils/project-templates.js +32 -0
- package/cli/dist/utils/prompt.js +97 -0
- package/cli/dist/utils/resource-features.js +184 -0
- package/cli/dist/utils/resource-kind.js +9 -0
- package/cli/dist/utils/schema-version-gate.js +45 -0
- package/cli/dist/utils/search-status.js +12 -0
- package/cli/dist/utils/secret-redaction.js +73 -0
- package/cli/dist/utils/service-config-checks.js +189 -0
- package/cli/dist/utils/service-manifest.js +254 -0
- package/cli/dist/utils/service-runtime-state.js +66 -0
- package/cli/dist/utils/service-urls.js +112 -0
- package/cli/dist/utils/services.js +360 -0
- package/cli/dist/utils/shared-infra.js +45 -0
- package/cli/dist/utils/shared-platform-postgres.js +232 -0
- package/cli/dist/utils/single-flight.js +21 -0
- package/cli/dist/utils/smoke.js +401 -0
- package/cli/dist/utils/spinner.js +40 -0
- package/cli/dist/utils/stack-features.js +15 -0
- package/cli/dist/utils/stack-status.js +14 -0
- package/cli/dist/utils/startup-report.js +78 -0
- package/cli/dist/utils/status-message.js +21 -0
- package/cli/dist/utils/status-ports.js +33 -0
- package/cli/dist/utils/suggestions.js +63 -0
- package/cli/dist/utils/tar.js +46 -0
- package/cli/dist/utils/tdk-version.js +51 -0
- package/cli/dist/utils/terminal-layout.js +19 -0
- package/cli/dist/utils/tilt-events.js +194 -0
- package/cli/dist/utils/tilt-logs.js +61 -0
- package/cli/dist/utils/tilt-port-owner.js +63 -0
- package/cli/dist/utils/tilt-process.js +54 -0
- package/cli/dist/utils/tilt-resource-state.js +32 -0
- package/cli/dist/utils/tilt-startup.js +49 -0
- package/cli/dist/utils/tilt-unreachable-message.js +9 -0
- package/cli/dist/utils/tilt.js +104 -0
- package/cli/dist/utils/ui-keymap.js +129 -0
- package/cli/dist/utils/ui-service-state.js +34 -0
- package/cli/dist/utils/up-only.js +28 -0
- package/cli/dist/utils/up-readiness.js +118 -0
- package/cli/dist/utils/url-actions.js +103 -0
- package/cli/dist/utils/validation.js +62 -0
- package/cli/dist/utils/which.js +56 -0
- package/cli/dist/utils/windows-doctor.js +176 -0
- package/cli/dist-bundle/chunk-6EA4DGCY.js +2 -0
- package/cli/dist-bundle/chunk-BZ4H7MM4.js +3 -0
- package/cli/dist-bundle/chunk-CLCUIDBH.js +510 -0
- package/cli/dist-bundle/cli.js +2017 -0
- package/cli/dist-bundle/cold-preflight-SY26O2IG.js +2 -0
- package/cli/dist-bundle/devtools-ZUHXW33W.js +5 -0
- package/cli/dist-bundle/extension-fetch-J4FFH7TJ.js +2 -0
- package/cli/package.json +83 -0
- package/cli/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
- package/cli/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
- package/cli/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
- package/cli/templates/.tiltignore.hbs +72 -0
- package/cli/templates/TILT_RESOURCE_DEFAULTS.star.hbs +220 -0
- package/cli/templates/TILT_TECH_STACK.star.hbs +149 -0
- package/cli/templates/Tiltfile.hbs +381 -0
- package/cli/templates/spec.master.hbs +192 -0
- package/discovery/AGENTS.md +362 -0
- package/discovery/TILT_DISCOVERY.star +429 -0
- package/discovery/Tiltfile +58 -0
- package/discovery/config.star +265 -0
- package/discovery/constants.star +167 -0
- package/discovery/deterministic.star +213 -0
- package/discovery/discovery_daemon.star +193 -0
- package/discovery/discovery_orchestrator.star +492 -0
- package/discovery/filtering.star +7 -0
- package/discovery/identity-management-backend/service.yaml +26 -0
- package/discovery/identity-management-frontend/service.yaml +29 -0
- package/discovery/identity-sdk/service.yaml +9 -0
- package/discovery/incremental_discovery.star +215 -0
- package/discovery/indexing.star +9 -0
- package/discovery/json_manifest_scanner.star +57 -0
- package/discovery/libraries.star +48 -0
- package/discovery/loading.star +25 -0
- package/discovery/manifest/constants.star +106 -0
- package/discovery/manifest/loading.star +418 -0
- package/discovery/manifest/normalize.star +289 -0
- package/discovery/manifest/validation.star +110 -0
- package/discovery/normalization.star +13 -0
- package/discovery/registry.star +562 -0
- package/discovery/resource_snapshot.py +384 -0
- package/discovery/resource_snapshot.star +145 -0
- package/discovery/schemas.star +3 -0
- package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
- package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
- package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
- package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
- package/discovery/test_resource_snapshot.py +253 -0
- package/discovery/validation.star +80 -0
- package/discovery/versioning.star +3 -0
- package/engine/AGENTS.md +706 -0
- package/engine/README.md +31 -0
- package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
- package/engine/Tiltfile +86 -0
- package/engine/assets/docker/golden-layers.Dockerfile +204 -0
- package/engine/assets/docker/wake-gateway/Dockerfile +28 -0
- package/engine/assets/docker/wake-gateway/decide.test.ts +177 -0
- package/engine/assets/docker/wake-gateway/decide.ts +135 -0
- package/engine/assets/docker/wake-gateway/server.ts +363 -0
- package/engine/assets/scripts/cleanup-completed-migrator-images.sh +39 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +122 -0
- package/engine/assets/scripts/mac-m1-resource-monitor.sh +123 -0
- package/engine/config.star +5 -0
- package/engine/entrypoint.star +101 -0
- package/engine/lifecycle/orchestrator.star +263 -0
- package/engine/paths.star +719 -0
- package/engine/schemas/project-schema.json +147 -0
- package/engine/schemas/service-schema.json +537 -0
- package/engine/scripts/README.md +89 -0
- package/engine/scripts/build-and-publish-lib.sh +207 -0
- package/engine/scripts/check-lib-publish.sh +87 -0
- package/engine/scripts/debug-container.sh +265 -0
- package/engine/scripts/generate-manifest.sh +200 -0
- package/engine/spec.master +702 -0
- package/engine/spec.master.example +341 -0
- package/engine/topologies/README.md +33 -0
- package/engine/topologies/platform/docker/AGENTS.md +59 -0
- package/engine/topologies/platform/docker/auth/auth.star +207 -0
- package/engine/topologies/platform/docker/build/frontend_build_plan.star +65 -0
- package/engine/topologies/platform/docker/build/golden_image.star +37 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +144 -0
- package/engine/topologies/platform/docker/build/golden_image_constants.star +100 -0
- package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +263 -0
- package/engine/topologies/platform/docker/compose/compose.star +637 -0
- package/engine/topologies/platform/docker/compose/compose_helpers.star +54 -0
- package/engine/topologies/platform/docker/compose/traefik_standalone.star +171 -0
- package/engine/topologies/platform/docker/config/bunignore.star +144 -0
- package/engine/topologies/platform/docker/config/dockerignore.star +152 -0
- package/engine/topologies/platform/docker/config/healthcheck.star +58 -0
- package/engine/topologies/platform/docker/constants.star +211 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +56 -0
- package/engine/topologies/platform/docker/dockerfile/language_dockerfile.star +264 -0
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +76 -0
- package/engine/topologies/platform/docker/index.star +40 -0
- package/engine/topologies/platform/docker/layers/bun_helpers.star +25 -0
- package/engine/topologies/platform/docker/layers/infisical/index.star +42 -0
- package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +264 -0
- package/engine/topologies/platform/docker/layers/l1_base_layers.star +89 -0
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +147 -0
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +229 -0
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +282 -0
- package/engine/topologies/platform/docker/layers/prisma/constants.star +138 -0
- package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +98 -0
- package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +131 -0
- package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +100 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +128 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +205 -0
- package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +121 -0
- package/engine/topologies/platform/docker/networking/api_path_constants.star +206 -0
- package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +31 -0
- package/engine/topologies/platform/docker/networking/traefik.star +266 -0
- package/engine/topologies/platform/docker/networking/traefik_constants.star +148 -0
- package/engine/topologies/platform/docker/networking/traefik_helpers.star +162 -0
- package/engine/topologies/platform/docker/networking/traefik_static_routes.star +165 -0
- package/engine/topologies/platform/docker/secrets/env_secrets.star +74 -0
- package/engine/topologies/platform/docker/secrets/infisical.star +109 -0
- package/engine/topologies/platform/net/AGENTS.md +64 -0
- package/engine/topologies/platform/net/proxy.star +6 -0
- package/engine/topologies/platform/registries/local.star +6 -0
- package/engine/topologies/platform/registries/verdaccio_loader.star +20 -0
- package/engine/topologies/platform/security/AGENTS.md +49 -0
- package/engine/topologies/platform/security/secrets.star +241 -0
- package/engine/topologies/platform/state/AGENTS.md +64 -0
- package/engine/topologies/platform/state/relational.star +6 -0
- package/engine/topologies/tilt/common/AGENTS.md +59 -0
- package/engine/topologies/tilt/common/utils.star +409 -0
- package/engine/topologies/tilt/common/utils_debug.star +71 -0
- package/engine/topologies/tilt/common/utils_deterministic.star +170 -0
- package/engine/topologies/tilt/common/utils_docker_networks.star +54 -0
- package/engine/topologies/tilt/common/utils_env.star +92 -0
- package/engine/topologies/tilt/common/utils_output.star +99 -0
- package/engine/topologies/tilt/config/AGENTS.md +68 -0
- package/engine/topologies/tilt/config/defaults.star +5 -0
- package/engine/topologies/tilt/config/feature_flags.star +12 -0
- package/engine/topologies/tilt/config/global.star +57 -0
- package/engine/topologies/tilt/config/profiles.star +398 -0
- package/engine/topologies/tilt/generators/agents_md.star +64 -0
- package/engine/topologies/tilt/generators/api_gateway.star +147 -0
- package/engine/topologies/tilt/generators/index.star +126 -0
- package/engine/topologies/tilt/generators/infisical/README.md +424 -0
- package/engine/topologies/tilt/generators/infisical/examples.star +314 -0
- package/engine/topologies/tilt/generators/infisical/index.star +59 -0
- package/engine/topologies/tilt/generators/infisical/machine_identity.star +422 -0
- package/engine/topologies/tilt/generators/infisical/organization.star +536 -0
- package/engine/topologies/tilt/generators/infisical/path_manager.star +478 -0
- package/engine/topologies/tilt/generators/infisical/secrets_generator.star +422 -0
- package/engine/topologies/tilt/generators/nginx_conf.star +145 -0
- package/engine/topologies/tilt/generators/npmrc.star +132 -0
- package/engine/topologies/tilt/generators/tsconfig.star +25 -0
- package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +73 -0
- package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +137 -0
- package/engine/topologies/tilt/generators/typescript/common.star +9 -0
- package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +78 -0
- package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +140 -0
- package/engine/topologies/tilt/generators/typescript/include.star +25 -0
- package/engine/topologies/tilt/generators/typescript/playwright_config.star +42 -0
- package/engine/topologies/tilt/generators/typescript/prisma_config.star +51 -0
- package/engine/topologies/tilt/generators/validators.star +868 -0
- package/engine/topologies/tilt/generators/vite/backend.star +80 -0
- package/engine/topologies/tilt/generators/vite/frameworks/lit.star +92 -0
- package/engine/topologies/tilt/generators/vite/frameworks/preact.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/qwik.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/react.star +128 -0
- package/engine/topologies/tilt/generators/vite/frameworks/solid.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/svelte.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/vanilla.star +92 -0
- package/engine/topologies/tilt/generators/vite/frameworks/vue.star +94 -0
- package/engine/topologies/tilt/generators/vite/frontend.star +153 -0
- package/engine/topologies/tilt/generators/vite/generators.star +45 -0
- package/engine/topologies/tilt/generators/vite/helpers.star +256 -0
- package/engine/topologies/tilt/generators/vite/library.star +67 -0
- package/engine/topologies/tilt/generators/vite/sdk.star +75 -0
- package/engine/topologies/tilt/generators/vite/templates.star +460 -0
- package/engine/topologies/tilt/generators/vite_config.star +24 -0
- package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
- package/engine/topologies/tilt/manifest/README.md +679 -0
- package/engine/topologies/tilt/manifest/__init__.star +220 -0
- package/engine/topologies/tilt/manifest/constants.star +262 -0
- package/engine/topologies/tilt/manifest/errors.star +268 -0
- package/engine/topologies/tilt/manifest/integration.star +348 -0
- package/engine/topologies/tilt/manifest/json_to_yaml.py +61 -0
- package/engine/topologies/tilt/manifest/loader.star +239 -0
- package/engine/topologies/tilt/manifest/mapper.star +229 -0
- package/engine/topologies/tilt/manifest/parser.star +490 -0
- package/engine/topologies/tilt/manifest/schema.star +502 -0
- package/engine/topologies/tilt/manifest/tests/test_integration.star +278 -0
- package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +475 -0
- package/engine/topologies/tilt/manifest/tests/test_manifest.star +319 -0
- package/engine/topologies/tilt/manifest/tests/test_validator.star +472 -0
- package/engine/topologies/tilt/manifest/validator.star +744 -0
- package/engine/topologies/tilt/manifest/yaml_to_json.py +20 -0
- package/engine/topologies/tilt/resources/AGENTS.md +71 -0
- package/engine/topologies/tilt/resources/build_concurrency.star +56 -0
- package/engine/topologies/tilt/resources/conditions.star +5 -0
- package/engine/topologies/tilt/resources/databases.star +246 -0
- package/engine/topologies/tilt/resources/declaration.star +5 -0
- package/engine/topologies/tilt/resources/deps.star +5 -0
- package/engine/topologies/tilt/resources/infra-loader.star +504 -0
- package/engine/topologies/tilt/resources/libs.star +32 -0
- package/engine/topologies/tilt/resources/libs_discovery.star +104 -0
- package/engine/topologies/tilt/resources/libs_paths.star +81 -0
- package/engine/topologies/tilt/resources/libs_resource_definition.star +153 -0
- package/engine/topologies/tilt/resources/libs_setup.star +166 -0
- package/engine/topologies/tilt/resources/libs_tsconfig.star +39 -0
- package/engine/topologies/tilt/resources/orchestrator/apply.star +79 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +864 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +90 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +150 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +38 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +46 -0
- package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +193 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +23 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +136 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/env.star +219 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +172 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +577 -0
- package/engine/topologies/tilt/resources/orchestrator/helpers.star +35 -0
- package/engine/topologies/tilt/resources/orchestrator.star +56 -0
- package/engine/topologies/tilt/resources/ordering.star +5 -0
- package/engine/topologies/tilt/resources/shared-platform-postgres.star +30 -0
- package/engine/topologies/tilt/resources/triggers.star +5 -0
- package/engine/topologies/tilt/resources/watchers.star +304 -0
- package/engine/where-things-live.star +719 -0
- package/examples/tdk-example/LICENSE +21 -0
- package/examples/tdk-example/README.md +23 -0
- package/examples/tdk-example/TILT_SERVICE_DEFAULTS.star +42 -0
- package/examples/tdk-example/TILT_TECH_STACK.star +67 -0
- package/examples/tdk-example/Tiltfile +25 -0
- package/examples/tdk-example/services/platform/messaging/docker-compose.yml +26 -0
- package/examples/tdk-example/services/shop/orders-api/package.json +20 -0
- package/examples/tdk-example/services/shop/orders-api/service.json +14 -0
- package/examples/tdk-example/services/shop/orders-api/src/index.ts +81 -0
- package/examples/tdk-example/services/shop/orders-app/index.html +12 -0
- package/examples/tdk-example/services/shop/orders-app/package.json +23 -0
- package/examples/tdk-example/services/shop/orders-app/public/.gitkeep +0 -0
- package/examples/tdk-example/services/shop/orders-app/service.json +9 -0
- package/examples/tdk-example/services/shop/orders-app/src/main.tsx +9 -0
- package/examples/tdk-example/services/shop/orders-app/src/orders.tsx +67 -0
- package/examples/tdk-example/services/shop/orders-app/src/style.css +15 -0
- package/examples/tdk-example/services/shop/orders-worker/package.json +18 -0
- package/examples/tdk-example/services/shop/orders-worker/service.json +13 -0
- package/examples/tdk-example/services/shop/orders-worker/src/index.ts +33 -0
- package/ext/Tiltfile +66 -0
- package/ext/ide-components/README.md +221 -0
- package/ext/ide-components/code_viewer/server.py +208 -0
- package/ext/ide-components/config_inspector/server.py +1052 -0
- package/ext/ide-components/file_browser/server.py +287 -0
- package/ext/ide-components/shared/config_service.py +471 -0
- package/ext/ide-components/shared/file_utils.py +300 -0
- package/ext/ide-components/shared/http_utils.py +234 -0
- package/ext/ide-components/shared/static/styles.css +1334 -0
- package/ext/ide-components/shared/syntax_highlighter.py +142 -0
- package/ext/ide-components/shared/template_engine.py +125 -0
- package/ext/ide-components/shared/templates/base.html +121 -0
- package/ext/ide-components/shared/test_config_service.py +328 -0
- package/ext/ide-components/shared/tilt_integration.py +160 -0
- package/ext/ui-enhancements/cron-status-server.sh +51 -0
- package/ext/ui-enhancements/cron-status-tracker.sh +148 -0
- package/ext/ui-enhancements/extension.yaml +36 -0
- package/ext/ui-enhancements/tiltfile.py +101 -0
- package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
- package/ext/ui-enhancements/ui/help-panel.css +279 -0
- package/ext/ui-enhancements/ui/icons.css +125 -0
- package/ext/ui-enhancements/ui/tooltips.css +114 -0
- package/package.json +94 -4
- package/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
- package/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
- package/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
- package/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
- package/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
- package/specs/specs/TILT_SERVICE_DEFAULTS.star +207 -0
- package/specs/specs/TILT_TECH_STACK.star +161 -0
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
#!/usr/bin/env starlark
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Copyright (c) 2026 Flisk contributors
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# 🔍 DISCOVERY REGISTRY - Service Discovery for Flisk CLI
|
|
7
|
+
# =============================================================================
|
|
8
|
+
# This module discovers services from service.json manifest files.
|
|
9
|
+
# It runs discovery at module load time to avoid frozen hash issues.
|
|
10
|
+
#
|
|
11
|
+
# IMPORTANT: Discovery runs when the module loads (if TDK_PROJECT_ROOT is set).
|
|
12
|
+
# This ensures APP_RESOURCES and related variables are populated before export.
|
|
13
|
+
# =============================================================================
|
|
14
|
+
|
|
15
|
+
load(
|
|
16
|
+
"./config.star",
|
|
17
|
+
"GLOBAL_CONFIG",
|
|
18
|
+
"INFRA_RESOURCES",
|
|
19
|
+
"CORE_INFRA",
|
|
20
|
+
"INFRA_STACK_MAP",
|
|
21
|
+
"OPTIONAL_INFRA",
|
|
22
|
+
"Config",
|
|
23
|
+
"DDD_LIBS",
|
|
24
|
+
)
|
|
25
|
+
load("./discovery_orchestrator.star", "initialize_discovery")
|
|
26
|
+
load("../engine/topologies/tilt/manifest/loader.star", "ManifestLoader")
|
|
27
|
+
load("./libraries.star", "autodiscover_libraries", "get_platform_libs", "get_product_libs")
|
|
28
|
+
load(
|
|
29
|
+
"./constants.star",
|
|
30
|
+
"PRODUCT_SNAPSHOT_DIR",
|
|
31
|
+
"PRODUCT_SNAPSHOT_FILES",
|
|
32
|
+
"PRODUCT_TOPOLOGY_DIR",
|
|
33
|
+
"PRODUCT_STACKS_INDEX_FILE",
|
|
34
|
+
"PRODUCT_STACK_RESOURCES_FILE",
|
|
35
|
+
"DISCOVERY_SCAN_ROOTS",
|
|
36
|
+
)
|
|
37
|
+
load("./manifest/constants.star", "MANIFEST_FILENAME", "MANIFEST_FILENAME_YAML")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# =============================================================================
|
|
41
|
+
# 🔧 RUN DISCOVERY AT MODULE LOAD TIME
|
|
42
|
+
# =============================================================================
|
|
43
|
+
# This runs discovery immediately when the module loads (before freeze).
|
|
44
|
+
# The results are stored in module-level variables that get exported.
|
|
45
|
+
# Use a list as a mutable container to track if header was printed
|
|
46
|
+
_DISCOVERY_STATE = [False]
|
|
47
|
+
|
|
48
|
+
# =============================================================================
|
|
49
|
+
|
|
50
|
+
def _run_discovery():
|
|
51
|
+
"""Run two-pass discovery and return results."""
|
|
52
|
+
# Only print header on first discovery
|
|
53
|
+
if not _DISCOVERY_STATE[0]:
|
|
54
|
+
print("")
|
|
55
|
+
print("Phase 1: Discovering services...")
|
|
56
|
+
_DISCOVERY_STATE[0] = True
|
|
57
|
+
|
|
58
|
+
# Create a working cache for both passes
|
|
59
|
+
working_cache = {
|
|
60
|
+
"initialized": False,
|
|
61
|
+
"app_resources": [],
|
|
62
|
+
"resource_dependencies": {},
|
|
63
|
+
"resource_aliases": {},
|
|
64
|
+
"resource_path_map": {},
|
|
65
|
+
"stack_configs": {},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# First pass - load JSON and generate YAML
|
|
69
|
+
initialize_discovery(working_cache, second_pass=False)
|
|
70
|
+
|
|
71
|
+
# Second pass - reload from JSON
|
|
72
|
+
working_cache["initialized"] = False
|
|
73
|
+
initialize_discovery(working_cache, second_pass=True)
|
|
74
|
+
|
|
75
|
+
print("")
|
|
76
|
+
return working_cache
|
|
77
|
+
|
|
78
|
+
# Run discovery immediately if TDK_PROJECT_ROOT is set
|
|
79
|
+
# This ensures data is available before module is frozen
|
|
80
|
+
_DISCOVERY_RESULTS = {}
|
|
81
|
+
if os.environ.get('TDK_PROJECT_ROOT', ''):
|
|
82
|
+
_DISCOVERY_RESULTS = _run_discovery()
|
|
83
|
+
else:
|
|
84
|
+
# Empty results if no project root set
|
|
85
|
+
_DISCOVERY_RESULTS = {
|
|
86
|
+
"app_resources": [],
|
|
87
|
+
"resource_dependencies": {},
|
|
88
|
+
"resource_aliases": {},
|
|
89
|
+
"resource_path_map": {},
|
|
90
|
+
"stack_configs": {},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Export discovery results as module-level variables
|
|
94
|
+
# These are populated at load time and remain read-only
|
|
95
|
+
APP_RESOURCES = _DISCOVERY_RESULTS["app_resources"]
|
|
96
|
+
RESOURCE_DEPENDENCIES = _DISCOVERY_RESULTS["resource_dependencies"]
|
|
97
|
+
RESOURCE_ALIASES = _DISCOVERY_RESULTS["resource_aliases"]
|
|
98
|
+
RESOURCE_PATH_MAP = _DISCOVERY_RESULTS["resource_path_map"]
|
|
99
|
+
|
|
100
|
+
# Functions for accessing data (re-run discovery if needed)
|
|
101
|
+
def get_app_resources():
|
|
102
|
+
"""Get discovered app resources."""
|
|
103
|
+
if len(APP_RESOURCES) > 0:
|
|
104
|
+
return APP_RESOURCES
|
|
105
|
+
if _DISCOVERY_STATE[0]:
|
|
106
|
+
return APP_RESOURCES
|
|
107
|
+
results = _run_discovery()
|
|
108
|
+
return results["app_resources"]
|
|
109
|
+
|
|
110
|
+
def get_resource_dependencies():
|
|
111
|
+
"""Get resource dependency graph."""
|
|
112
|
+
if len(RESOURCE_DEPENDENCIES) > 0:
|
|
113
|
+
return RESOURCE_DEPENDENCIES
|
|
114
|
+
if _DISCOVERY_STATE[0]:
|
|
115
|
+
return RESOURCE_DEPENDENCIES
|
|
116
|
+
results = _run_discovery()
|
|
117
|
+
return results["resource_dependencies"]
|
|
118
|
+
|
|
119
|
+
def get_resource_aliases():
|
|
120
|
+
"""Get resource name to path aliases."""
|
|
121
|
+
if len(RESOURCE_ALIASES) > 0:
|
|
122
|
+
return RESOURCE_ALIASES
|
|
123
|
+
if _DISCOVERY_STATE[0]:
|
|
124
|
+
return RESOURCE_ALIASES
|
|
125
|
+
results = _run_discovery()
|
|
126
|
+
return results["resource_aliases"]
|
|
127
|
+
|
|
128
|
+
def get_resource_path_map():
|
|
129
|
+
"""Get resource path to name mapping."""
|
|
130
|
+
if len(RESOURCE_PATH_MAP) > 0:
|
|
131
|
+
return RESOURCE_PATH_MAP
|
|
132
|
+
if _DISCOVERY_STATE[0]:
|
|
133
|
+
return RESOURCE_PATH_MAP
|
|
134
|
+
results = _run_discovery()
|
|
135
|
+
return results["resource_path_map"]
|
|
136
|
+
|
|
137
|
+
# Ref functions (same as above, for compatibility)
|
|
138
|
+
def get_app_resources_ref():
|
|
139
|
+
return get_app_resources()
|
|
140
|
+
|
|
141
|
+
def get_resource_dependencies_ref():
|
|
142
|
+
return get_resource_dependencies()
|
|
143
|
+
|
|
144
|
+
def get_resource_aliases_ref():
|
|
145
|
+
return get_resource_aliases()
|
|
146
|
+
|
|
147
|
+
def get_resource_path_map_ref():
|
|
148
|
+
return get_resource_path_map()
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# =============================================================================
|
|
152
|
+
# 🔄 INCREMENTAL CACHE OPERATIONS (Auto-discovery support)
|
|
153
|
+
# =============================================================================
|
|
154
|
+
|
|
155
|
+
def add_resource_to_cache(resource_dict):
|
|
156
|
+
"""Add a new resource to the discovery cache."""
|
|
157
|
+
resource_name = resource_dict.get("appName", "")
|
|
158
|
+
resource_path = resource_dict.get("_path", "")
|
|
159
|
+
if resource_name and resource_path:
|
|
160
|
+
APP_RESOURCES.append(resource_dict)
|
|
161
|
+
RESOURCE_ALIASES[resource_name] = resource_path
|
|
162
|
+
RESOURCE_PATH_MAP[resource_path] = resource_name
|
|
163
|
+
|
|
164
|
+
def remove_resource_from_cache(resource_path):
|
|
165
|
+
"""Remove a resource from the discovery cache by path."""
|
|
166
|
+
# Find and remove from app_resources list
|
|
167
|
+
for i, resource in enumerate(APP_RESOURCES):
|
|
168
|
+
if resource.get("_path", "") == resource_path:
|
|
169
|
+
APP_RESOURCES.pop(i)
|
|
170
|
+
break
|
|
171
|
+
|
|
172
|
+
# Remove from aliases
|
|
173
|
+
resource_name = RESOURCE_PATH_MAP.get(resource_path, "")
|
|
174
|
+
if resource_name in RESOURCE_ALIASES:
|
|
175
|
+
RESOURCE_ALIASES.pop(resource_name, None)
|
|
176
|
+
if resource_path in RESOURCE_PATH_MAP:
|
|
177
|
+
RESOURCE_PATH_MAP.pop(resource_path, None)
|
|
178
|
+
if resource_name in RESOURCE_DEPENDENCIES:
|
|
179
|
+
RESOURCE_DEPENDENCIES.pop(resource_name, None)
|
|
180
|
+
|
|
181
|
+
def has_resource_in_cache(resource_path):
|
|
182
|
+
"""Check if a resource path exists in cache."""
|
|
183
|
+
return resource_path in RESOURCE_PATH_MAP
|
|
184
|
+
|
|
185
|
+
def get_resource_by_path_from_cache(resource_path):
|
|
186
|
+
"""Get resource dict by path."""
|
|
187
|
+
resource_name = RESOURCE_PATH_MAP.get(resource_path, "")
|
|
188
|
+
if resource_name:
|
|
189
|
+
for resource in APP_RESOURCES:
|
|
190
|
+
if resource.get("appName", "") == resource_name:
|
|
191
|
+
return resource
|
|
192
|
+
return None
|
|
193
|
+
|
|
194
|
+
def persist_cache_to_file():
|
|
195
|
+
"""Persist cache to snapshot file."""
|
|
196
|
+
pass # No-op for now
|
|
197
|
+
|
|
198
|
+
def get_cache_stats():
|
|
199
|
+
"""Get cache statistics."""
|
|
200
|
+
return {
|
|
201
|
+
"app_resources_count": len(APP_RESOURCES),
|
|
202
|
+
"dependencies_count": len(RESOURCE_DEPENDENCIES),
|
|
203
|
+
"aliases_count": len(RESOURCE_ALIASES),
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
def reinitialize():
|
|
207
|
+
"""Force re-discovery by clearing and re-running."""
|
|
208
|
+
# Note: Module-level variables are mutable, no global keyword needed in Starlark
|
|
209
|
+
results = _run_discovery()
|
|
210
|
+
return results["app_resources"]
|
|
211
|
+
|
|
212
|
+
CacheOps = struct(
|
|
213
|
+
add=add_resource_to_cache,
|
|
214
|
+
remove=remove_resource_from_cache,
|
|
215
|
+
has=has_resource_in_cache,
|
|
216
|
+
get_by_path=get_resource_by_path_from_cache,
|
|
217
|
+
persist=persist_cache_to_file,
|
|
218
|
+
stats=get_cache_stats,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
Registry = struct(
|
|
222
|
+
add=add_resource_to_cache,
|
|
223
|
+
remove=remove_resource_from_cache,
|
|
224
|
+
has=has_resource_in_cache,
|
|
225
|
+
get_by_path=get_resource_by_path_from_cache,
|
|
226
|
+
persist=persist_cache_to_file,
|
|
227
|
+
stats=get_cache_stats,
|
|
228
|
+
reinitialize=reinitialize,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
# =============================================================================
|
|
233
|
+
# 🔍 SERVICE LOOKUP FUNCTIONS
|
|
234
|
+
# =============================================================================
|
|
235
|
+
|
|
236
|
+
def get_resource_by_name(name):
|
|
237
|
+
"""Get a resource by its appName."""
|
|
238
|
+
for resource in APP_RESOURCES:
|
|
239
|
+
if resource.get("name") == name or resource.get("appName") == name:
|
|
240
|
+
return resource
|
|
241
|
+
return None
|
|
242
|
+
|
|
243
|
+
def get_all_backend_resources():
|
|
244
|
+
"""Get all backend resource names."""
|
|
245
|
+
backends = []
|
|
246
|
+
for app_resource in APP_RESOURCES:
|
|
247
|
+
resources = app_resource.get("resources", [])
|
|
248
|
+
for resource in resources:
|
|
249
|
+
if not resource.get("frontend", False):
|
|
250
|
+
resource_name = resource.get("name", "")
|
|
251
|
+
if resource_name:
|
|
252
|
+
backends.append(resource_name)
|
|
253
|
+
return backends
|
|
254
|
+
|
|
255
|
+
def get_all_frontend_resources():
|
|
256
|
+
"""Get all frontend resource names."""
|
|
257
|
+
frontends = []
|
|
258
|
+
for app_resource in APP_RESOURCES:
|
|
259
|
+
resources = app_resource.get("resources", [])
|
|
260
|
+
for resource in resources:
|
|
261
|
+
if resource.get("frontend", False):
|
|
262
|
+
resource_name = resource.get("name", "")
|
|
263
|
+
if resource_name:
|
|
264
|
+
frontends.append(resource_name)
|
|
265
|
+
return frontends
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
# =============================================================================
|
|
269
|
+
# 📊 SNAPSHOT & TOPOLOGY GENERATION
|
|
270
|
+
# =============================================================================
|
|
271
|
+
|
|
272
|
+
def _render_product_stack_file(resource):
|
|
273
|
+
"""Render a product stack resource file content."""
|
|
274
|
+
resource_name = resource.get("name", "unknown")
|
|
275
|
+
lines = [
|
|
276
|
+
"# ----------------------------------------------------------------------------",
|
|
277
|
+
"# AUTOGENERATED FILE - DO NOT EDIT",
|
|
278
|
+
"# ----------------------------------------------------------------------------",
|
|
279
|
+
"",
|
|
280
|
+
"# Product Stack: " + resource_name,
|
|
281
|
+
"",
|
|
282
|
+
"## Stack Info",
|
|
283
|
+
]
|
|
284
|
+
|
|
285
|
+
for key in ["name", "appType", "stack", "port"]:
|
|
286
|
+
if key in resource:
|
|
287
|
+
lines.append("- " + key + ": `" + str(resource[key]) + "`")
|
|
288
|
+
|
|
289
|
+
return "\n".join(lines) + "\n"
|
|
290
|
+
|
|
291
|
+
def _render_product_stacks_index(resources):
|
|
292
|
+
"""Render the product stacks index file content."""
|
|
293
|
+
lines = [
|
|
294
|
+
"# Product Stacks Index",
|
|
295
|
+
"",
|
|
296
|
+
"## Services",
|
|
297
|
+
"",
|
|
298
|
+
]
|
|
299
|
+
|
|
300
|
+
for resource in resources:
|
|
301
|
+
resource_name = resource.get("name", "unknown")
|
|
302
|
+
lines.append("- `" + resource_name + "`")
|
|
303
|
+
|
|
304
|
+
return "\n".join(lines) + "\n"
|
|
305
|
+
|
|
306
|
+
def _write_file_if_changed(path, content):
|
|
307
|
+
"""Write file only if content changed. Returns True if written."""
|
|
308
|
+
normalized = path.replace('\\', '/').replace('./', '', 1)
|
|
309
|
+
if '..' in normalized.split('/') or not (
|
|
310
|
+
'/.autogenerated/' in normalized or
|
|
311
|
+
normalized.startswith('.autogenerated/') or
|
|
312
|
+
normalized.startswith('.tdk/.tdk-out/') or
|
|
313
|
+
normalized in ['Tiltfile', '.tiltignore'] or
|
|
314
|
+
(normalized.startswith('TILT_') and normalized.endswith('.star') and '/' not in normalized)
|
|
315
|
+
):
|
|
316
|
+
fail("Flisk discovery refused to write outside its generated-file allowlist: " + path)
|
|
317
|
+
|
|
318
|
+
# Read existing file (returns empty string on error via shell)
|
|
319
|
+
existing = str(local("cat " + path + " 2>/dev/null || echo ''", quiet=True, echo_off=True))
|
|
320
|
+
|
|
321
|
+
if existing != content:
|
|
322
|
+
local("mkdir -p $(dirname " + path + ") && echo '" + content + "' > " + path, quiet=True, echo_off=True)
|
|
323
|
+
return True
|
|
324
|
+
return False
|
|
325
|
+
|
|
326
|
+
def _render_star_file(description, var_name, data):
|
|
327
|
+
"""Render a Starlark file with data."""
|
|
328
|
+
return "# " + description + "\n" + var_name + " = " + str(data) + "\n"
|
|
329
|
+
|
|
330
|
+
def generate_product_stack_topology():
|
|
331
|
+
"""Generate product stack topology folders."""
|
|
332
|
+
local("mkdir -p " + PRODUCT_TOPOLOGY_DIR, quiet=True)
|
|
333
|
+
|
|
334
|
+
changes = 0
|
|
335
|
+
for resource in APP_RESOURCES:
|
|
336
|
+
stack = resource.get("name", "unknown")
|
|
337
|
+
if not stack or '/' in stack or '\\' in stack or stack == '..':
|
|
338
|
+
fail("Invalid stack name for generated topology path: " + str(stack))
|
|
339
|
+
stack_file = PRODUCT_TOPOLOGY_DIR + "/" + stack + "/stack.star"
|
|
340
|
+
if _write_file_if_changed(stack_file, _render_product_stack_file(resource)):
|
|
341
|
+
changes += 1
|
|
342
|
+
|
|
343
|
+
index_path = PRODUCT_TOPOLOGY_DIR + "/INDEX.star"
|
|
344
|
+
if _write_file_if_changed(index_path, _render_product_stacks_index(APP_RESOURCES)):
|
|
345
|
+
changes += 1
|
|
346
|
+
|
|
347
|
+
if changes > 0:
|
|
348
|
+
print("Regenerated {} product stack files".format(changes))
|
|
349
|
+
|
|
350
|
+
def generate_product_snapshot_topology():
|
|
351
|
+
"""Generate product snapshot topology files."""
|
|
352
|
+
local("mkdir -p " + PRODUCT_SNAPSHOT_DIR, quiet=True)
|
|
353
|
+
|
|
354
|
+
services_path = PRODUCT_SNAPSHOT_DIR + "/services.star"
|
|
355
|
+
deps_path = PRODUCT_SNAPSHOT_DIR + "/dependencies.star"
|
|
356
|
+
aliases_path = PRODUCT_SNAPSHOT_DIR + "/aliases.star"
|
|
357
|
+
paths_path = PRODUCT_SNAPSHOT_DIR + "/paths.star"
|
|
358
|
+
index_path = PRODUCT_SNAPSHOT_DIR + "/index.star"
|
|
359
|
+
|
|
360
|
+
changes = 0
|
|
361
|
+
if _write_file_if_changed(services_path, _render_star_file("Services", "APP_RESOURCES_AUTOGENERATED", APP_RESOURCES)):
|
|
362
|
+
changes += 1
|
|
363
|
+
if _write_file_if_changed(deps_path, _render_star_file("Dependencies", "RESOURCE_DEPENDENCIES_AUTOGENERATED", RESOURCE_DEPENDENCIES)):
|
|
364
|
+
changes += 1
|
|
365
|
+
if _write_file_if_changed(aliases_path, _render_star_file("Aliases", "RESOURCE_ALIASES_AUTOGENERATED", RESOURCE_ALIASES)):
|
|
366
|
+
changes += 1
|
|
367
|
+
if _write_file_if_changed(paths_path, _render_star_file("Path Map", "RESOURCE_PATH_MAP_AUTOGENERATED", RESOURCE_PATH_MAP)):
|
|
368
|
+
changes += 1
|
|
369
|
+
if _write_file_if_changed(index_path, _render_star_file("Index", "INDEX", {"services": len(APP_RESOURCES)})):
|
|
370
|
+
changes += 1
|
|
371
|
+
|
|
372
|
+
if changes > 0:
|
|
373
|
+
print("Regenerated {} snapshot files".format(changes))
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
# =============================================================================
|
|
377
|
+
# 📄 YAML MANIFEST GENERATION
|
|
378
|
+
# =============================================================================
|
|
379
|
+
|
|
380
|
+
def _json_to_yaml(json_data, indent=0):
|
|
381
|
+
"""Convert JSON to YAML format."""
|
|
382
|
+
spaces = " " * indent
|
|
383
|
+
yaml_lines = []
|
|
384
|
+
|
|
385
|
+
if type(json_data) == "dict":
|
|
386
|
+
priority_fields = ["appName", "appType", "stack", "port"]
|
|
387
|
+
ordered_keys = []
|
|
388
|
+
for key in priority_fields:
|
|
389
|
+
if key in json_data:
|
|
390
|
+
ordered_keys.append(key)
|
|
391
|
+
remaining = [k for k in json_data if k not in priority_fields and not k.startswith("_")]
|
|
392
|
+
for key in sorted(remaining):
|
|
393
|
+
ordered_keys.append(key)
|
|
394
|
+
|
|
395
|
+
for key in ordered_keys:
|
|
396
|
+
value = json_data[key]
|
|
397
|
+
if str(key).startswith("_"):
|
|
398
|
+
continue
|
|
399
|
+
if type(value) == "dict":
|
|
400
|
+
yaml_lines.append(spaces + str(key) + ":")
|
|
401
|
+
nested = _json_to_yaml(value, indent + 1)
|
|
402
|
+
if nested:
|
|
403
|
+
yaml_lines.append(nested)
|
|
404
|
+
elif type(value) == "list":
|
|
405
|
+
yaml_lines.append(spaces + str(key) + ":")
|
|
406
|
+
for item in value:
|
|
407
|
+
if type(item) == "dict":
|
|
408
|
+
yaml_lines.append(spaces + " - " + _json_to_yaml(item, 0).strip())
|
|
409
|
+
else:
|
|
410
|
+
yaml_lines.append(spaces + " - " + str(item))
|
|
411
|
+
else:
|
|
412
|
+
yaml_lines.append(spaces + str(key) + ": " + str(value))
|
|
413
|
+
elif type(json_data) == "list":
|
|
414
|
+
for item in json_data:
|
|
415
|
+
if type(item) == "dict":
|
|
416
|
+
yaml_lines.append(spaces + "- " + _json_to_yaml(item, 0).strip())
|
|
417
|
+
else:
|
|
418
|
+
yaml_lines.append(spaces + "- " + str(item))
|
|
419
|
+
else:
|
|
420
|
+
yaml_lines.append(spaces + str(json_data))
|
|
421
|
+
|
|
422
|
+
return "\n".join(yaml_lines)
|
|
423
|
+
|
|
424
|
+
def _find_manifest_files(root, manifest_filename):
|
|
425
|
+
"""Find manifest files, handling glob patterns in root paths."""
|
|
426
|
+
files = []
|
|
427
|
+
|
|
428
|
+
# Check if root contains glob patterns
|
|
429
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '.')
|
|
430
|
+
if '*' in root or '?' in root:
|
|
431
|
+
# Use bash to expand glob and find files
|
|
432
|
+
cmd = "cd " + project_root + " && bash -c 'for dir in " + root + "; do if [ -d \"$dir\" ]; then find \"$dir\" -maxdepth 3 -type f -name \"" + manifest_filename + "\" 2>/dev/null; fi; done'"
|
|
433
|
+
result = str(local(cmd, quiet=True, echo_off=True)).strip()
|
|
434
|
+
else:
|
|
435
|
+
# Resolve relative paths against project root (non-glob)
|
|
436
|
+
if root.startswith('/'):
|
|
437
|
+
full_path = root
|
|
438
|
+
else:
|
|
439
|
+
full_path = project_root + "/" + root
|
|
440
|
+
# A stack listed in project.json may not have a directory yet (a fresh
|
|
441
|
+
# project lists "proxy"); find exits 1 on a missing path and local() fails.
|
|
442
|
+
cmd = "if [ -d '" + full_path + "' ]; then find '" + full_path + "' -type f -name '" + manifest_filename + "' 2>/dev/null; fi"
|
|
443
|
+
result = str(local(cmd, quiet=True, echo_off=True)).strip()
|
|
444
|
+
|
|
445
|
+
if result:
|
|
446
|
+
for f in result.split("\n"):
|
|
447
|
+
f = f.strip()
|
|
448
|
+
if f and f not in files:
|
|
449
|
+
files.append(f)
|
|
450
|
+
|
|
451
|
+
return files
|
|
452
|
+
|
|
453
|
+
def _generate_yaml_from_json_manifests():
|
|
454
|
+
"""Generate YAML manifests from JSON manifests."""
|
|
455
|
+
generated_count = 0
|
|
456
|
+
for root in DISCOVERY_SCAN_ROOTS:
|
|
457
|
+
json_files = _find_manifest_files(root, MANIFEST_FILENAME)
|
|
458
|
+
|
|
459
|
+
for json_file in json_files:
|
|
460
|
+
resource_dir = json_file.rsplit('/', 1)[0]
|
|
461
|
+
yaml_file = resource_dir + "/.autogenerated/" + MANIFEST_FILENAME_YAML
|
|
462
|
+
load_result = ManifestLoader.load_from_file(json_file)
|
|
463
|
+
if not load_result.error and load_result.manifest:
|
|
464
|
+
yaml_content = _json_to_yaml(load_result.manifest)
|
|
465
|
+
if _write_file_if_changed(yaml_file, yaml_content):
|
|
466
|
+
generated_count += 1
|
|
467
|
+
|
|
468
|
+
if generated_count > 0:
|
|
469
|
+
print("Generated {} YAML manifests".format(generated_count))
|
|
470
|
+
|
|
471
|
+
def load_yaml_manifests_as_resources():
|
|
472
|
+
"""Load YAML manifests as Tilt resources (via local_resource)."""
|
|
473
|
+
_generate_yaml_from_json_manifests()
|
|
474
|
+
|
|
475
|
+
yaml_files = []
|
|
476
|
+
for root in DISCOVERY_SCAN_ROOTS:
|
|
477
|
+
files = _find_manifest_files(root, MANIFEST_FILENAME_YAML)
|
|
478
|
+
for f in files:
|
|
479
|
+
if '/.autogenerated/' + MANIFEST_FILENAME_YAML in f and f not in yaml_files:
|
|
480
|
+
yaml_files.append(f)
|
|
481
|
+
|
|
482
|
+
if not yaml_files:
|
|
483
|
+
return
|
|
484
|
+
|
|
485
|
+
created_resources = {}
|
|
486
|
+
for yaml_file in yaml_files:
|
|
487
|
+
service_dir = yaml_file.rsplit('/.autogenerated/', 1)[0]
|
|
488
|
+
json_file = service_dir + '/' + MANIFEST_FILENAME
|
|
489
|
+
load_result = ManifestLoader.load_from_file(json_file)
|
|
490
|
+
resource_name = ""
|
|
491
|
+
|
|
492
|
+
if load_result.error:
|
|
493
|
+
continue
|
|
494
|
+
|
|
495
|
+
manifest = load_result.manifest
|
|
496
|
+
if manifest:
|
|
497
|
+
resource_name = manifest.get("appName", "")
|
|
498
|
+
|
|
499
|
+
if not resource_name:
|
|
500
|
+
continue
|
|
501
|
+
|
|
502
|
+
resource_name = resource_name + "-yaml"
|
|
503
|
+
|
|
504
|
+
if resource_name in created_resources:
|
|
505
|
+
continue
|
|
506
|
+
|
|
507
|
+
yaml_path_display = yaml_file
|
|
508
|
+
if yaml_file.startswith("../../../../"):
|
|
509
|
+
yaml_path_display = yaml_file[12:]
|
|
510
|
+
|
|
511
|
+
local_resource(
|
|
512
|
+
name=resource_name,
|
|
513
|
+
cmd="echo 'YAML manifest: " + yaml_path_display + "'",
|
|
514
|
+
deps=[yaml_file],
|
|
515
|
+
labels=["yaml-manifest"],
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
created_resources[resource_name] = True
|
|
519
|
+
|
|
520
|
+
# Generate YAML manifests at module load time
|
|
521
|
+
load_yaml_manifests_as_resources()
|
|
522
|
+
|
|
523
|
+
# Load project defaults from spec.master if available
|
|
524
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '')
|
|
525
|
+
if project_root:
|
|
526
|
+
project_defaults = Config.load_project_defaults(project_root)
|
|
527
|
+
if project_defaults:
|
|
528
|
+
Config = struct(
|
|
529
|
+
load_project_defaults=Config.load_project_defaults,
|
|
530
|
+
DEFAULTS=project_defaults.DEFAULTS,
|
|
531
|
+
FOCUS_PRE_ALPHA=project_defaults.FOCUS_PRE_ALPHA,
|
|
532
|
+
FOCUS_ALPHA=project_defaults.FOCUS_ALPHA,
|
|
533
|
+
FOCUS_BETA=project_defaults.FOCUS_BETA,
|
|
534
|
+
GLOBAL=Config.GLOBAL,
|
|
535
|
+
INFRA_RESOURCES=Config.INFRA_RESOURCES,
|
|
536
|
+
CORE_INFRA=Config.CORE_INFRA,
|
|
537
|
+
INFRA_STACK_MAP=Config.INFRA_STACK_MAP,
|
|
538
|
+
OPTIONAL_INFRA=Config.OPTIONAL_INFRA,
|
|
539
|
+
DDD_LIBS=Config.DDD_LIBS,
|
|
540
|
+
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
# Export config data
|
|
544
|
+
OPTIONAL_INFRA_EXPORT = OPTIONAL_INFRA
|
|
545
|
+
CORE_INFRA_EXPORT = CORE_INFRA
|
|
546
|
+
INFRA_STACK_MAP_EXPORT = INFRA_STACK_MAP
|
|
547
|
+
DEFAULTS_EXPORT = Config.DEFAULTS
|
|
548
|
+
DDD_LIBS_EXPORT = DDD_LIBS
|
|
549
|
+
GLOBAL_CONFIG_EXPORT = GLOBAL_CONFIG
|
|
550
|
+
INFRA_RESOURCES_EXPORT = INFRA_RESOURCES
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
# Export focus lists (populated from project spec.master)
|
|
554
|
+
FOCUS_PRE_ALPHA_EXPORT = Config.FOCUS_PRE_ALPHA
|
|
555
|
+
FOCUS_ALPHA_EXPORT = Config.FOCUS_ALPHA
|
|
556
|
+
FOCUS_BETA_EXPORT = Config.FOCUS_BETA
|
|
557
|
+
|
|
558
|
+
def get_platform_libs_export():
|
|
559
|
+
return get_platform_libs()
|
|
560
|
+
|
|
561
|
+
def get_product_libs_export():
|
|
562
|
+
return get_product_libs()
|