@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.
- 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-QWYXYAX6.js +510 -0
- package/cli/dist-bundle/cli.js +2017 -0
- package/cli/dist-bundle/cold-preflight-MM46GFQA.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,744 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk Landscape contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# 📋 MANIFEST MODULE - VALIDATOR
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# Path: .tilt/topologies/tilt/manifest/validator.star
|
|
7
|
+
# Purpose: Comprehensive manifest validation with schema, values, and dependencies
|
|
8
|
+
# Status: Phase 3 of manifest system refactoring
|
|
9
|
+
# =============================================================================
|
|
10
|
+
|
|
11
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
12
|
+
VALID_STACKS = () # Stacks are project-specific, discovered dynamically
|
|
13
|
+
VALID_FEATURES = "api-client", "env-config", "api-index", "prisma", "drizzle", "ddd", "nats", "redis", "infisical", "vitest", "traefik", "websocket", "graphql", "grpc", "vite-node", "maintenance", "sablier"
|
|
14
|
+
PORT_RANGES = {"frontend": {"min": 3000, "max": 5999}, "backend": {"min": 4000, "max": 5999}, "bring-your-own": {"min": 4000, "max": 5999}, "worker": {"min": 6000, "max": 6999}, "migrator": {"min": 7000, "max": 7999}, "sdk": {"min": 3000, "max": 9999}, "library": {"min": 3000, "max": 9999}}
|
|
15
|
+
DEFAULTS = {}
|
|
16
|
+
|
|
17
|
+
# === END INLINED CONSTANTS ===
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
load("./constants.star",
|
|
21
|
+
"VALID_APP_TYPES",
|
|
22
|
+
"MANIFEST_DEFAULTS",
|
|
23
|
+
"VALIDATION_THRESHOLDS",
|
|
24
|
+
"MANIFEST_FILENAME",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
load("./schema.star", "ManifestSchema")
|
|
28
|
+
load("./errors.star", "ManifestErrors")
|
|
29
|
+
load("./parser.star", "extract_stack_from_path")
|
|
30
|
+
load("../resources/shared-platform-postgres.star", "is_shared_platform_postgres_dependency")
|
|
31
|
+
|
|
32
|
+
def validate(manifest, context=None, level='all'):
|
|
33
|
+
"""
|
|
34
|
+
Comprehensive manifest validation at specified level.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
manifest: Manifest dict to validate
|
|
38
|
+
context: Optional context dict:
|
|
39
|
+
- all_manifests: List of all manifests for cross-validation
|
|
40
|
+
- resource_path: Path for error context
|
|
41
|
+
- strict: Boolean for strict mode (treats warnings as errors)
|
|
42
|
+
level: Validation level
|
|
43
|
+
- 'schema': Structure and types only
|
|
44
|
+
- 'values': Value constraints
|
|
45
|
+
- 'cross_field': Cross-field dependencies
|
|
46
|
+
- 'cross_resource': Cross-resource dependencies (requires all_manifests)
|
|
47
|
+
- 'all': All validations (default)
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
struct(
|
|
51
|
+
valid=True/False,
|
|
52
|
+
errors=[], # Critical errors
|
|
53
|
+
warnings=[], # Non-critical issues
|
|
54
|
+
stats={ # Validation statistics
|
|
55
|
+
'fields_checked': N,
|
|
56
|
+
'rules_passed': N,
|
|
57
|
+
'rules_failed': N,
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
"""
|
|
61
|
+
context = context or {}
|
|
62
|
+
errors = []
|
|
63
|
+
warnings = []
|
|
64
|
+
stats = {'fields_checked': 0, 'rules_passed': 0, 'rules_failed': 0}
|
|
65
|
+
|
|
66
|
+
levels = ['schema', 'values', 'cross_field', 'cross_service']
|
|
67
|
+
if level == 'all':
|
|
68
|
+
levels_to_run = levels
|
|
69
|
+
elif level in levels:
|
|
70
|
+
levels_to_run = [level]
|
|
71
|
+
else:
|
|
72
|
+
return struct(
|
|
73
|
+
valid=False,
|
|
74
|
+
errors=[ManifestErrors.new(
|
|
75
|
+
message="Invalid validation level: " + level,
|
|
76
|
+
category=ManifestErrors.CATEGORY['CONFIG'],
|
|
77
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
78
|
+
)],
|
|
79
|
+
warnings=[],
|
|
80
|
+
stats=stats,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# Run schema validation
|
|
84
|
+
if 'schema' in levels_to_run:
|
|
85
|
+
schema_result = _validate_schema(manifest, context)
|
|
86
|
+
errors.extend(schema_result.errors)
|
|
87
|
+
warnings.extend(schema_result.warnings)
|
|
88
|
+
stats['fields_checked'] += schema_result.stats['fields_checked']
|
|
89
|
+
stats['rules_passed'] += schema_result.stats['rules_passed']
|
|
90
|
+
stats['rules_failed'] += schema_result.stats['rules_failed']
|
|
91
|
+
|
|
92
|
+
# Run value validation
|
|
93
|
+
if 'values' in levels_to_run:
|
|
94
|
+
values_result = _validate_values(manifest, context)
|
|
95
|
+
errors.extend(values_result.errors)
|
|
96
|
+
warnings.extend(values_result.warnings)
|
|
97
|
+
stats['fields_checked'] += values_result.stats['fields_checked']
|
|
98
|
+
stats['rules_passed'] += values_result.stats['rules_passed']
|
|
99
|
+
stats['rules_failed'] += values_result.stats['rules_failed']
|
|
100
|
+
|
|
101
|
+
# Run cross-field validation
|
|
102
|
+
if 'cross_field' in levels_to_run:
|
|
103
|
+
cross_field_result = _validate_cross_field(manifest, context)
|
|
104
|
+
errors.extend(cross_field_result.errors)
|
|
105
|
+
warnings.extend(cross_field_result.warnings)
|
|
106
|
+
stats['fields_checked'] += cross_field_result.stats['fields_checked']
|
|
107
|
+
stats['rules_passed'] += cross_field_result.stats['rules_passed']
|
|
108
|
+
stats['rules_failed'] += cross_field_result.stats['rules_failed']
|
|
109
|
+
|
|
110
|
+
# Run cross-resource validation
|
|
111
|
+
if 'cross_resource' in levels_to_run and context.get('all_manifests'):
|
|
112
|
+
cross_resource_result = _validate_cross_resource(manifest, context)
|
|
113
|
+
errors.extend(cross_resource_result.errors)
|
|
114
|
+
warnings.extend(cross_resource_result.warnings)
|
|
115
|
+
stats['fields_checked'] += cross_resource_result.stats['fields_checked']
|
|
116
|
+
stats['rules_passed'] += cross_resource_result.stats['rules_passed']
|
|
117
|
+
stats['rules_failed'] += cross_resource_result.stats['rules_failed']
|
|
118
|
+
|
|
119
|
+
# In strict mode, treat warnings as errors
|
|
120
|
+
if context.get('strict'):
|
|
121
|
+
errors.extend([ManifestErrors.new(
|
|
122
|
+
message=w.message,
|
|
123
|
+
category=w.category,
|
|
124
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
125
|
+
context=w.context,
|
|
126
|
+
) for w in warnings])
|
|
127
|
+
warnings = []
|
|
128
|
+
|
|
129
|
+
valid = len([e for e in errors if e.severity == ManifestErrors.SEVERITY['CRITICAL'] or
|
|
130
|
+
e.severity == ManifestErrors.SEVERITY['ERROR']]) == 0
|
|
131
|
+
|
|
132
|
+
return struct(
|
|
133
|
+
valid=valid,
|
|
134
|
+
errors=errors,
|
|
135
|
+
warnings=warnings,
|
|
136
|
+
stats=stats,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def _validate_schema(manifest, context):
|
|
140
|
+
"""
|
|
141
|
+
Level 1: Schema Validation
|
|
142
|
+
- Check all required fields present
|
|
143
|
+
- Validate field types
|
|
144
|
+
- Check field formats (regex patterns)
|
|
145
|
+
- Validate enum values
|
|
146
|
+
"""
|
|
147
|
+
errors = []
|
|
148
|
+
warnings = []
|
|
149
|
+
stats = {'fields_checked': 0, 'rules_passed': 0, 'rules_failed': 0}
|
|
150
|
+
|
|
151
|
+
if not manifest:
|
|
152
|
+
errors.append(ManifestErrors.new(
|
|
153
|
+
message="Manifest is empty or None",
|
|
154
|
+
category=ManifestErrors.CATEGORY['SCHEMA'],
|
|
155
|
+
severity=ManifestErrors.SEVERITY['CRITICAL'],
|
|
156
|
+
context={'path': context.get('resource_path', '')},
|
|
157
|
+
))
|
|
158
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
159
|
+
|
|
160
|
+
# Check required fields
|
|
161
|
+
required_fields = ManifestSchema.get_required_fields(manifest)
|
|
162
|
+
for field_name in required_fields:
|
|
163
|
+
stats['fields_checked'] += 1
|
|
164
|
+
|
|
165
|
+
if field_name not in manifest or manifest[field_name] == None or manifest[field_name] == '':
|
|
166
|
+
errors.append(ManifestErrors.new(
|
|
167
|
+
message="Missing required field: " + field_name,
|
|
168
|
+
category=ManifestErrors.CATEGORY['SCHEMA'],
|
|
169
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
170
|
+
context={'field': field_name, 'path': context.get('resource_path', '')},
|
|
171
|
+
))
|
|
172
|
+
stats['rules_failed'] += 1
|
|
173
|
+
else:
|
|
174
|
+
stats['rules_passed'] += 1
|
|
175
|
+
|
|
176
|
+
# Validate field types and constraints
|
|
177
|
+
for field_name, value in manifest.items():
|
|
178
|
+
if field_name.startswith('_'): # Skip internal fields
|
|
179
|
+
continue
|
|
180
|
+
|
|
181
|
+
field_schema = ManifestSchema.get_field(field_name)
|
|
182
|
+
if not field_schema:
|
|
183
|
+
# Unknown field - could be a warning
|
|
184
|
+
continue
|
|
185
|
+
|
|
186
|
+
stats['fields_checked'] += 1
|
|
187
|
+
|
|
188
|
+
# Check field type
|
|
189
|
+
field_type = field_schema.get('type')
|
|
190
|
+
type_valid = _check_field_type(field_name, value, field_type, field_schema)
|
|
191
|
+
|
|
192
|
+
if not type_valid:
|
|
193
|
+
errors.append(ManifestErrors.new(
|
|
194
|
+
message="Field {} has invalid type".format(field_name),
|
|
195
|
+
category=ManifestErrors.CATEGORY['SCHEMA'],
|
|
196
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
197
|
+
context={'field': field_name, 'value': value},
|
|
198
|
+
))
|
|
199
|
+
stats['rules_failed'] += 1
|
|
200
|
+
else:
|
|
201
|
+
# Check constraints
|
|
202
|
+
constraints = field_schema.get('constraints', {})
|
|
203
|
+
constraint_result = _check_constraints(field_name, value, constraints)
|
|
204
|
+
|
|
205
|
+
if constraint_result:
|
|
206
|
+
errors.append(constraint_result)
|
|
207
|
+
stats['rules_failed'] += 1
|
|
208
|
+
else:
|
|
209
|
+
stats['rules_passed'] += 1
|
|
210
|
+
|
|
211
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
212
|
+
|
|
213
|
+
def _validate_values(manifest, context):
|
|
214
|
+
"""
|
|
215
|
+
Level 2: Value Validation
|
|
216
|
+
- Port range validation
|
|
217
|
+
- Name format validation
|
|
218
|
+
- String length constraints
|
|
219
|
+
- Numeric range constraints
|
|
220
|
+
- Pattern matching
|
|
221
|
+
"""
|
|
222
|
+
errors = []
|
|
223
|
+
warnings = []
|
|
224
|
+
stats = {'fields_checked': 0, 'rules_passed': 0, 'rules_failed': 0}
|
|
225
|
+
|
|
226
|
+
# Validate port
|
|
227
|
+
if 'port' in manifest:
|
|
228
|
+
stats['fields_checked'] += 1
|
|
229
|
+
port = manifest['port']
|
|
230
|
+
app_type = manifest.get('appType', 'backend')
|
|
231
|
+
|
|
232
|
+
# Check basic range
|
|
233
|
+
if port < 1024 or port > 65535:
|
|
234
|
+
errors.append(ManifestErrors.new(
|
|
235
|
+
message="Port {} is outside valid range [1024, 65535]".format(port),
|
|
236
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
237
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
238
|
+
context={'field': 'port', 'value': port},
|
|
239
|
+
))
|
|
240
|
+
stats['rules_failed'] += 1
|
|
241
|
+
else:
|
|
242
|
+
# Check app type specific range
|
|
243
|
+
port_range = PORT_RANGES.get(app_type)
|
|
244
|
+
if port_range:
|
|
245
|
+
if port < port_range['min'] or port > port_range['max']:
|
|
246
|
+
warnings.append(ManifestErrors.new(
|
|
247
|
+
message="Port {} is outside recommended range for {} [{}-{}]".format(
|
|
248
|
+
port, app_type, port_range['min'], port_range['max']
|
|
249
|
+
),
|
|
250
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
251
|
+
severity=ManifestErrors.SEVERITY['WARNING'],
|
|
252
|
+
context={'field': 'port', 'value': port, 'appType': app_type},
|
|
253
|
+
))
|
|
254
|
+
stats['rules_passed'] += 1
|
|
255
|
+
else:
|
|
256
|
+
stats['rules_passed'] += 1
|
|
257
|
+
else:
|
|
258
|
+
stats['rules_passed'] += 1
|
|
259
|
+
|
|
260
|
+
# Validate appName format
|
|
261
|
+
if 'appName' in manifest:
|
|
262
|
+
stats['fields_checked'] += 1
|
|
263
|
+
app_name = manifest['appName']
|
|
264
|
+
|
|
265
|
+
# Check kebab-case pattern
|
|
266
|
+
if not _matches_pattern(app_name, r'^[a-z][a-z0-9-]*$'):
|
|
267
|
+
errors.append(ManifestErrors.new(
|
|
268
|
+
message="Invalid appName format: {} (must be kebab-case)".format(app_name),
|
|
269
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
270
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
271
|
+
context={'field': 'appName', 'value': app_name},
|
|
272
|
+
))
|
|
273
|
+
stats['rules_failed'] += 1
|
|
274
|
+
else:
|
|
275
|
+
# Check length
|
|
276
|
+
if len(app_name) < 3:
|
|
277
|
+
errors.append(ManifestErrors.new(
|
|
278
|
+
message="appName too short (min 3 characters): {}".format(app_name),
|
|
279
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
280
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
281
|
+
context={'field': 'appName', 'value': app_name, 'min_length': 3},
|
|
282
|
+
))
|
|
283
|
+
stats['rules_failed'] += 1
|
|
284
|
+
elif len(app_name) > 50:
|
|
285
|
+
errors.append(ManifestErrors.new(
|
|
286
|
+
message="appName too long (max 50 characters): {}".format(app_name),
|
|
287
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
288
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
289
|
+
context={'field': 'appName', 'value': app_name, 'max_length': 50},
|
|
290
|
+
))
|
|
291
|
+
stats['rules_failed'] += 1
|
|
292
|
+
else:
|
|
293
|
+
stats['rules_passed'] += 1
|
|
294
|
+
|
|
295
|
+
# Validate replicas
|
|
296
|
+
if 'replicas' in manifest:
|
|
297
|
+
stats['fields_checked'] += 1
|
|
298
|
+
replicas = manifest['replicas']
|
|
299
|
+
|
|
300
|
+
if replicas < 1:
|
|
301
|
+
errors.append(ManifestErrors.new(
|
|
302
|
+
message="replicas must be at least 1: {}".format(replicas),
|
|
303
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
304
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
305
|
+
context={'field': 'replicas', 'value': replicas},
|
|
306
|
+
))
|
|
307
|
+
stats['rules_failed'] += 1
|
|
308
|
+
elif replicas > VALIDATION_THRESHOLDS['max_replicas']:
|
|
309
|
+
errors.append(ManifestErrors.new(
|
|
310
|
+
message="replicas exceeds maximum ({}): {}".format(
|
|
311
|
+
VALIDATION_THRESHOLDS['max_replicas'], replicas
|
|
312
|
+
),
|
|
313
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
314
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
315
|
+
context={'field': 'replicas', 'value': replicas, 'max': VALIDATION_THRESHOLDS['max_replicas']},
|
|
316
|
+
))
|
|
317
|
+
stats['rules_failed'] += 1
|
|
318
|
+
else:
|
|
319
|
+
stats['rules_passed'] += 1
|
|
320
|
+
|
|
321
|
+
# Validate features length
|
|
322
|
+
if 'featuresEnabled' in manifest:
|
|
323
|
+
stats['fields_checked'] += 1
|
|
324
|
+
features = manifest.get('featuresEnabled', [])
|
|
325
|
+
|
|
326
|
+
if len(features) > VALIDATION_THRESHOLDS['max_features']:
|
|
327
|
+
warnings.append(ManifestErrors.new(
|
|
328
|
+
message="Too many features ({}), consider splitting resource".format(len(features)),
|
|
329
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
330
|
+
severity=ManifestErrors.SEVERITY['WARNING'],
|
|
331
|
+
context={'field': 'featuresEnabled', 'count': len(features), 'max': VALIDATION_THRESHOLDS['max_features']},
|
|
332
|
+
))
|
|
333
|
+
else:
|
|
334
|
+
stats['rules_passed'] += 1
|
|
335
|
+
|
|
336
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
337
|
+
|
|
338
|
+
def _validate_cross_field(manifest, context):
|
|
339
|
+
"""
|
|
340
|
+
Level 3: Cross-Field Validation
|
|
341
|
+
- Frontend requires backend
|
|
342
|
+
- Prisma requires database
|
|
343
|
+
- Port conflicts with app type
|
|
344
|
+
- Dependencies valid
|
|
345
|
+
"""
|
|
346
|
+
errors = []
|
|
347
|
+
warnings = []
|
|
348
|
+
stats = {'fields_checked': 0, 'rules_passed': 0, 'rules_failed': 0}
|
|
349
|
+
|
|
350
|
+
app_type = manifest.get('appType', '')
|
|
351
|
+
|
|
352
|
+
# Frontend requires backendName
|
|
353
|
+
if app_type == 'frontend':
|
|
354
|
+
stats['fields_checked'] += 1
|
|
355
|
+
|
|
356
|
+
if not manifest.get('backendName'):
|
|
357
|
+
errors.append(ManifestErrors.new(
|
|
358
|
+
message="Frontend resource must specify backendName",
|
|
359
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
360
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
361
|
+
context={'field': 'backendName', 'appType': 'frontend'},
|
|
362
|
+
))
|
|
363
|
+
stats['rules_failed'] += 1
|
|
364
|
+
else:
|
|
365
|
+
stats['rules_passed'] += 1
|
|
366
|
+
|
|
367
|
+
# Frontend should have basePath
|
|
368
|
+
stats['fields_checked'] += 1
|
|
369
|
+
if not manifest.get('basePath'):
|
|
370
|
+
warnings.append(ManifestErrors.new(
|
|
371
|
+
message="Frontend resource should specify basePath for routing",
|
|
372
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
373
|
+
severity=ManifestErrors.SEVERITY['WARNING'],
|
|
374
|
+
context={'field': 'basePath', 'appType': 'frontend'},
|
|
375
|
+
))
|
|
376
|
+
else:
|
|
377
|
+
stats['rules_passed'] += 1
|
|
378
|
+
|
|
379
|
+
# Prisma requires databaseName
|
|
380
|
+
features = manifest.get('featuresEnabled', [])
|
|
381
|
+
if 'prisma' in features or 'drizzle' in features:
|
|
382
|
+
stats['fields_checked'] += 1
|
|
383
|
+
|
|
384
|
+
if not manifest.get('databaseName'):
|
|
385
|
+
warnings.append(ManifestErrors.new(
|
|
386
|
+
message="Resource with 'prisma' or 'drizzle' feature should specify databaseName",
|
|
387
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
388
|
+
severity=ManifestErrors.SEVERITY['WARNING'],
|
|
389
|
+
context={'field': 'databaseName', 'featuresEnabled': features},
|
|
390
|
+
))
|
|
391
|
+
else:
|
|
392
|
+
stats['rules_passed'] += 1
|
|
393
|
+
|
|
394
|
+
# sablier.deferStart requires sablier.enable
|
|
395
|
+
sablier = manifest.get('sablier', {}) or {}
|
|
396
|
+
if sablier.get('deferStart', False):
|
|
397
|
+
stats['fields_checked'] += 1
|
|
398
|
+
|
|
399
|
+
if not sablier.get('enable', False):
|
|
400
|
+
errors.append(ManifestErrors.new(
|
|
401
|
+
message="sablier.deferStart requires sablier.enable to also be true",
|
|
402
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
403
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
404
|
+
context={'field': 'sablier.deferStart', 'sablier': sablier},
|
|
405
|
+
))
|
|
406
|
+
stats['rules_failed'] += 1
|
|
407
|
+
else:
|
|
408
|
+
stats['rules_passed'] += 1
|
|
409
|
+
|
|
410
|
+
# Backend should have Traefik config
|
|
411
|
+
if app_type == 'backend':
|
|
412
|
+
stats['fields_checked'] += 1
|
|
413
|
+
|
|
414
|
+
if not manifest.get('traefik'):
|
|
415
|
+
warnings.append(ManifestErrors.new(
|
|
416
|
+
message="Backend resource should have Traefik configuration for routing",
|
|
417
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
418
|
+
severity=ManifestErrors.SEVERITY['WARNING'],
|
|
419
|
+
context={'field': 'traefik', 'appType': 'backend'},
|
|
420
|
+
))
|
|
421
|
+
else:
|
|
422
|
+
stats['rules_passed'] += 1
|
|
423
|
+
|
|
424
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
425
|
+
|
|
426
|
+
def _validate_cross_resource(manifest, context):
|
|
427
|
+
"""
|
|
428
|
+
Level 4: Cross-Resource Validation
|
|
429
|
+
- dependsOn exist as resources
|
|
430
|
+
- No circular dependencies
|
|
431
|
+
- Backend references are valid
|
|
432
|
+
- Port uniqueness across resources
|
|
433
|
+
"""
|
|
434
|
+
errors = []
|
|
435
|
+
warnings = []
|
|
436
|
+
stats = {'fields_checked': 0, 'rules_passed': 0, 'rules_failed': 0}
|
|
437
|
+
|
|
438
|
+
all_manifests = context.get('all_manifests', [])
|
|
439
|
+
resource_path = context.get('resource_path', '')
|
|
440
|
+
|
|
441
|
+
if not all_manifests:
|
|
442
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
443
|
+
|
|
444
|
+
# Build lookup maps
|
|
445
|
+
app_names = {}
|
|
446
|
+
ports = {}
|
|
447
|
+
|
|
448
|
+
for m in all_manifests:
|
|
449
|
+
name = m.get('appName', '')
|
|
450
|
+
if name:
|
|
451
|
+
app_names[name] = m
|
|
452
|
+
|
|
453
|
+
port = m.get('port')
|
|
454
|
+
if port:
|
|
455
|
+
if port not in ports:
|
|
456
|
+
ports[port] = []
|
|
457
|
+
ports[port].append(name)
|
|
458
|
+
|
|
459
|
+
current_name = manifest.get('appName', '')
|
|
460
|
+
current_port = manifest.get('port')
|
|
461
|
+
|
|
462
|
+
# Check dependsOn exist
|
|
463
|
+
internal_deps = manifest.get('dependsOn', [])
|
|
464
|
+
if internal_deps:
|
|
465
|
+
stats['fields_checked'] += 1
|
|
466
|
+
|
|
467
|
+
missing_deps = []
|
|
468
|
+
for dep in internal_deps:
|
|
469
|
+
# Shared platform Postgres aliases are not app services.
|
|
470
|
+
if is_shared_platform_postgres_dependency(dep):
|
|
471
|
+
continue
|
|
472
|
+
if dep not in app_names:
|
|
473
|
+
missing_deps.append(dep)
|
|
474
|
+
|
|
475
|
+
if missing_deps:
|
|
476
|
+
errors.append(ManifestErrors.new(
|
|
477
|
+
message="Missing resource dependencies: {}".format(', '.join(missing_deps)),
|
|
478
|
+
category=ManifestErrors.CATEGORY['DEPENDENCY'],
|
|
479
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
480
|
+
context={'field': 'dependsOn', 'missing': missing_deps},
|
|
481
|
+
))
|
|
482
|
+
stats['rules_failed'] += 1
|
|
483
|
+
else:
|
|
484
|
+
stats['rules_passed'] += 1
|
|
485
|
+
|
|
486
|
+
# Check backendName exists (for frontends)
|
|
487
|
+
if manifest.get('appType') == 'frontend':
|
|
488
|
+
backend_name = manifest.get('backendName', '')
|
|
489
|
+
if backend_name:
|
|
490
|
+
stats['fields_checked'] += 1
|
|
491
|
+
|
|
492
|
+
if backend_name not in app_names:
|
|
493
|
+
errors.append(ManifestErrors.new(
|
|
494
|
+
message="Referenced backend '{}' does not exist".format(backend_name),
|
|
495
|
+
category=ManifestErrors.CATEGORY['DEPENDENCY'],
|
|
496
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
497
|
+
context={'field': 'backendName', 'value': backend_name},
|
|
498
|
+
))
|
|
499
|
+
stats['rules_failed'] += 1
|
|
500
|
+
else:
|
|
501
|
+
# Check that backend is actually a backend
|
|
502
|
+
backend_manifest = app_names[backend_name]
|
|
503
|
+
if backend_manifest.get('appType') != 'backend':
|
|
504
|
+
errors.append(ManifestErrors.new(
|
|
505
|
+
message="Referenced backend '{}' is not a backend (type: {})".format(
|
|
506
|
+
backend_name, backend_manifest.get('appType')
|
|
507
|
+
),
|
|
508
|
+
category=ManifestErrors.CATEGORY['DEPENDENCY'],
|
|
509
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
510
|
+
context={'field': 'backendName', 'value': backend_name},
|
|
511
|
+
))
|
|
512
|
+
stats['rules_failed'] += 1
|
|
513
|
+
else:
|
|
514
|
+
stats['rules_passed'] += 1
|
|
515
|
+
|
|
516
|
+
# Check port uniqueness
|
|
517
|
+
if current_port and current_port in ports:
|
|
518
|
+
resources_with_port = ports[current_port]
|
|
519
|
+
other_resources = [r for r in resources_with_port if r != current_name]
|
|
520
|
+
|
|
521
|
+
if other_resources:
|
|
522
|
+
stats['fields_checked'] += 1
|
|
523
|
+
|
|
524
|
+
errors.append(ManifestErrors.new(
|
|
525
|
+
message="Port {} is already used by: {}".format(current_port, ', '.join(other_resources)),
|
|
526
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
527
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
528
|
+
context={'field': 'port', 'value': current_port, 'conflicts': other_resources},
|
|
529
|
+
))
|
|
530
|
+
stats['rules_failed'] += 1
|
|
531
|
+
else:
|
|
532
|
+
stats['rules_passed'] += 1
|
|
533
|
+
|
|
534
|
+
return struct(errors=errors, warnings=warnings, stats=stats)
|
|
535
|
+
|
|
536
|
+
def _check_field_type(field_name, value, expected_type, field_schema):
|
|
537
|
+
"""Check if value matches expected type."""
|
|
538
|
+
if expected_type == 'string':
|
|
539
|
+
return type(value) == "string"
|
|
540
|
+
elif expected_type == 'integer':
|
|
541
|
+
return type(value) == "int"
|
|
542
|
+
elif expected_type == 'boolean':
|
|
543
|
+
return type(value) == "bool"
|
|
544
|
+
elif expected_type == 'list':
|
|
545
|
+
return type(value) == "list"
|
|
546
|
+
elif expected_type == 'dict':
|
|
547
|
+
return type(value) == "dict"
|
|
548
|
+
elif expected_type == 'enum':
|
|
549
|
+
valid_values = field_schema.get('constraints', {}).get('values', [])
|
|
550
|
+
return value in valid_values
|
|
551
|
+
return True
|
|
552
|
+
|
|
553
|
+
def _check_constraints(field_name, value, constraints):
|
|
554
|
+
"""Check value against constraints."""
|
|
555
|
+
# Check pattern
|
|
556
|
+
if 'pattern' in constraints:
|
|
557
|
+
pattern = constraints['pattern']
|
|
558
|
+
if not _matches_pattern(value, pattern):
|
|
559
|
+
return ManifestErrors.new(
|
|
560
|
+
message="Field {} value does not match pattern: {}".format(field_name, pattern),
|
|
561
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
562
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
563
|
+
context={'field': field_name, 'value': value, 'pattern': pattern},
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
# Check length (for strings and lists)
|
|
567
|
+
if 'min_length' in constraints:
|
|
568
|
+
if len(value) < constraints['min_length']:
|
|
569
|
+
return ManifestErrors.new(
|
|
570
|
+
message="Field {} value too short (min {}): {}".format(
|
|
571
|
+
field_name, constraints['min_length'], len(value)
|
|
572
|
+
),
|
|
573
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
574
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
575
|
+
context={'field': field_name, 'value': value, 'min_length': constraints['min_length']},
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
if 'max_length' in constraints:
|
|
579
|
+
if len(value) > constraints['max_length']:
|
|
580
|
+
return ManifestErrors.new(
|
|
581
|
+
message="Field {} value too long (max {}): {}".format(
|
|
582
|
+
field_name, constraints['max_length'], len(value)
|
|
583
|
+
),
|
|
584
|
+
category=ManifestErrors.CATEGORY['VALIDATION'],
|
|
585
|
+
severity=ManifestErrors.SEVERITY['ERROR'],
|
|
586
|
+
context={'field': field_name, 'value': value, 'max_length': constraints['max_length']},
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
return None
|
|
590
|
+
|
|
591
|
+
def _chars(text):
|
|
592
|
+
"""Split a string into one-character strings; Tilt's Starlark cannot iterate a string directly."""
|
|
593
|
+
return [text[i] for i in range(len(text))]
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
def _matches_pattern(value, pattern):
|
|
597
|
+
"""Simple pattern matching (Starlark doesn't have regex)."""
|
|
598
|
+
# For now, do basic checks
|
|
599
|
+
if pattern == r'^[a-z][a-z0-9-]*$':
|
|
600
|
+
# Kebab-case: starts with letter, then letters/digits/hyphens
|
|
601
|
+
if not value:
|
|
602
|
+
return False
|
|
603
|
+
if not (value[0] >= 'a' and value[0] <= 'z'):
|
|
604
|
+
return False
|
|
605
|
+
for c in _chars(value):
|
|
606
|
+
if not ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or c == '-'):
|
|
607
|
+
return False
|
|
608
|
+
return True
|
|
609
|
+
|
|
610
|
+
if pattern == r'^[a-z][a-z0-9_]*$':
|
|
611
|
+
# Snake-case for database names
|
|
612
|
+
if not value:
|
|
613
|
+
return False
|
|
614
|
+
if not (value[0] >= 'a' and value[0] <= 'z'):
|
|
615
|
+
return False
|
|
616
|
+
for c in _chars(value):
|
|
617
|
+
if not ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or c == '_'):
|
|
618
|
+
return False
|
|
619
|
+
return True
|
|
620
|
+
|
|
621
|
+
if pattern == r'^/[a-z][a-z0-9/-]*$':
|
|
622
|
+
# Path prefix: starts with /, then letters/digits/hyphens/slashes
|
|
623
|
+
if not value or value[0] != '/':
|
|
624
|
+
return False
|
|
625
|
+
for c in _chars(value[1:]):
|
|
626
|
+
if not ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or c == '-' or c == '/'):
|
|
627
|
+
return False
|
|
628
|
+
return True
|
|
629
|
+
|
|
630
|
+
# Default: accept
|
|
631
|
+
return True
|
|
632
|
+
|
|
633
|
+
def is_valid(manifest, context=None):
|
|
634
|
+
"""
|
|
635
|
+
Quick check if manifest is valid.
|
|
636
|
+
|
|
637
|
+
Args:
|
|
638
|
+
manifest: Manifest dict to check
|
|
639
|
+
context: Optional context for validation
|
|
640
|
+
|
|
641
|
+
Returns:
|
|
642
|
+
True if valid (no critical errors)
|
|
643
|
+
"""
|
|
644
|
+
result = validate(manifest, context, level='all')
|
|
645
|
+
return result.valid
|
|
646
|
+
|
|
647
|
+
def get_validation_report(manifest, context=None):
|
|
648
|
+
"""
|
|
649
|
+
Generate detailed validation report.
|
|
650
|
+
|
|
651
|
+
Args:
|
|
652
|
+
manifest: Manifest dict to validate
|
|
653
|
+
context: Optional context for validation
|
|
654
|
+
|
|
655
|
+
Returns:
|
|
656
|
+
Human-readable report string
|
|
657
|
+
"""
|
|
658
|
+
result = validate(manifest, context, level='all')
|
|
659
|
+
|
|
660
|
+
lines = []
|
|
661
|
+
lines.append("=" * 70)
|
|
662
|
+
lines.append("📋 MANIFEST VALIDATION REPORT")
|
|
663
|
+
lines.append("=" * 70)
|
|
664
|
+
|
|
665
|
+
# Summary
|
|
666
|
+
status = "✅ PASSED" if result.valid else "❌ FAILED"
|
|
667
|
+
lines.append("Status: " + status)
|
|
668
|
+
lines.append("")
|
|
669
|
+
|
|
670
|
+
# Statistics
|
|
671
|
+
lines.append("Fields Checked: {}".format(result.stats['fields_checked']))
|
|
672
|
+
lines.append("Rules Passed: {}".format(result.stats['rules_passed']))
|
|
673
|
+
lines.append("Rules Failed: {}".format(result.stats['rules_failed']))
|
|
674
|
+
lines.append("")
|
|
675
|
+
|
|
676
|
+
# Errors
|
|
677
|
+
if result.errors:
|
|
678
|
+
lines.append("ERRORS ({}):".format(len(result.errors)))
|
|
679
|
+
for error in result.errors:
|
|
680
|
+
formatted = ManifestErrors.format(error)
|
|
681
|
+
lines.append(" - " + formatted)
|
|
682
|
+
lines.append("")
|
|
683
|
+
|
|
684
|
+
# Warnings
|
|
685
|
+
if result.warnings:
|
|
686
|
+
lines.append("WARNINGS ({}):".format(len(result.warnings)))
|
|
687
|
+
for warning in result.warnings:
|
|
688
|
+
formatted = ManifestErrors.format(warning)
|
|
689
|
+
lines.append(" - " + formatted)
|
|
690
|
+
lines.append("")
|
|
691
|
+
|
|
692
|
+
lines.append("=" * 70)
|
|
693
|
+
|
|
694
|
+
return "\n".join(lines)
|
|
695
|
+
|
|
696
|
+
def validate_schema(manifest):
|
|
697
|
+
"""
|
|
698
|
+
Quick schema-only validation.
|
|
699
|
+
|
|
700
|
+
Args:
|
|
701
|
+
manifest: Manifest dict
|
|
702
|
+
|
|
703
|
+
Returns:
|
|
704
|
+
Validation result struct
|
|
705
|
+
"""
|
|
706
|
+
return validate(manifest, level='schema')
|
|
707
|
+
|
|
708
|
+
def validate_values(manifest):
|
|
709
|
+
"""
|
|
710
|
+
Quick values-only validation.
|
|
711
|
+
|
|
712
|
+
Args:
|
|
713
|
+
manifest: Manifest dict
|
|
714
|
+
|
|
715
|
+
Returns:
|
|
716
|
+
Validation result struct
|
|
717
|
+
"""
|
|
718
|
+
return validate(manifest, level='values')
|
|
719
|
+
|
|
720
|
+
def validate_dependencies(manifest, all_manifests):
|
|
721
|
+
"""
|
|
722
|
+
Validate dependencies against all resources.
|
|
723
|
+
|
|
724
|
+
Args:
|
|
725
|
+
manifest: Manifest to validate
|
|
726
|
+
all_manifests: List of all manifests for reference
|
|
727
|
+
|
|
728
|
+
Returns:
|
|
729
|
+
Validation result struct
|
|
730
|
+
"""
|
|
731
|
+
context = {'all_manifests': all_manifests}
|
|
732
|
+
return validate(manifest, context, level='cross_resource')
|
|
733
|
+
|
|
734
|
+
# Export validator functions
|
|
735
|
+
ManifestValidator = struct(
|
|
736
|
+
validate=validate,
|
|
737
|
+
is_valid=is_valid,
|
|
738
|
+
get_report=get_validation_report,
|
|
739
|
+
validate_schema=validate_schema,
|
|
740
|
+
validate_values=validate_values,
|
|
741
|
+
validate_dependencies=validate_dependencies,
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
VALIDATION = {}
|