@tdk-landscape/tdk-cli-core 1.3.14 → 1.3.22
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/README.md +3 -3
- package/Tiltfile +144 -0
- package/discovery/AGENTS.md +362 -0
- package/discovery/TILT_DISCOVERY.star +424 -0
- package/discovery/Tiltfile +58 -0
- package/discovery/config.star +258 -0
- package/discovery/constants.star +127 -0
- package/discovery/deterministic.star +211 -0
- package/discovery/discovery_daemon.star +191 -0
- package/discovery/discovery_orchestrator.star +460 -0
- package/discovery/filtering.star +5 -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 +213 -0
- package/discovery/indexing.star +7 -0
- package/discovery/json_manifest_scanner.star +51 -0
- package/discovery/libraries.star +46 -0
- package/discovery/loading.star +23 -0
- package/discovery/manifest/constants.star +104 -0
- package/discovery/manifest/loading.star +386 -0
- package/discovery/manifest/normalize.star +281 -0
- package/discovery/manifest/validation.star +108 -0
- package/discovery/normalization.star +11 -0
- package/discovery/registry.star +544 -0
- package/discovery/resource_snapshot.py +382 -0
- package/discovery/resource_snapshot.star +143 -0
- package/discovery/schemas.star +1 -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 +251 -0
- package/discovery/validation.star +78 -0
- package/discovery/versioning.star +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +11 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +1 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/project.d.ts.map +1 -1
- package/dist/commands/project.js +36 -41
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/resource.d.ts.map +1 -1
- package/dist/commands/resource.js +51 -55
- package/dist/commands/resource.js.map +1 -1
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +22 -24
- package/dist/commands/stack.js.map +1 -1
- package/dist/commands/ui.d.ts.map +1 -1
- package/dist/commands/ui.js +1 -2
- package/dist/commands/ui.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/upgrade.d.ts +8 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +62 -21
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/generator/extension-fetch.d.ts +19 -0
- package/dist/generator/extension-fetch.d.ts.map +1 -1
- package/dist/generator/extension-fetch.js +71 -5
- package/dist/generator/extension-fetch.js.map +1 -1
- package/dist/generator/template-engine.d.ts +1 -0
- package/dist/generator/template-engine.d.ts.map +1 -1
- package/dist/generator/template-engine.js +50 -6
- package/dist/generator/template-engine.js.map +1 -1
- package/dist/utils/command-helpers.d.ts.map +1 -1
- package/dist/utils/command-helpers.js +7 -9
- package/dist/utils/command-helpers.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/project-features.d.ts.map +1 -1
- package/dist/utils/project-features.js +1 -1
- package/dist/utils/project-features.js.map +1 -1
- package/dist/utils/resource-features.d.ts.map +1 -1
- package/dist/utils/resource-features.js +2 -2
- package/dist/utils/resource-features.js.map +1 -1
- package/dist/utils/tar.js +4 -4
- package/dist/utils/tar.js.map +1 -1
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +9 -0
- package/dist/utils/validation.js.map +1 -1
- package/engine/AGENTS.md +705 -0
- package/engine/README.md +29 -0
- package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
- package/engine/Tiltfile +80 -0
- package/engine/assets/docker/golden-layers.Dockerfile +221 -0
- package/engine/assets/scripts/cleanup-completed-migrator-images.sh +37 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +120 -0
- package/engine/assets/scripts/mac-m1-resource-monitor.sh +121 -0
- package/engine/config.star +3 -0
- package/engine/docs/AUTODISCOVERY_TEST.md +182 -0
- package/engine/docs/C4-ARCHITECTURE-operations.md +396 -0
- package/engine/docs/C4-ARCHITECTURE-overview.md +284 -0
- package/engine/docs/C4-ARCHITECTURE.md +17 -0
- package/engine/docs/GOLDEN_IMAGE_INTEGRATION.md +349 -0
- package/engine/docs/MANIFEST_DRIVEN_ARCHITECTURE.md +357 -0
- package/engine/docs/README.md +284 -0
- package/engine/entrypoint.star +97 -0
- package/engine/lifecycle/orchestrator.star +260 -0
- package/engine/paths.star +717 -0
- package/engine/schemas/manifest-schema.json +301 -0
- package/engine/schemas/service-schema.json +301 -0
- package/engine/scripts/README.md +89 -0
- package/engine/scripts/build-and-publish-lib.sh +205 -0
- package/engine/scripts/check-lib-publish.sh +85 -0
- package/engine/scripts/debug-container.sh +258 -0
- package/engine/scripts/generate-manifest.sh +197 -0
- package/engine/spec.master +702 -0
- package/engine/spec.master.example +341 -0
- package/engine/topologies/README.md +34 -0
- package/engine/topologies/platform/docker/AGENTS.md +59 -0
- package/engine/topologies/platform/docker/auth/auth.star +167 -0
- package/engine/topologies/platform/docker/build/golden_image.star +37 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +82 -0
- package/engine/topologies/platform/docker/build/golden_image_constants.star +93 -0
- package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +291 -0
- package/engine/topologies/platform/docker/compose/compose.star +636 -0
- package/engine/topologies/platform/docker/compose/compose_helpers.star +52 -0
- package/engine/topologies/platform/docker/compose/traefik_standalone.star +53 -0
- package/engine/topologies/platform/docker/config/bunignore.star +142 -0
- package/engine/topologies/platform/docker/config/dockerignore.star +150 -0
- package/engine/topologies/platform/docker/constants.star +170 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +54 -0
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +73 -0
- package/engine/topologies/platform/docker/index.star +27 -0
- package/engine/topologies/platform/docker/layers/bun_helpers.star +23 -0
- package/engine/topologies/platform/docker/layers/infisical/index.star +40 -0
- package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +262 -0
- package/engine/topologies/platform/docker/layers/l1_base_layers.star +87 -0
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +125 -0
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +209 -0
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +214 -0
- package/engine/topologies/platform/docker/layers/prisma/constants.star +135 -0
- package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +96 -0
- package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +109 -0
- package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +98 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +126 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +161 -0
- package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +119 -0
- package/engine/topologies/platform/docker/networking/api_path_constants.star +230 -0
- package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +27 -0
- package/engine/topologies/platform/docker/networking/traefik.star +232 -0
- package/engine/topologies/platform/docker/networking/traefik_constants.star +146 -0
- package/engine/topologies/platform/docker/networking/traefik_helpers.star +160 -0
- package/engine/topologies/platform/docker/secrets/infisical.star +135 -0
- package/engine/topologies/platform/net/proxy.star +4 -0
- package/engine/topologies/platform/registries/local.star +4 -0
- package/engine/topologies/platform/security/secrets.star +239 -0
- package/engine/topologies/platform/state/relational.star +4 -0
- package/engine/topologies/tilt/common/AGENTS.md +59 -0
- package/engine/topologies/tilt/common/utils.star +364 -0
- package/engine/topologies/tilt/common/utils_debug.star +69 -0
- package/engine/topologies/tilt/common/utils_deterministic.star +168 -0
- package/engine/topologies/tilt/common/utils_docker_networks.star +46 -0
- package/engine/topologies/tilt/common/utils_env.star +43 -0
- package/engine/topologies/tilt/common/utils_output.star +97 -0
- package/engine/topologies/tilt/config/AGENTS.md +68 -0
- package/engine/topologies/tilt/config/defaults.star +3 -0
- package/engine/topologies/tilt/config/feature_flags.star +10 -0
- package/engine/topologies/tilt/config/global.star +55 -0
- package/engine/topologies/tilt/config/profiles.star +382 -0
- package/engine/topologies/tilt/generators/agents_md.star +62 -0
- package/engine/topologies/tilt/generators/api_gateway.star +145 -0
- package/engine/topologies/tilt/generators/index.star +124 -0
- package/engine/topologies/tilt/generators/infisical/README.md +424 -0
- package/engine/topologies/tilt/generators/infisical/examples.star +312 -0
- package/engine/topologies/tilt/generators/infisical/index.star +57 -0
- package/engine/topologies/tilt/generators/infisical/machine_identity.star +420 -0
- package/engine/topologies/tilt/generators/infisical/organization.star +534 -0
- package/engine/topologies/tilt/generators/infisical/path_manager.star +476 -0
- package/engine/topologies/tilt/generators/infisical/secrets_generator.star +420 -0
- package/engine/topologies/tilt/generators/nginx_conf.star +143 -0
- package/engine/topologies/tilt/generators/npmrc.star +111 -0
- package/engine/topologies/tilt/generators/tsconfig.star +23 -0
- package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +71 -0
- package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +124 -0
- package/engine/topologies/tilt/generators/typescript/common.star +7 -0
- package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +76 -0
- package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +110 -0
- package/engine/topologies/tilt/generators/typescript/include.star +23 -0
- package/engine/topologies/tilt/generators/typescript/playwright_config.star +40 -0
- package/engine/topologies/tilt/generators/typescript/prisma_config.star +49 -0
- package/engine/topologies/tilt/generators/validators.star +853 -0
- package/engine/topologies/tilt/generators/vite/backend.star +78 -0
- package/engine/topologies/tilt/generators/vite/frontend.star +98 -0
- package/engine/topologies/tilt/generators/vite/generators.star +43 -0
- package/engine/topologies/tilt/generators/vite/helpers.star +244 -0
- package/engine/topologies/tilt/generators/vite/library.star +65 -0
- package/engine/topologies/tilt/generators/vite/sdk.star +73 -0
- package/engine/topologies/tilt/generators/vite/templates.star +737 -0
- package/engine/topologies/tilt/generators/vite_config.star +22 -0
- package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
- package/engine/topologies/tilt/manifest/README.md +693 -0
- package/engine/topologies/tilt/manifest/__init__.star +218 -0
- package/engine/topologies/tilt/manifest/constants.star +252 -0
- package/engine/topologies/tilt/manifest/errors.star +266 -0
- package/engine/topologies/tilt/manifest/integration.star +339 -0
- package/engine/topologies/tilt/manifest/json_to_yaml.py +54 -0
- package/engine/topologies/tilt/manifest/loader.star +214 -0
- package/engine/topologies/tilt/manifest/mapper.star +227 -0
- package/engine/topologies/tilt/manifest/parser.star +400 -0
- package/engine/topologies/tilt/manifest/schema.star +462 -0
- package/engine/topologies/tilt/manifest/tests/test_integration.star +276 -0
- package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +397 -0
- package/engine/topologies/tilt/manifest/tests/test_manifest.star +316 -0
- package/engine/topologies/tilt/manifest/tests/test_validator.star +470 -0
- package/engine/topologies/tilt/manifest/validator.star +717 -0
- package/engine/topologies/tilt/manifest/yaml_to_json.py +18 -0
- package/engine/topologies/tilt/resources/AGENTS.md +71 -0
- package/engine/topologies/tilt/resources/conditions.star +3 -0
- package/engine/topologies/tilt/resources/databases.star +244 -0
- package/engine/topologies/tilt/resources/declaration.star +3 -0
- package/engine/topologies/tilt/resources/deps.star +3 -0
- package/engine/topologies/tilt/resources/infra-loader.star +437 -0
- package/engine/topologies/tilt/resources/libs.star +30 -0
- package/engine/topologies/tilt/resources/libs_discovery.star +102 -0
- package/engine/topologies/tilt/resources/libs_paths.star +79 -0
- package/engine/topologies/tilt/resources/libs_resource_definition.star +151 -0
- package/engine/topologies/tilt/resources/libs_setup.star +164 -0
- package/engine/topologies/tilt/resources/libs_tsconfig.star +37 -0
- package/engine/topologies/tilt/resources/orchestrator/apply.star +77 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +431 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +81 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +148 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +36 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +44 -0
- package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +164 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +21 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +134 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/env.star +258 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +169 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +524 -0
- package/engine/topologies/tilt/resources/orchestrator/helpers.star +33 -0
- package/engine/topologies/tilt/resources/orchestrator.star +54 -0
- package/engine/topologies/tilt/resources/ordering.star +3 -0
- package/engine/topologies/tilt/resources/triggers.star +3 -0
- package/engine/topologies/tilt/resources/watchers.star +299 -0
- package/engine/where-things-live.star +717 -0
- package/ext/Tiltfile +66 -0
- package/ext/ide-components/README.md +219 -0
- package/ext/ide-components/code_executor/server.py +268 -0
- package/ext/ide-components/code_viewer/server.py +206 -0
- package/ext/ide-components/config_inspector/server.py +1050 -0
- package/ext/ide-components/file_browser/server.py +285 -0
- package/ext/ide-components/shared/config_service.py +469 -0
- package/ext/ide-components/shared/file_utils.py +298 -0
- package/ext/ide-components/shared/http_utils.py +232 -0
- package/ext/ide-components/shared/static/styles.css +1334 -0
- package/ext/ide-components/shared/syntax_highlighter.py +140 -0
- package/ext/ide-components/shared/template_engine.py +123 -0
- package/ext/ide-components/shared/templates/base.html +121 -0
- package/ext/ide-components/shared/test_config_service.py +326 -0
- package/ext/ide-components/shared/tilt_integration.py +158 -0
- package/ext/ui-enhancements/cron-status-server.sh +49 -0
- package/ext/ui-enhancements/cron-status-tracker.sh +146 -0
- package/ext/ui-enhancements/extension.yaml +36 -0
- package/ext/ui-enhancements/tiltfile.py +99 -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 +13 -9
- package/specs/specs/TILT_SERVICE_DEFAULTS.star +205 -0
- package/specs/specs/TILT_TECH_STACK.star +159 -0
package/ext/Tiltfile
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🎯 TDK-EXT - Extensions and IDE Components
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# This is the Tiltfile entry point for the tdk-ext repo.
|
|
5
|
+
# It exports UI enhancements and IDE components.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# v1alpha1.extension_repo(name='tdk-ext', url='https://github.com/tdk-landscape/tdk-ext')
|
|
9
|
+
# load('ext://tdk-ext', 'get_ide_components_path', ...)
|
|
10
|
+
# =============================================================================
|
|
11
|
+
|
|
12
|
+
# =============================================================================
|
|
13
|
+
# UI ENHANCEMENTS (simplified for repos-only)
|
|
14
|
+
# =============================================================================
|
|
15
|
+
def load_ui_enhancements(config):
|
|
16
|
+
"""
|
|
17
|
+
Load UI enhancements configuration.
|
|
18
|
+
Simplified version for pure extension loading.
|
|
19
|
+
"""
|
|
20
|
+
enable_tooltips = config.get('enable_tooltips', True)
|
|
21
|
+
enable_icons = config.get('enable_icons', True)
|
|
22
|
+
enable_help_panel = config.get('enable_help_panel', True)
|
|
23
|
+
enable_cron_jobs_tab = config.get('enable_cron_jobs_tab', True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
print(" - Tooltips: " + ("enabled" if enable_tooltips else "disabled"))
|
|
27
|
+
print(" - Icons: " + ("enabled" if enable_icons else "disabled"))
|
|
28
|
+
print(" - Help Panel: " + ("enabled" if enable_help_panel else "disabled"))
|
|
29
|
+
print(" - Cron Jobs Tab: " + ("enabled" if enable_cron_jobs_tab else "disabled"))
|
|
30
|
+
|
|
31
|
+
# =============================================================================
|
|
32
|
+
# IDE COMPONENTS PATHS
|
|
33
|
+
# =============================================================================
|
|
34
|
+
|
|
35
|
+
def get_ide_components_path():
|
|
36
|
+
"""Return the path to IDE components."""
|
|
37
|
+
return './ide-components'
|
|
38
|
+
|
|
39
|
+
def get_file_browser_script():
|
|
40
|
+
"""Return the path to file browser server script."""
|
|
41
|
+
return './ide-components/file_browser/server.py'
|
|
42
|
+
|
|
43
|
+
def get_code_viewer_script():
|
|
44
|
+
"""Return the path to code viewer server script."""
|
|
45
|
+
return './ide-components/code_viewer/server.py'
|
|
46
|
+
|
|
47
|
+
def get_config_inspector_script():
|
|
48
|
+
"""Return the path to config inspector server script."""
|
|
49
|
+
return './ide-components/config_inspector/server.py'
|
|
50
|
+
|
|
51
|
+
def get_code_executor_script():
|
|
52
|
+
"""Return the path to code executor server script."""
|
|
53
|
+
return './ide-components/code_executor/server.py'
|
|
54
|
+
|
|
55
|
+
# =============================================================================
|
|
56
|
+
# PORTS
|
|
57
|
+
# =============================================================================
|
|
58
|
+
|
|
59
|
+
IDE_PORTS = {
|
|
60
|
+
'file_browser': 9765,
|
|
61
|
+
'code_viewer': 9766,
|
|
62
|
+
'config_inspector': 9767,
|
|
63
|
+
'code_executor': 9768,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
print("✅ TDK Extensions loaded: UI enhancements and IDE components")
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Tilt IDE Components
|
|
2
|
+
|
|
3
|
+
Web-based IDE features integrated into the TDK 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
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
All components start automatically when you run `tilt up`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Start Tilt (IDE components auto-start)
|
|
22
|
+
tilt up
|
|
23
|
+
|
|
24
|
+
# Or start with focus
|
|
25
|
+
tilt up --focus staff
|
|
26
|
+
|
|
27
|
+
# IDE components are always available regardless of focus mode
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then open in your browser:
|
|
31
|
+
- 📁 **File Browser**: http://files.localhost (or http://localhost:9765)
|
|
32
|
+
- 👁️ **Code Viewer**: http://viewer.localhost (or http://localhost:9766)
|
|
33
|
+
- ⚙️ **Config Inspector**: http://configs.localhost (or http://localhost:9767)
|
|
34
|
+
- 💻 **Terminal**: http://terminal.localhost (or http://localhost:9768)
|
|
35
|
+
|
|
36
|
+
## Components
|
|
37
|
+
|
|
38
|
+
### File Browser (Port 9765)
|
|
39
|
+
|
|
40
|
+
Browse the entire monorepo filesystem from your browser.
|
|
41
|
+
|
|
42
|
+
**Features:**
|
|
43
|
+
- Directory tree navigation
|
|
44
|
+
- File metadata (size, modified time)
|
|
45
|
+
- File type icons
|
|
46
|
+
- Search across all files
|
|
47
|
+
- Click any file to open in Code Viewer
|
|
48
|
+
|
|
49
|
+
**Usage:**
|
|
50
|
+
1. Navigate to http://files.localhost
|
|
51
|
+
2. Click directories to navigate deeper
|
|
52
|
+
3. Use breadcrumb to go back up
|
|
53
|
+
4. Click files to view in Code Viewer (new tab)
|
|
54
|
+
5. Use search box to find files by name
|
|
55
|
+
|
|
56
|
+
### Code Viewer (Port 9766)
|
|
57
|
+
|
|
58
|
+
View source files with syntax highlighting.
|
|
59
|
+
|
|
60
|
+
**Features:**
|
|
61
|
+
- Syntax highlighting for TypeScript, Starlark, JSON, YAML, Prisma, and more
|
|
62
|
+
- Line numbers
|
|
63
|
+
- Read-only indicator
|
|
64
|
+
- File size and modification info
|
|
65
|
+
|
|
66
|
+
**Usage:**
|
|
67
|
+
1. Open directly: http://viewer.localhost?file=services/product/staff/staff-management-backend/src/index.ts
|
|
68
|
+
2. Or click files from File Browser
|
|
69
|
+
3. Supports files up to 1MB
|
|
70
|
+
|
|
71
|
+
### Config Inspector (Port 9767)
|
|
72
|
+
|
|
73
|
+
Compare master Tilt configurations (.star files) with their auto-generated outputs.
|
|
74
|
+
|
|
75
|
+
**Features:**
|
|
76
|
+
- Browse all .star config files organized by category
|
|
77
|
+
- Side-by-side comparison of master vs generated
|
|
78
|
+
- One-click "Regenerate" action (coming soon)
|
|
79
|
+
|
|
80
|
+
**Usage:**
|
|
81
|
+
1. Navigate to http://configs.localhost
|
|
82
|
+
2. Select a .star file from the sidebar
|
|
83
|
+
3. View master config on left, generated outputs on right
|
|
84
|
+
4. Click "Regenerate" to trigger config regeneration
|
|
85
|
+
|
|
86
|
+
### Code Executor (Port 9768)
|
|
87
|
+
|
|
88
|
+
Execute bun commands from the browser.
|
|
89
|
+
|
|
90
|
+
**Features:**
|
|
91
|
+
- Terminal interface in browser
|
|
92
|
+
- Command history (up/down arrows)
|
|
93
|
+
- Real-time output with color coding
|
|
94
|
+
- Safety restrictions (no rm -rf /)
|
|
95
|
+
- Supports: bun, npm, git, and safe shell commands
|
|
96
|
+
|
|
97
|
+
**Usage:**
|
|
98
|
+
1. Navigate to http://terminal.localhost
|
|
99
|
+
2. Type commands like `bun test`, `ls -la`, `git status`
|
|
100
|
+
3. Press Enter to execute
|
|
101
|
+
4. Use Up/Down arrows to recall previous commands
|
|
102
|
+
|
|
103
|
+
## Architecture
|
|
104
|
+
|
|
105
|
+
Each component is a Python HTTP server:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
.tilt-engine/extensions/ide-components/
|
|
109
|
+
├── file_browser/
|
|
110
|
+
│ └── server.py # Port 9765
|
|
111
|
+
├── code_viewer/
|
|
112
|
+
│ └── server.py # Port 9766
|
|
113
|
+
├── config_inspector/
|
|
114
|
+
│ └── server.py # Port 9767
|
|
115
|
+
├── code_executor/
|
|
116
|
+
│ └── server.py # Port 9768
|
|
117
|
+
└── shared/
|
|
118
|
+
├── file_utils.py # Safe file operations
|
|
119
|
+
├── templates/
|
|
120
|
+
│ └── base.html # Common HTML template
|
|
121
|
+
└── static/
|
|
122
|
+
└── styles.css # Shared CSS styles
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Key Design Decisions
|
|
126
|
+
|
|
127
|
+
1. **Python (not Bun/Node)**: Avoids circular dependency - IDE works even if Bun has issues
|
|
128
|
+
2. **Separate servers**: Each component is independent, can restart individually
|
|
129
|
+
3. **Read-only viewer**: Safety first - editing happens in proper IDEs
|
|
130
|
+
4. **localhost only**: Security - not exposed to network
|
|
131
|
+
|
|
132
|
+
## Safety
|
|
133
|
+
|
|
134
|
+
### File Access
|
|
135
|
+
- ✅ Only reads within project root
|
|
136
|
+
- ✅ Blocks path traversal attacks (../etc/passwd)
|
|
137
|
+
- ✅ 1MB file size limit
|
|
138
|
+
- ✅ Hidden files excluded from browser
|
|
139
|
+
|
|
140
|
+
### Command Execution
|
|
141
|
+
- ✅ Only bun, npm, git, and safe shell commands allowed
|
|
142
|
+
- ✅ Blocks: rm -rf /, sudo, su, passwd, etc.
|
|
143
|
+
- ✅ 60-second timeout on commands
|
|
144
|
+
- ✅ Commands run in project directory only
|
|
145
|
+
|
|
146
|
+
## Troubleshooting
|
|
147
|
+
|
|
148
|
+
### Port Already in Use
|
|
149
|
+
|
|
150
|
+
If you see "Address already in use":
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Find what's using the port
|
|
154
|
+
lsof -i :9765 # or 9766, 9767, 9768
|
|
155
|
+
|
|
156
|
+
# Kill the process
|
|
157
|
+
kill -9 <PID>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Components Not Starting
|
|
161
|
+
|
|
162
|
+
Check the Tilt logs:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# View specific component logs
|
|
166
|
+
tilt logs tilt-file-browser
|
|
167
|
+
tilt logs tilt-code-viewer
|
|
168
|
+
tilt logs tilt-config-inspector
|
|
169
|
+
tilt logs tilt-code-executor
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Python Not Found
|
|
173
|
+
|
|
174
|
+
Ensure Python 3 is installed:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
python3 --version
|
|
178
|
+
|
|
179
|
+
# On macOS (if needed)
|
|
180
|
+
brew install python3
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Future Enhancements
|
|
184
|
+
|
|
185
|
+
- [ ] Service context actions (View Source, Run Tests) in Tilt UI
|
|
186
|
+
- [ ] Regenerate button that actually triggers `tilt trigger`
|
|
187
|
+
- [ ] Dark/light theme toggle
|
|
188
|
+
- [ ] Keyboard shortcuts (Ctrl+K for search)
|
|
189
|
+
- [ ] File type icons (font-based)
|
|
190
|
+
- [ ] Mobile responsiveness
|
|
191
|
+
- [ ] VS Code extension integration
|
|
192
|
+
|
|
193
|
+
## Development
|
|
194
|
+
|
|
195
|
+
To work on IDE components:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Test file browser standalone
|
|
199
|
+
cd .tilt-engine/extensions/ide-components/file_browser
|
|
200
|
+
python3 server.py
|
|
201
|
+
|
|
202
|
+
# Test code viewer standalone
|
|
203
|
+
cd .tilt-engine/extensions/ide-components/code_viewer
|
|
204
|
+
python3 server.py
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Then open http://localhost:9765 (or 9766, etc.) in your browser.
|
|
208
|
+
|
|
209
|
+
## Integration with Alpha Health Dashboard
|
|
210
|
+
|
|
211
|
+
The IDE components work alongside the alpha health dashboard:
|
|
212
|
+
|
|
213
|
+
- **Health Dashboard**: http://localhost:8765/alpha-health-dashboard.html
|
|
214
|
+
- **File Browser**: http://files.localhost
|
|
215
|
+
- **Code Viewer**: http://viewer.localhost
|
|
216
|
+
- **Config Inspector**: http://configs.localhost
|
|
217
|
+
- **Terminal**: http://terminal.localhost
|
|
218
|
+
|
|
219
|
+
All components run independently and can be used simultaneously.
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Tilt IDE Code Executor
|
|
4
|
+
Execute commands from web UI at http://localhost:9768
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import subprocess
|
|
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 PROJECT_ROOT
|
|
17
|
+
from http_utils import BaseIDEHandler, run_server
|
|
18
|
+
|
|
19
|
+
PORT = 9768
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CodeExecutorHandler(BaseIDEHandler):
|
|
23
|
+
"""HTTP request handler for code executor"""
|
|
24
|
+
|
|
25
|
+
# Command validation constants
|
|
26
|
+
DANGEROUS_COMMANDS = [
|
|
27
|
+
'rm -rf /', 'rm -rf /*', ':(){ :|:& };:', '> /dev/sda',
|
|
28
|
+
'mv / /dev/null', 'dd if=/dev/zero', 'mkfs.', 'chmod -R 777 /',
|
|
29
|
+
'sudo', 'su -', 'passwd', 'deluser', 'userdel'
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
ALLOWED_PREFIXES = [
|
|
33
|
+
'bun ', 'ls ', 'pwd', 'echo ', 'cat ', 'head ', 'tail ',
|
|
34
|
+
'grep ', 'find ', 'cd ', 'mkdir ', 'touch ', 'clear', 'exit',
|
|
35
|
+
'npm ', 'yarn ', 'npx ', 'pnpm ', 'git ', 'curl ', 'wget '
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
def validate_command(self, cmd: str) -> tuple:
|
|
39
|
+
"""
|
|
40
|
+
Validate command for safety.
|
|
41
|
+
Returns (is_valid, error_message)
|
|
42
|
+
"""
|
|
43
|
+
# Block dangerous commands
|
|
44
|
+
for dangerous in self.DANGEROUS_COMMANDS:
|
|
45
|
+
if dangerous in cmd.lower():
|
|
46
|
+
return False, f"Command blocked for safety: {dangerous}"
|
|
47
|
+
|
|
48
|
+
# Only allow bun commands and safe system commands
|
|
49
|
+
cmd_stripped = cmd.strip()
|
|
50
|
+
is_allowed = any(cmd_stripped.startswith(prefix) for prefix in self.ALLOWED_PREFIXES)
|
|
51
|
+
|
|
52
|
+
if not is_allowed:
|
|
53
|
+
return False, "Only bun, npm, git, and safe system commands are allowed"
|
|
54
|
+
|
|
55
|
+
return True, None
|
|
56
|
+
|
|
57
|
+
def execute_command(self, cmd: str, cwd: str = None) -> dict:
|
|
58
|
+
"""Execute command and return result"""
|
|
59
|
+
# Validate
|
|
60
|
+
is_valid, error = self.validate_command(cmd)
|
|
61
|
+
if not is_valid:
|
|
62
|
+
return {'success': False, 'stdout': '', 'stderr': error, 'exit_code': 1}
|
|
63
|
+
|
|
64
|
+
# Determine working directory
|
|
65
|
+
work_dir = cwd or str(PROJECT_ROOT)
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
# Execute with timeout
|
|
69
|
+
result = subprocess.run(
|
|
70
|
+
cmd,
|
|
71
|
+
shell=True,
|
|
72
|
+
cwd=work_dir,
|
|
73
|
+
capture_output=True,
|
|
74
|
+
text=True,
|
|
75
|
+
timeout=60, # 60 second timeout
|
|
76
|
+
env={**os.environ, 'TERM': 'xterm-color'}
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
'success': result.returncode == 0,
|
|
81
|
+
'stdout': result.stdout,
|
|
82
|
+
'stderr': result.stderr,
|
|
83
|
+
'exit_code': result.returncode
|
|
84
|
+
}
|
|
85
|
+
except subprocess.TimeoutExpired:
|
|
86
|
+
return {'success': False, 'stdout': '', 'stderr': 'Command timed out (60s limit)', 'exit_code': -1}
|
|
87
|
+
except Exception as e:
|
|
88
|
+
return {'success': False, 'stdout': '', 'stderr': str(e), 'exit_code': -1}
|
|
89
|
+
|
|
90
|
+
def _get_template_path(self) -> Path:
|
|
91
|
+
"""Override to use shared template"""
|
|
92
|
+
return Path(__file__).parent.parent / 'shared' / 'templates' / 'base.html'
|
|
93
|
+
|
|
94
|
+
def do_GET(self):
|
|
95
|
+
"""Handle GET requests"""
|
|
96
|
+
parsed = urllib.parse.urlparse(self.path)
|
|
97
|
+
path = parsed.path
|
|
98
|
+
query = urllib.parse.parse_qs(parsed.query)
|
|
99
|
+
|
|
100
|
+
# Health check
|
|
101
|
+
if path == '/health':
|
|
102
|
+
self.handle_health_check('code-executor')
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
# Static files
|
|
106
|
+
if path.startswith('/static/'):
|
|
107
|
+
static_path = Path(__file__).parent.parent / 'shared' / path[1:]
|
|
108
|
+
if static_path.exists():
|
|
109
|
+
with open(static_path, 'r') as f:
|
|
110
|
+
content = f.read()
|
|
111
|
+
self.send_css_response(content)
|
|
112
|
+
else:
|
|
113
|
+
self.send_error_response(404, 'Not found')
|
|
114
|
+
return
|
|
115
|
+
|
|
116
|
+
if path in ('/', '/terminal'):
|
|
117
|
+
cwd = query.get('cwd', [str(PROJECT_ROOT)])[0]
|
|
118
|
+
cwd_display = self.escape_html(cwd.replace(str(PROJECT_ROOT), '~'))
|
|
119
|
+
|
|
120
|
+
content = f'''
|
|
121
|
+
<div class="terminal" style="height: calc(100vh - 200px);">
|
|
122
|
+
<div class="terminal-header">
|
|
123
|
+
<div>
|
|
124
|
+
<span class="panel-title">💻 Terminal</span>
|
|
125
|
+
<span class="text-muted" style="margin-left: 1rem; font-size: 0.85rem;">Working directory: {cwd_display}</span>
|
|
126
|
+
</div>
|
|
127
|
+
<div>
|
|
128
|
+
<span class="text-muted" style="font-size: 0.8rem;">Supports: bun, npm, git, basic shell</span>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
<div class="terminal-content" id="terminal-output" style="white-space: pre-wrap; font-family: var(--font-mono);">
|
|
132
|
+
<div class="text-muted">TDK Landscape Tilt IDE Terminal</div>
|
|
133
|
+
<div class="text-muted">Type a command and press Enter to execute</div>
|
|
134
|
+
<div class="text-muted">─────────────────────────────────────────</div>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="terminal-input-line">
|
|
137
|
+
<span class="terminal-prompt">$</span>
|
|
138
|
+
<input type="text" id="terminal-input" class="terminal-input"
|
|
139
|
+
placeholder="Enter command (e.g., bun test, ls -la)..."
|
|
140
|
+
autocomplete="off" spellcheck="false">
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<script>
|
|
145
|
+
const terminalOutput = document.getElementById('terminal-output');
|
|
146
|
+
const terminalInput = document.getElementById('terminal-input');
|
|
147
|
+
const cwd = {json.dumps(cwd)};
|
|
148
|
+
let commandHistory = [];
|
|
149
|
+
let historyIndex = -1;
|
|
150
|
+
|
|
151
|
+
terminalInput.addEventListener('keydown', async function(e) {{
|
|
152
|
+
if (e.key === 'Enter') {{
|
|
153
|
+
const cmd = this.value.trim();
|
|
154
|
+
if (!cmd) return;
|
|
155
|
+
|
|
156
|
+
// Add to history
|
|
157
|
+
commandHistory.push(cmd);
|
|
158
|
+
historyIndex = commandHistory.length;
|
|
159
|
+
|
|
160
|
+
// Display command
|
|
161
|
+
terminalOutput.innerHTML += `<div><span style="color: var(--accent-primary);">$</span> ${{self.escape_html(cmd)}}</div>`;
|
|
162
|
+
terminalInput.value = '';
|
|
163
|
+
|
|
164
|
+
// Execute
|
|
165
|
+
try {{
|
|
166
|
+
const response = await fetch('/execute', {{
|
|
167
|
+
method: 'POST',
|
|
168
|
+
headers: {{'Content-Type': 'application/json'}},
|
|
169
|
+
body: JSON.stringify({{command: cmd, cwd: cwd}})
|
|
170
|
+
}});
|
|
171
|
+
const result = await response.json();
|
|
172
|
+
|
|
173
|
+
// Display output
|
|
174
|
+
if (result.stdout) {{
|
|
175
|
+
terminalOutput.innerHTML += `<div style="color: var(--text-primary);">${{self.escape_html(result.stdout)}}</div>`;
|
|
176
|
+
}}
|
|
177
|
+
if (result.stderr) {{
|
|
178
|
+
terminalOutput.innerHTML += `<div style="color: var(--error);">${{self.escape_html(result.stderr)}}</div>`;
|
|
179
|
+
}}
|
|
180
|
+
|
|
181
|
+
// Status
|
|
182
|
+
const statusColor = result.success ? 'var(--success)' : 'var(--error)';
|
|
183
|
+
terminalOutput.innerHTML += `<div style="color: ${{statusColor}}; font-size: 0.8rem;">Exit code: ${{result.exit_code}}</div>`;
|
|
184
|
+
|
|
185
|
+
}} catch (err) {{
|
|
186
|
+
terminalOutput.innerHTML += `<div style="color: var(--error);">Error: ${{err.message}}</div>`;
|
|
187
|
+
}}
|
|
188
|
+
|
|
189
|
+
// Scroll to bottom
|
|
190
|
+
terminalOutput.scrollTop = terminalOutput.scrollHeight;
|
|
191
|
+
}}
|
|
192
|
+
|
|
193
|
+
// History navigation
|
|
194
|
+
if (e.key === 'ArrowUp') {{
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
if (historyIndex > 0) {{
|
|
197
|
+
historyIndex--;
|
|
198
|
+
terminalInput.value = commandHistory[historyIndex];
|
|
199
|
+
}}
|
|
200
|
+
}}
|
|
201
|
+
if (e.key === 'ArrowDown') {{
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
if (historyIndex < commandHistory.length - 1) {{
|
|
204
|
+
historyIndex++;
|
|
205
|
+
terminalInput.value = commandHistory[historyIndex];
|
|
206
|
+
}} else {{
|
|
207
|
+
historyIndex = commandHistory.length;
|
|
208
|
+
terminalInput.value = '';
|
|
209
|
+
}}
|
|
210
|
+
}}
|
|
211
|
+
}});
|
|
212
|
+
|
|
213
|
+
terminalInput.focus();
|
|
214
|
+
</script>
|
|
215
|
+
'''
|
|
216
|
+
|
|
217
|
+
self.send_html_response(self.render_page('Terminal', content, icon='💻'))
|
|
218
|
+
return
|
|
219
|
+
|
|
220
|
+
# 404
|
|
221
|
+
self.send_html_response(self.render_page(
|
|
222
|
+
'Not Found',
|
|
223
|
+
'<div class="empty-state"><div class="empty-state-icon">❓</div>Page not found</div>',
|
|
224
|
+
icon='❓'
|
|
225
|
+
), 404)
|
|
226
|
+
|
|
227
|
+
def do_POST(self):
|
|
228
|
+
"""Handle POST requests"""
|
|
229
|
+
parsed = urllib.parse.urlparse(self.path)
|
|
230
|
+
|
|
231
|
+
if parsed.path == '/execute':
|
|
232
|
+
# Read request body
|
|
233
|
+
content_length = int(self.headers.get('Content-Length', 0))
|
|
234
|
+
body = self.rfile.read(content_length).decode()
|
|
235
|
+
|
|
236
|
+
try:
|
|
237
|
+
data = json.loads(body)
|
|
238
|
+
cmd = data.get('command', '').strip()
|
|
239
|
+
cwd = data.get('cwd', str(PROJECT_ROOT))
|
|
240
|
+
|
|
241
|
+
if not cmd:
|
|
242
|
+
self.send_json_response({'success': False, 'error': 'No command provided'}, 400)
|
|
243
|
+
return
|
|
244
|
+
|
|
245
|
+
result = self.execute_command(cmd, cwd)
|
|
246
|
+
self.send_json_response(result)
|
|
247
|
+
|
|
248
|
+
except json.JSONDecodeError:
|
|
249
|
+
self.send_json_response({'success': False, 'error': 'Invalid JSON'}, 400)
|
|
250
|
+
except Exception as e:
|
|
251
|
+
self.send_json_response({'success': False, 'error': str(e)}, 500)
|
|
252
|
+
return
|
|
253
|
+
|
|
254
|
+
self.send_json_response({'error': 'Not found'}, 404)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def main():
|
|
258
|
+
"""Run the code executor server"""
|
|
259
|
+
run_server(
|
|
260
|
+
CodeExecutorHandler,
|
|
261
|
+
PORT,
|
|
262
|
+
'💻 Tilt IDE Code Executor',
|
|
263
|
+
'🚀 Execute bun commands from the browser\n ⚠️ Safety: Only bun, npm, git, and safe system commands allowed'
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
if __name__ == '__main__':
|
|
268
|
+
main()
|