@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,221 @@
|
|
|
1
|
+
# Tilt IDE Components
|
|
2
|
+
|
|
3
|
+
Web-based IDE features integrated into the Flisk Landscape Tilt development environment.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Tilt IDE provides browser-based tools for browsing, viewing, and executing code without leaving the Tilt UI.
|
|
8
|
+
|
|
9
|
+
| Component | Port | Traefik URL | Direct URL |
|
|
10
|
+
|-----------|------|-------------|------------|
|
|
11
|
+
| **File Browser** | 9765 | http://files.localhost | http://localhost:9765 |
|
|
12
|
+
| **Code Viewer** | 9766 | http://viewer.localhost | http://localhost:9766 |
|
|
13
|
+
| **Config Inspector** | 9767 | http://configs.localhost | http://localhost:9767 |
|
|
14
|
+
| **Code Executor** | 9768 | http://terminal.localhost | http://localhost:9768 |
|
|
15
|
+
|
|
16
|
+
> **Note:** `code_executor` is not shipped in the npm package or started by `tilt up` (see #826). Its source stays in the repository.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
All components start automatically when you run `tilt up`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Start Tilt (IDE components auto-start)
|
|
24
|
+
tilt up
|
|
25
|
+
|
|
26
|
+
# Or start with focus
|
|
27
|
+
tilt up --focus staff
|
|
28
|
+
|
|
29
|
+
# IDE components are always available regardless of focus mode
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then open in your browser:
|
|
33
|
+
- 📁 **File Browser**: http://files.localhost (or http://localhost:9765)
|
|
34
|
+
- 👁️ **Code Viewer**: http://viewer.localhost (or http://localhost:9766)
|
|
35
|
+
- ⚙️ **Config Inspector**: http://configs.localhost (or http://localhost:9767)
|
|
36
|
+
- 💻 **Terminal**: http://terminal.localhost (or http://localhost:9768)
|
|
37
|
+
|
|
38
|
+
## Components
|
|
39
|
+
|
|
40
|
+
### File Browser (Port 9765)
|
|
41
|
+
|
|
42
|
+
Browse the entire monorepo filesystem from your browser.
|
|
43
|
+
|
|
44
|
+
**Features:**
|
|
45
|
+
- Directory tree navigation
|
|
46
|
+
- File metadata (size, modified time)
|
|
47
|
+
- File type icons
|
|
48
|
+
- Search across all files
|
|
49
|
+
- Click any file to open in Code Viewer
|
|
50
|
+
|
|
51
|
+
**Usage:**
|
|
52
|
+
1. Navigate to http://files.localhost
|
|
53
|
+
2. Click directories to navigate deeper
|
|
54
|
+
3. Use breadcrumb to go back up
|
|
55
|
+
4. Click files to view in Code Viewer (new tab)
|
|
56
|
+
5. Use search box to find files by name
|
|
57
|
+
|
|
58
|
+
### Code Viewer (Port 9766)
|
|
59
|
+
|
|
60
|
+
View source files with syntax highlighting.
|
|
61
|
+
|
|
62
|
+
**Features:**
|
|
63
|
+
- Syntax highlighting for TypeScript, Starlark, JSON, YAML, Prisma, and more
|
|
64
|
+
- Line numbers
|
|
65
|
+
- Read-only indicator
|
|
66
|
+
- File size and modification info
|
|
67
|
+
|
|
68
|
+
**Usage:**
|
|
69
|
+
1. Open directly: http://viewer.localhost?file=services/product/staff/staff-management-backend/src/index.ts
|
|
70
|
+
2. Or click files from File Browser
|
|
71
|
+
3. Supports files up to 1MB
|
|
72
|
+
|
|
73
|
+
### Config Inspector (Port 9767)
|
|
74
|
+
|
|
75
|
+
Compare master Tilt configurations (.star files) with their auto-generated outputs.
|
|
76
|
+
|
|
77
|
+
**Features:**
|
|
78
|
+
- Browse all .star config files organized by category
|
|
79
|
+
- Side-by-side comparison of master vs generated
|
|
80
|
+
- One-click "Regenerate" action (coming soon)
|
|
81
|
+
|
|
82
|
+
**Usage:**
|
|
83
|
+
1. Navigate to http://configs.localhost
|
|
84
|
+
2. Select a .star file from the sidebar
|
|
85
|
+
3. View master config on left, generated outputs on right
|
|
86
|
+
4. Click "Regenerate" to trigger config regeneration
|
|
87
|
+
|
|
88
|
+
### Code Executor (Port 9768)
|
|
89
|
+
|
|
90
|
+
Execute bun commands from the browser.
|
|
91
|
+
|
|
92
|
+
**Features:**
|
|
93
|
+
- Terminal interface in browser
|
|
94
|
+
- Command history (up/down arrows)
|
|
95
|
+
- Real-time output with color coding
|
|
96
|
+
- Safety restrictions (no rm -rf /)
|
|
97
|
+
- Supports: bun, npm, git, and safe shell commands
|
|
98
|
+
|
|
99
|
+
**Usage:**
|
|
100
|
+
1. Navigate to http://terminal.localhost
|
|
101
|
+
2. Type commands like `bun test`, `ls -la`, `git status`
|
|
102
|
+
3. Press Enter to execute
|
|
103
|
+
4. Use Up/Down arrows to recall previous commands
|
|
104
|
+
|
|
105
|
+
## Architecture
|
|
106
|
+
|
|
107
|
+
Each component is a Python HTTP server:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
.tilt-engine/extensions/ide-components/
|
|
111
|
+
├── file_browser/
|
|
112
|
+
│ └── server.py # Port 9765
|
|
113
|
+
├── code_viewer/
|
|
114
|
+
│ └── server.py # Port 9766
|
|
115
|
+
├── config_inspector/
|
|
116
|
+
│ └── server.py # Port 9767
|
|
117
|
+
├── code_executor/
|
|
118
|
+
│ └── server.py # Port 9768
|
|
119
|
+
└── shared/
|
|
120
|
+
├── file_utils.py # Safe file operations
|
|
121
|
+
├── templates/
|
|
122
|
+
│ └── base.html # Common HTML template
|
|
123
|
+
└── static/
|
|
124
|
+
└── styles.css # Shared CSS styles
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Key Design Decisions
|
|
128
|
+
|
|
129
|
+
1. **Python (not Bun/Node)**: Avoids circular dependency - IDE works even if Bun has issues
|
|
130
|
+
2. **Separate servers**: Each component is independent, can restart individually
|
|
131
|
+
3. **Read-only viewer**: Safety first - editing happens in proper IDEs
|
|
132
|
+
4. **localhost only**: Security - not exposed to network
|
|
133
|
+
|
|
134
|
+
## Safety
|
|
135
|
+
|
|
136
|
+
### File Access
|
|
137
|
+
- ✅ Only reads within project root
|
|
138
|
+
- ✅ Blocks path traversal attacks (../etc/passwd)
|
|
139
|
+
- ✅ 1MB file size limit
|
|
140
|
+
- ✅ Hidden files excluded from browser
|
|
141
|
+
|
|
142
|
+
### Command Execution
|
|
143
|
+
- ✅ Only bun, npm, git, and safe shell commands allowed
|
|
144
|
+
- ✅ Blocks: rm -rf /, sudo, su, passwd, etc.
|
|
145
|
+
- ✅ 60-second timeout on commands
|
|
146
|
+
- ✅ Commands run in project directory only
|
|
147
|
+
|
|
148
|
+
## Troubleshooting
|
|
149
|
+
|
|
150
|
+
### Port Already in Use
|
|
151
|
+
|
|
152
|
+
If you see "Address already in use":
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Find what's using the port
|
|
156
|
+
lsof -i :9765 # or 9766, 9767, 9768
|
|
157
|
+
|
|
158
|
+
# Kill the process
|
|
159
|
+
kill -9 <PID>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Components Not Starting
|
|
163
|
+
|
|
164
|
+
Check the Tilt logs:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# View specific component logs
|
|
168
|
+
tilt logs tilt-file-browser
|
|
169
|
+
tilt logs tilt-code-viewer
|
|
170
|
+
tilt logs tilt-config-inspector
|
|
171
|
+
tilt logs tilt-code-executor
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Python Not Found
|
|
175
|
+
|
|
176
|
+
Ensure Python 3 is installed:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
python3 --version
|
|
180
|
+
|
|
181
|
+
# On macOS (if needed)
|
|
182
|
+
brew install python3
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Future Enhancements
|
|
186
|
+
|
|
187
|
+
- [ ] Service context actions (View Source, Run Tests) in Tilt UI
|
|
188
|
+
- [ ] Regenerate button that actually triggers `tilt trigger`
|
|
189
|
+
- [ ] Dark/light theme toggle
|
|
190
|
+
- [ ] Keyboard shortcuts (Ctrl+K for search)
|
|
191
|
+
- [ ] File type icons (font-based)
|
|
192
|
+
- [ ] Mobile responsiveness
|
|
193
|
+
- [ ] VS Code extension integration
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
To work on IDE components:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Test file browser standalone
|
|
201
|
+
cd .tilt-engine/extensions/ide-components/file_browser
|
|
202
|
+
python3 server.py
|
|
203
|
+
|
|
204
|
+
# Test code viewer standalone
|
|
205
|
+
cd .tilt-engine/extensions/ide-components/code_viewer
|
|
206
|
+
python3 server.py
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Then open http://localhost:9765 (or 9766, etc.) in your browser.
|
|
210
|
+
|
|
211
|
+
## Integration with Alpha Health Dashboard
|
|
212
|
+
|
|
213
|
+
The IDE components work alongside the alpha health dashboard:
|
|
214
|
+
|
|
215
|
+
- **Health Dashboard**: http://localhost:8765/alpha-health-dashboard.html
|
|
216
|
+
- **File Browser**: http://files.localhost
|
|
217
|
+
- **Code Viewer**: http://viewer.localhost
|
|
218
|
+
- **Config Inspector**: http://configs.localhost
|
|
219
|
+
- **Terminal**: http://terminal.localhost
|
|
220
|
+
|
|
221
|
+
All components run independently and can be used simultaneously.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2026 Flisk Landscape contributors
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""
|
|
5
|
+
Tilt IDE Code Viewer
|
|
6
|
+
Serves syntax-highlighted code viewing at http://localhost:9766
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
import sys
|
|
11
|
+
import urllib.parse
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
# Add shared modules
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).parent.parent / 'shared'))
|
|
16
|
+
from file_utils import FileUtils, PROJECT_ROOT
|
|
17
|
+
from http_utils import BaseIDEHandler, run_server
|
|
18
|
+
|
|
19
|
+
PORT = 9766
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CodeViewerHandler(BaseIDEHandler):
|
|
23
|
+
"""HTTP request handler for code viewer"""
|
|
24
|
+
|
|
25
|
+
def simple_highlight(self, code: str, language: str) -> str:
|
|
26
|
+
"""Simple syntax highlighting using regex"""
|
|
27
|
+
# Escape HTML first
|
|
28
|
+
code = self.escape_html(code)
|
|
29
|
+
|
|
30
|
+
# Keywords (common across languages)
|
|
31
|
+
keywords = [
|
|
32
|
+
'import', 'from', 'export', 'default', 'const', 'let', 'var', 'function',
|
|
33
|
+
'class', 'interface', 'type', 'return', 'if', 'else', 'for', 'while',
|
|
34
|
+
'switch', 'case', 'break', 'continue', 'try', 'catch', 'finally', 'async',
|
|
35
|
+
'await', 'new', 'this', 'super', 'extends', 'implements', 'static',
|
|
36
|
+
'public', 'private', 'protected', 'package', 'def', 'load', 'struct',
|
|
37
|
+
'struct', 'load', 'if', 'else', 'for', 'in', 'return', 'def', 'True', 'False',
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
# Highlight keywords
|
|
41
|
+
for kw in keywords:
|
|
42
|
+
pattern = rf'\b({kw})\b'
|
|
43
|
+
code = re.sub(pattern, r'<span class="syntax-keyword">\1</span>', code)
|
|
44
|
+
|
|
45
|
+
# Strings
|
|
46
|
+
code = re.sub(r'(".*?")', r'<span class="syntax-string">\1</span>', code)
|
|
47
|
+
code = re.sub(r"('.*?')", r'<span class="syntax-string">\1</span>', code)
|
|
48
|
+
code = re.sub(r'(`[\s\S]*?`)', r'<span class="syntax-string">\1</span>', code)
|
|
49
|
+
|
|
50
|
+
# Comments
|
|
51
|
+
code = re.sub(r'(//.*$)', r'<span class="syntax-comment">\1</span>', code, flags=re.MULTILINE)
|
|
52
|
+
code = re.sub(r'(#.*$)', r'<span class="syntax-comment">\1</span>', code, flags=re.MULTILINE)
|
|
53
|
+
|
|
54
|
+
# Numbers
|
|
55
|
+
code = re.sub(r'\b(\d+)\b', r'<span class="syntax-number">\1</span>', code)
|
|
56
|
+
|
|
57
|
+
return code
|
|
58
|
+
|
|
59
|
+
def render_code_with_line_numbers(self, code: str, language: str) -> str:
|
|
60
|
+
"""Render code with line numbers"""
|
|
61
|
+
lines = code.split('\n')
|
|
62
|
+
highlighted = self.simple_highlight(code, language)
|
|
63
|
+
highlighted_lines = highlighted.split('\n')
|
|
64
|
+
|
|
65
|
+
html = ['<table style="width:100%; border-collapse: collapse;">']
|
|
66
|
+
html.append('<tr>')
|
|
67
|
+
|
|
68
|
+
# Line numbers column
|
|
69
|
+
html.append('<td class="line-numbers" style="vertical-align: top; padding-right: 1rem; width: 50px;">')
|
|
70
|
+
for i in range(1, len(lines) + 1):
|
|
71
|
+
html.append(f'<div>{i}</div>')
|
|
72
|
+
html.append('</td>')
|
|
73
|
+
|
|
74
|
+
# Code column
|
|
75
|
+
html.append('<td style="vertical-align: top;">')
|
|
76
|
+
html.append('<pre style="margin: 0;"><code>')
|
|
77
|
+
for line in highlighted_lines:
|
|
78
|
+
html.append(f'<div>{line or " "}</div>')
|
|
79
|
+
html.append('</code></pre>')
|
|
80
|
+
html.append('</td>')
|
|
81
|
+
|
|
82
|
+
html.append('</tr>')
|
|
83
|
+
html.append('</table>')
|
|
84
|
+
|
|
85
|
+
return ''.join(html)
|
|
86
|
+
|
|
87
|
+
def _get_template_path(self) -> Path:
|
|
88
|
+
"""Override to use shared template"""
|
|
89
|
+
return Path(__file__).parent.parent / 'shared' / 'templates' / 'base.html'
|
|
90
|
+
|
|
91
|
+
def do_GET(self):
|
|
92
|
+
"""Handle GET requests"""
|
|
93
|
+
import json
|
|
94
|
+
|
|
95
|
+
parsed = urllib.parse.urlparse(self.path)
|
|
96
|
+
path = parsed.path
|
|
97
|
+
query = urllib.parse.parse_qs(parsed.query)
|
|
98
|
+
|
|
99
|
+
# Health check
|
|
100
|
+
if path == '/health':
|
|
101
|
+
self.handle_health_check('code-viewer')
|
|
102
|
+
return
|
|
103
|
+
|
|
104
|
+
# Static files
|
|
105
|
+
if path.startswith('/static/'):
|
|
106
|
+
static_path = Path(__file__).parent.parent / 'shared' / path[1:]
|
|
107
|
+
if static_path.exists():
|
|
108
|
+
with open(static_path, 'r') as f:
|
|
109
|
+
content = f.read()
|
|
110
|
+
self.send_css_response(content)
|
|
111
|
+
else:
|
|
112
|
+
self.send_error_response(404, 'Not found')
|
|
113
|
+
return
|
|
114
|
+
|
|
115
|
+
# View file
|
|
116
|
+
if path == '/view' or path == '/':
|
|
117
|
+
file_path = query.get('file', [''])[0]
|
|
118
|
+
|
|
119
|
+
if not file_path:
|
|
120
|
+
# Show welcome/empty state
|
|
121
|
+
content = '''
|
|
122
|
+
<div class="empty-state">
|
|
123
|
+
<div class="empty-state-icon">👁️</div>
|
|
124
|
+
<h2>Code Viewer</h2>
|
|
125
|
+
<p>Open a file from the <a href="http://localhost:9765">File Browser</a> to view its contents.</p>
|
|
126
|
+
<p class="text-muted">Supports TypeScript, JavaScript, Starlark, JSON, YAML, and more.</p>
|
|
127
|
+
</div>
|
|
128
|
+
'''
|
|
129
|
+
self.send_html_response(self.render_page('Code Viewer', content, icon='👁️'))
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
# Read file
|
|
133
|
+
content, error = FileUtils.read_file_safe(file_path)
|
|
134
|
+
|
|
135
|
+
if error:
|
|
136
|
+
error_content = f'''
|
|
137
|
+
<div class="code-container">
|
|
138
|
+
<div class="code-header">
|
|
139
|
+
<div class="code-header-left">
|
|
140
|
+
<span class="file-path">{self.escape_html(file_path)}</span>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="code-content">
|
|
144
|
+
<div class="empty-state">
|
|
145
|
+
<div class="empty-state-icon">⚠️</div>
|
|
146
|
+
<p>{self.escape_html(error)}</p>
|
|
147
|
+
<p class="text-muted"><a href="http://localhost:9765">← Back to File Browser</a></p>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
'''
|
|
152
|
+
self.send_html_response(self.render_page('Error', error_content, icon='⚠️'), 404)
|
|
153
|
+
return
|
|
154
|
+
|
|
155
|
+
# Get file info
|
|
156
|
+
resolved = FileUtils.validate_path(file_path)
|
|
157
|
+
file_info = FileUtils.get_file_info(resolved) if resolved else {'name': file_path, 'size_str': 'Unknown'}
|
|
158
|
+
|
|
159
|
+
# Determine language
|
|
160
|
+
ext = Path(file_path).suffix.lower()
|
|
161
|
+
language = FileUtils.get_language_from_ext(ext)
|
|
162
|
+
|
|
163
|
+
# Render code
|
|
164
|
+
code_html = self.render_code_with_line_numbers(content, language)
|
|
165
|
+
|
|
166
|
+
page_content = f'''
|
|
167
|
+
<div class="code-container">
|
|
168
|
+
<div class="code-header">
|
|
169
|
+
<div class="code-header-left">
|
|
170
|
+
<span class="file-path">{self.escape_html(file_path)}</span>
|
|
171
|
+
<span class="read-only-badge">👁️ READ-ONLY</span>
|
|
172
|
+
</div>
|
|
173
|
+
<div>
|
|
174
|
+
<span class="text-muted">{file_info['size_str']} • {file_info['modified']}</span>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
<div class="code-content">
|
|
178
|
+
{code_html}
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
<div style="margin-top: 1rem; text-align: center;">
|
|
182
|
+
<a href="http://localhost:9765/browse?path={urllib.parse.quote(str(Path(file_path).parent))}" class="text-muted">← Back to directory</a>
|
|
183
|
+
</div>
|
|
184
|
+
'''
|
|
185
|
+
|
|
186
|
+
self.send_html_response(self.render_page(f"{file_info['name']}", page_content, icon='👁️'))
|
|
187
|
+
return
|
|
188
|
+
|
|
189
|
+
# 404
|
|
190
|
+
self.send_html_response(self.render_page(
|
|
191
|
+
'Not Found',
|
|
192
|
+
'<div class="empty-state"><div class="empty-state-icon">❓</div>Page not found</div>',
|
|
193
|
+
icon='❓'
|
|
194
|
+
), 404)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def main():
|
|
198
|
+
"""Run the code viewer server"""
|
|
199
|
+
run_server(
|
|
200
|
+
CodeViewerHandler,
|
|
201
|
+
PORT,
|
|
202
|
+
'👁️ Tilt IDE Code Viewer',
|
|
203
|
+
'📄 Open files from the file browser to view with syntax highlighting'
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if __name__ == '__main__':
|
|
208
|
+
main()
|