@tdk-landscape/tdk-cli-core 1.3.15 → 1.3.26
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/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 +59 -18
- 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/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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 📊 TILT SDK - OUTPUT UTILITIES
|
|
3
|
+
# =============================================================================
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def print_resource_summary(infra_services, app_resources, should_enable_fn):
|
|
7
|
+
"""Print summary of enabled services and estimated memory usage."""
|
|
8
|
+
enabled_services = []
|
|
9
|
+
estimated_memory = 0
|
|
10
|
+
|
|
11
|
+
for s in infra_services:
|
|
12
|
+
if should_enable_fn(s['name']):
|
|
13
|
+
enabled_services.append(s['name'])
|
|
14
|
+
svc_memory = s.get('memory')
|
|
15
|
+
if svc_memory != None:
|
|
16
|
+
estimated_memory += svc_memory
|
|
17
|
+
else:
|
|
18
|
+
estimated_memory += 512 # Default 512MB
|
|
19
|
+
|
|
20
|
+
for s in app_resources:
|
|
21
|
+
if should_enable_fn(s['name']):
|
|
22
|
+
enabled_services.append(s['name'])
|
|
23
|
+
svc_memory = s.get('memory')
|
|
24
|
+
if svc_memory != None:
|
|
25
|
+
estimated_memory += svc_memory
|
|
26
|
+
else:
|
|
27
|
+
estimated_memory += 512 # Default 512MB
|
|
28
|
+
|
|
29
|
+
print("\n📊 Resource Summary:")
|
|
30
|
+
print(" 🔧 Enabled services: " + str(len(enabled_services)))
|
|
31
|
+
print(" 💾 Estimated memory: ~" + str(estimated_memory) + "MB")
|
|
32
|
+
|
|
33
|
+
if estimated_memory > 4096:
|
|
34
|
+
print(" ⚠️ WARNING: High memory usage (consider `tilt down && tilt up --focus <domain>`)")
|
|
35
|
+
elif estimated_memory > 2048:
|
|
36
|
+
print(" ⚡ MODERATE: Memory usage moderate (use `--focus` to reduce)")
|
|
37
|
+
else:
|
|
38
|
+
print(" ✅ OPTIMAL: Memory usage optimized")
|
|
39
|
+
|
|
40
|
+
return enabled_services
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def get_template_header(file_type, generator_name, resource_name='', extra_info=''):
|
|
44
|
+
"""
|
|
45
|
+
Generate a standardized "DO NOT EDIT" header for auto-generated files.
|
|
46
|
+
"""
|
|
47
|
+
is_ts_or_js = (
|
|
48
|
+
file_type.endswith('.ts') or
|
|
49
|
+
file_type.endswith('.tsx') or
|
|
50
|
+
file_type.endswith('.js') or
|
|
51
|
+
file_type.endswith('.jsx') or
|
|
52
|
+
file_type.endswith('.mjs') or
|
|
53
|
+
file_type.endswith('.mts')
|
|
54
|
+
)
|
|
55
|
+
is_css = file_type.endswith('.css') or file_type.endswith('.scss')
|
|
56
|
+
is_nginx = file_type.endswith('.conf') or file_type == 'nginx'
|
|
57
|
+
|
|
58
|
+
if is_ts_or_js or file_type in ['vite', 'tsconfig', 'typescript', 'javascript']:
|
|
59
|
+
border = '/' * 79
|
|
60
|
+
comment_start = '//'
|
|
61
|
+
elif is_css:
|
|
62
|
+
border = '/' + '*' * 77 + '/'
|
|
63
|
+
comment_start = ' *'
|
|
64
|
+
elif is_nginx or file_type in ['dockerfile', 'compose', 'env', 'shell', 'npmrc', 'bunfig']:
|
|
65
|
+
border = '#' * 79
|
|
66
|
+
comment_start = '#'
|
|
67
|
+
else:
|
|
68
|
+
border = '#' * 79
|
|
69
|
+
comment_start = '#'
|
|
70
|
+
|
|
71
|
+
resource_line = ''
|
|
72
|
+
if resource_name:
|
|
73
|
+
resource_line = '\n{c} Service: {s}'.format(c=comment_start, s=resource_name)
|
|
74
|
+
|
|
75
|
+
extra_line = ''
|
|
76
|
+
if extra_info:
|
|
77
|
+
extra_line = '\n{c} Type: {e}'.format(c=comment_start, e=extra_info)
|
|
78
|
+
|
|
79
|
+
header = """{border}
|
|
80
|
+
{c} 🛑 CRITICAL: SYSTEM-GENERATED FILE - DO NOT MODIFY DIRECTLY
|
|
81
|
+
{c}
|
|
82
|
+
{c} ANY MANUAL CHANGES MADE TO THIS FILE WILL BE WIPED ON THE NEXT 'tilt up'.
|
|
83
|
+
{c} TO MODIFY THIS CONFIGURATION:
|
|
84
|
+
{c} 1. Edit the source generator in: .tilt/topologies/
|
|
85
|
+
{c} 2. Or update service.json
|
|
86
|
+
{c}
|
|
87
|
+
{c} Generation Source: {generator}{resource_line}{extra_line}
|
|
88
|
+
{border}
|
|
89
|
+
""".format(
|
|
90
|
+
border=border,
|
|
91
|
+
c=comment_start,
|
|
92
|
+
generator=generator_name,
|
|
93
|
+
resource_line=resource_line,
|
|
94
|
+
extra_line=extra_line,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return header
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# AGENTS.md - Global Configuration
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Global Tilt configuration, feature flags, environment profiles, and defaults.
|
|
6
|
+
|
|
7
|
+
## Key Files
|
|
8
|
+
|
|
9
|
+
### Core Config
|
|
10
|
+
- **`global.star`** - Global configuration loading
|
|
11
|
+
- **`profiles.star`** - Environment profiles (dev, staging, prod)
|
|
12
|
+
- **`features.star`** - Feature flags
|
|
13
|
+
|
|
14
|
+
### Defaults
|
|
15
|
+
- **`defaults.star`** - Default values for all settings
|
|
16
|
+
- **`overrides.star`** - Local overrides (gitignored)
|
|
17
|
+
|
|
18
|
+
## Key Concepts
|
|
19
|
+
|
|
20
|
+
### Configuration Hierarchy
|
|
21
|
+
```
|
|
22
|
+
1. defaults.star (base values)
|
|
23
|
+
2. profiles.star (environment-specific)
|
|
24
|
+
3. global.star (project-wide)
|
|
25
|
+
4. overrides.star (local user settings)
|
|
26
|
+
5. Environment vars (runtime)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Common Tasks
|
|
30
|
+
|
|
31
|
+
### Get global config
|
|
32
|
+
```starlark
|
|
33
|
+
load("../discovery/config.star", "get_global_config")
|
|
34
|
+
config = get_global_config()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Check feature flag
|
|
38
|
+
```starlark
|
|
39
|
+
load("./features.star", "is_feature_enabled")
|
|
40
|
+
if is_feature_enabled("nats_streaming"):
|
|
41
|
+
# Enable NATS
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Get profile
|
|
45
|
+
```starlark
|
|
46
|
+
load("./profiles.star", "get_profile")
|
|
47
|
+
profile = get_profile() # "pre-alpha", "alpha", "beta", "production"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Integration
|
|
51
|
+
|
|
52
|
+
- Loaded by main `Tiltfile`
|
|
53
|
+
- Used by `discovery/config.star`
|
|
54
|
+
- Referenced by `spec.master`
|
|
55
|
+
|
|
56
|
+
## Important Files
|
|
57
|
+
|
|
58
|
+
- `spec.master` (project root) - Service-specific defaults
|
|
59
|
+
- `.env` - Local environment variables
|
|
60
|
+
- `tilt_options.json` - Tilt-specific options
|
|
61
|
+
|
|
62
|
+
## Configuration Values
|
|
63
|
+
|
|
64
|
+
Common config includes:
|
|
65
|
+
- `MOCK_TIKKIE` - Use mock payment API
|
|
66
|
+
- `FOCUS_*` - Which service groups to load
|
|
67
|
+
- `DB_*` - Database settings
|
|
68
|
+
- `VERDACCIO_*` - NPM registry settings
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
load("../discovery/resource_registry.star", _DEFAULTS_EXPORT = "DEFAULTS_EXPORT")
|
|
2
|
+
|
|
3
|
+
def is_enabled(flag_name, cfg, fallback = True):
|
|
4
|
+
if cfg.get(flag_name) != None:
|
|
5
|
+
return cfg.get(flag_name)
|
|
6
|
+
return _DEFAULTS_EXPORT.get(flag_name, fallback)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Inlined constant
|
|
10
|
+
DEFAULTS = {}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# ⚙️ TOPOLOGIES - GLOBAL CONFIG
|
|
3
|
+
# =============================================================================
|
|
4
|
+
|
|
5
|
+
load("./profiles.star", "Focus")
|
|
6
|
+
load(
|
|
7
|
+
"../../../../discovery/registry.star",
|
|
8
|
+
"APP_RESOURCES",
|
|
9
|
+
"GLOBAL_CONFIG_EXPORT",
|
|
10
|
+
"INFRA_RESOURCES_EXPORT",
|
|
11
|
+
"DDD_LIBS_EXPORT",
|
|
12
|
+
"DEFAULTS_EXPORT",
|
|
13
|
+
"CORE_INFRA_EXPORT",
|
|
14
|
+
"INFRA_STACK_MAP_EXPORT",
|
|
15
|
+
"OPTIONAL_INFRA_EXPORT",
|
|
16
|
+
"RESOURCE_DEPENDENCIES",
|
|
17
|
+
"RESOURCE_ALIASES",
|
|
18
|
+
"RESOURCE_PATH_MAP",
|
|
19
|
+
"get_platform_libs_export",
|
|
20
|
+
"get_product_libs_export",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def build_config_context():
|
|
25
|
+
return {
|
|
26
|
+
"internal_scope": GLOBAL_CONFIG_EXPORT["internal_scope"],
|
|
27
|
+
"library_roots": GLOBAL_CONFIG_EXPORT["library_roots"],
|
|
28
|
+
"verdaccio_url_local": GLOBAL_CONFIG_EXPORT["verdaccio_url_local"],
|
|
29
|
+
"verdaccio_url_docker": GLOBAL_CONFIG_EXPORT["verdaccio_url_docker"],
|
|
30
|
+
"resource_path_map": RESOURCE_PATH_MAP,
|
|
31
|
+
"database": GLOBAL_CONFIG_EXPORT["database"],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Config = struct(
|
|
36
|
+
get_needed_services = Focus.get_needed_services,
|
|
37
|
+
apply_focus = Focus.apply_focus,
|
|
38
|
+
create_enabler = Focus.create_enabler,
|
|
39
|
+
build_context = build_config_context,
|
|
40
|
+
GLOBAL = GLOBAL_CONFIG_EXPORT,
|
|
41
|
+
DEFAULTS = DEFAULTS_EXPORT,
|
|
42
|
+
APP_RESOURCES = APP_RESOURCES,
|
|
43
|
+
INFRA_RESOURCES = INFRA_RESOURCES_EXPORT,
|
|
44
|
+
DDD_LIBS = DDD_LIBS_EXPORT,
|
|
45
|
+
CORE_INFRA = CORE_INFRA_EXPORT,
|
|
46
|
+
INFRA_STACK_MAP = INFRA_STACK_MAP_EXPORT,
|
|
47
|
+
OPTIONAL_INFRA = OPTIONAL_INFRA_EXPORT,
|
|
48
|
+
RESOURCE_DEPENDENCIES = RESOURCE_DEPENDENCIES,
|
|
49
|
+
RESOURCE_ALIASES = RESOURCE_ALIASES,
|
|
50
|
+
RESOURCE_PATH_MAP = RESOURCE_PATH_MAP,
|
|
51
|
+
get_platform_libs = get_platform_libs_export,
|
|
52
|
+
get_product_libs = get_product_libs_export,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
GLOBAL_CONFIG = {}
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🎯 TOPOLOGIES - FOCUS PROFILES
|
|
3
|
+
# =============================================================================
|
|
4
|
+
|
|
5
|
+
load("../../../topologies/tilt/common/utils.star", "Utils")
|
|
6
|
+
load(
|
|
7
|
+
"../../../../discovery/registry.star",
|
|
8
|
+
"APP_RESOURCES",
|
|
9
|
+
"CORE_INFRA_EXPORT",
|
|
10
|
+
"INFRA_STACK_MAP_EXPORT",
|
|
11
|
+
"OPTIONAL_INFRA_EXPORT",
|
|
12
|
+
"DEFAULTS_EXPORT",
|
|
13
|
+
"FOCUS_PRE_ALPHA_EXPORT",
|
|
14
|
+
"FOCUS_ALPHA_EXPORT",
|
|
15
|
+
"FOCUS_BETA_EXPORT",
|
|
16
|
+
"get_app_resources",
|
|
17
|
+
"get_app_resources_ref",
|
|
18
|
+
"get_resource_aliases_ref",
|
|
19
|
+
"get_resource_dependencies_ref",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# =============================================================================
|
|
23
|
+
# 🎯 RELEASE PHASE MAPPINGS
|
|
24
|
+
# =============================================================================
|
|
25
|
+
# Map release phase names to service lists from spec.master
|
|
26
|
+
|
|
27
|
+
RELEASE_PHASES = {
|
|
28
|
+
"pre-alpha": FOCUS_PRE_ALPHA_EXPORT,
|
|
29
|
+
"alpha": FOCUS_ALPHA_EXPORT,
|
|
30
|
+
"beta": FOCUS_BETA_EXPORT,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def expand_release_targets(targets):
|
|
34
|
+
"""Expand release phase targets (pre-alpha, alpha, beta) to service lists."""
|
|
35
|
+
expanded = []
|
|
36
|
+
for target in targets:
|
|
37
|
+
target_lower = target.lower()
|
|
38
|
+
if target_lower in RELEASE_PHASES:
|
|
39
|
+
phase_services = RELEASE_PHASES[target_lower]
|
|
40
|
+
for svc in phase_services:
|
|
41
|
+
expanded.append(svc)
|
|
42
|
+
else:
|
|
43
|
+
expanded.append(target)
|
|
44
|
+
return expanded
|
|
45
|
+
|
|
46
|
+
def _get_resources_for_domain(domain_name):
|
|
47
|
+
"""Get resource names (backend, frontend) for a domain from APP_RESOURCES.
|
|
48
|
+
|
|
49
|
+
Returns both the actual service resources and YAML tracking resources.
|
|
50
|
+
Library resources (appType == 'library') only return YAML resources.
|
|
51
|
+
|
|
52
|
+
Matches by stack name (domain) which is the canonical service identifier.
|
|
53
|
+
"""
|
|
54
|
+
resources = []
|
|
55
|
+
for service in get_app_resources_ref():
|
|
56
|
+
# Match by stack name (domain) - this is the canonical identifier in spec.master
|
|
57
|
+
service_stack = service.get("stack", "")
|
|
58
|
+
service_name = service.get("name", "")
|
|
59
|
+
if service_stack == domain_name or service_name == domain_name:
|
|
60
|
+
for res in service.get("resources", []):
|
|
61
|
+
res_name = res.get("name", "")
|
|
62
|
+
if res_name:
|
|
63
|
+
# Check if this is a library resource - libraries don't have runtime resources
|
|
64
|
+
manifest = res.get("_manifest", {})
|
|
65
|
+
if manifest.get("appType") == "library":
|
|
66
|
+
# For libraries, only add YAML tracking resource
|
|
67
|
+
resources.append(res_name + "-yaml")
|
|
68
|
+
else:
|
|
69
|
+
# For actual services (backend, frontend), add both:
|
|
70
|
+
# 1. The actual service resource (for docker_build/docker_compose)
|
|
71
|
+
resources.append(res_name)
|
|
72
|
+
# 2. The YAML tracking resource
|
|
73
|
+
resources.append(res_name + "-yaml")
|
|
74
|
+
return resources
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def get_all_needed_services(targets, skip_frontend = False):
|
|
78
|
+
needed = {}
|
|
79
|
+
visited = {}
|
|
80
|
+
|
|
81
|
+
def _resolve_alias(resource_name):
|
|
82
|
+
if resource_name in get_resource_aliases_ref():
|
|
83
|
+
alias_value = get_resource_aliases_ref()[resource_name]
|
|
84
|
+
# get_resource_aliases_ref() maps names to paths (strings), not to resource lists
|
|
85
|
+
# Only return alias_value if it's a list (of resource names)
|
|
86
|
+
if type(alias_value) == "list":
|
|
87
|
+
return alias_value
|
|
88
|
+
return [resource_name]
|
|
89
|
+
|
|
90
|
+
def _filter_frontends(resources, include_frontends):
|
|
91
|
+
if include_frontends:
|
|
92
|
+
return resources
|
|
93
|
+
return [resource for resource in resources if "frontend" not in resource]
|
|
94
|
+
|
|
95
|
+
def resolve_target(resource_name):
|
|
96
|
+
# Explicit focus targets keep their frontends unless --no-frontend is set.
|
|
97
|
+
return _filter_frontends(_resolve_alias(resource_name), not skip_frontend)
|
|
98
|
+
|
|
99
|
+
def resolve_dependency(resource_name):
|
|
100
|
+
# Transitive domain dependencies should not pull dependency UIs.
|
|
101
|
+
return _filter_frontends(_resolve_alias(resource_name), False)
|
|
102
|
+
|
|
103
|
+
def discover(service):
|
|
104
|
+
if service in visited:
|
|
105
|
+
return
|
|
106
|
+
visited[service] = True
|
|
107
|
+
|
|
108
|
+
if skip_frontend and "frontend" in service:
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
needed[service] = True
|
|
112
|
+
|
|
113
|
+
deps = get_resource_dependencies_ref().get(service, [])
|
|
114
|
+
for dep in deps:
|
|
115
|
+
for resolved in resolve_dependency(dep):
|
|
116
|
+
discover(resolved)
|
|
117
|
+
|
|
118
|
+
for target in targets:
|
|
119
|
+
for resolved in resolve_target(target):
|
|
120
|
+
discover(resolved)
|
|
121
|
+
|
|
122
|
+
# Expand any domain names in needed to their actual resources
|
|
123
|
+
# e.g., "identity" -> ["identity-management-backend", "identity-management-frontend", ...]
|
|
124
|
+
expanded_needed = {}
|
|
125
|
+
for service in needed:
|
|
126
|
+
resources = _get_resources_for_domain(service)
|
|
127
|
+
if resources:
|
|
128
|
+
for res in resources:
|
|
129
|
+
expanded_needed[res] = True
|
|
130
|
+
else:
|
|
131
|
+
expanded_needed[service] = True
|
|
132
|
+
|
|
133
|
+
return expanded_needed.keys()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _load_focus_lists():
|
|
137
|
+
"""Load focus lists from project spec.master directly."""
|
|
138
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '')
|
|
139
|
+
if not project_root:
|
|
140
|
+
return ([], [], [])
|
|
141
|
+
|
|
142
|
+
# Load from spec.master
|
|
143
|
+
spec_paths = [
|
|
144
|
+
project_root + "/.tdk/.tdk-out/spec.master",
|
|
145
|
+
project_root + "/spec.master",
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
for spec_path in spec_paths:
|
|
149
|
+
check_cmd = "test -f '{}' && echo 'yes' || echo 'no'".format(spec_path)
|
|
150
|
+
exists = str(local(check_cmd, quiet=True, echo_off=True)).strip() == 'yes'
|
|
151
|
+
if exists:
|
|
152
|
+
# Parse PRE_ALPHA_RESOURCES from spec.master
|
|
153
|
+
pre_alpha = []
|
|
154
|
+
alpha = []
|
|
155
|
+
beta = []
|
|
156
|
+
|
|
157
|
+
content = str(local("cat '" + spec_path + "' 2>/dev/null || true", quiet=True, echo_off=True))
|
|
158
|
+
|
|
159
|
+
# Simple parsing for PRE_ALPHA_RESOURCES = {"key": True, ...}
|
|
160
|
+
if "PRE_ALPHA_RESOURCES" in content:
|
|
161
|
+
start = content.find("PRE_ALPHA_RESOURCES = {")
|
|
162
|
+
if start != -1:
|
|
163
|
+
start = content.find("{", start)
|
|
164
|
+
end = content.find("}", start)
|
|
165
|
+
if start != -1 and end != -1:
|
|
166
|
+
dict_content = content[start+1:end]
|
|
167
|
+
for line in dict_content.split("\n"):
|
|
168
|
+
line = line.strip()
|
|
169
|
+
if line and not line.startswith("#"):
|
|
170
|
+
# Extract key from "key": True format
|
|
171
|
+
if '"' in line or "'" in line:
|
|
172
|
+
quote_char = '"' if '"' in line else "'"
|
|
173
|
+
key_start = line.find(quote_char)
|
|
174
|
+
key_end = line.find(quote_char, key_start + 1)
|
|
175
|
+
if key_start != -1 and key_end != -1:
|
|
176
|
+
key = line[key_start+1:key_end]
|
|
177
|
+
if "True" in line:
|
|
178
|
+
pre_alpha.append(key)
|
|
179
|
+
|
|
180
|
+
if "ALPHA_RESOURCES" in content:
|
|
181
|
+
start = content.find("ALPHA_RESOURCES = {")
|
|
182
|
+
if start != -1:
|
|
183
|
+
start = content.find("{", start)
|
|
184
|
+
end = content.find("}", start)
|
|
185
|
+
if start != -1 and end != -1:
|
|
186
|
+
dict_content = content[start+1:end]
|
|
187
|
+
for line in dict_content.split("\n"):
|
|
188
|
+
line = line.strip()
|
|
189
|
+
if line and not line.startswith("#"):
|
|
190
|
+
if '"' in line or "'" in line:
|
|
191
|
+
quote_char = '"' if '"' in line else "'"
|
|
192
|
+
key_start = line.find(quote_char)
|
|
193
|
+
key_end = line.find(quote_char, key_start + 1)
|
|
194
|
+
if key_start != -1 and key_end != -1:
|
|
195
|
+
key = line[key_start+1:key_end]
|
|
196
|
+
if "True" in line:
|
|
197
|
+
alpha.append(key)
|
|
198
|
+
|
|
199
|
+
if "BETA_RESOURCES" in content:
|
|
200
|
+
start = content.find("BETA_RESOURCES = {")
|
|
201
|
+
if start != -1:
|
|
202
|
+
start = content.find("{", start)
|
|
203
|
+
end = content.find("}", start)
|
|
204
|
+
if start != -1 and end != -1:
|
|
205
|
+
dict_content = content[start+1:end]
|
|
206
|
+
for line in dict_content.split("\n"):
|
|
207
|
+
line = line.strip()
|
|
208
|
+
if line and not line.startswith("#"):
|
|
209
|
+
if '"' in line or "'" in line:
|
|
210
|
+
quote_char = '"' if '"' in line else "'"
|
|
211
|
+
key_start = line.find(quote_char)
|
|
212
|
+
key_end = line.find(quote_char, key_start + 1)
|
|
213
|
+
if key_start != -1 and key_end != -1:
|
|
214
|
+
key = line[key_start+1:key_end]
|
|
215
|
+
if "True" in line:
|
|
216
|
+
beta.append(key)
|
|
217
|
+
|
|
218
|
+
return (pre_alpha, alpha, beta)
|
|
219
|
+
|
|
220
|
+
return ([], [], [])
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def apply_focus_filter(cfg):
|
|
224
|
+
# Ensure discovery is complete before applying focus filter
|
|
225
|
+
if len(get_app_resources_ref()) == 0:
|
|
226
|
+
get_app_resources()
|
|
227
|
+
|
|
228
|
+
focus_targets = cfg.get("focus", [])
|
|
229
|
+
|
|
230
|
+
# Default to pre-alpha if no focus targets specified
|
|
231
|
+
if not focus_targets:
|
|
232
|
+
print("🎯 Mode: pre-alpha (use --focus for alpha/beta)")
|
|
233
|
+
focus_targets = ["pre-alpha"]
|
|
234
|
+
|
|
235
|
+
parsed_targets = []
|
|
236
|
+
for target in focus_targets:
|
|
237
|
+
parsed_targets.extend(target.split(","))
|
|
238
|
+
parsed_targets = [t.strip() for t in parsed_targets if t.strip()]
|
|
239
|
+
|
|
240
|
+
# Load focus lists directly from spec.master (since env var is set after module load)
|
|
241
|
+
pre_alpha_list, alpha_list, beta_list = _load_focus_lists()
|
|
242
|
+
|
|
243
|
+
# Temporarily override RELEASE_PHASES with loaded values
|
|
244
|
+
dynamic_phases = {
|
|
245
|
+
"pre-alpha": pre_alpha_list if pre_alpha_list else FOCUS_PRE_ALPHA_EXPORT,
|
|
246
|
+
"alpha": alpha_list if alpha_list else FOCUS_ALPHA_EXPORT,
|
|
247
|
+
"beta": beta_list if beta_list else FOCUS_BETA_EXPORT,
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
# Expand release phase targets (pre-alpha, alpha, beta) to service lists
|
|
251
|
+
expanded = []
|
|
252
|
+
for target in parsed_targets:
|
|
253
|
+
target_lower = target.lower()
|
|
254
|
+
if target_lower in dynamic_phases:
|
|
255
|
+
phase_services = dynamic_phases[target_lower]
|
|
256
|
+
for svc in phase_services:
|
|
257
|
+
expanded.append(svc)
|
|
258
|
+
else:
|
|
259
|
+
expanded.append(target)
|
|
260
|
+
parsed_targets = expanded
|
|
261
|
+
|
|
262
|
+
if not parsed_targets:
|
|
263
|
+
return (False, None, None)
|
|
264
|
+
|
|
265
|
+
print("🎯 ═══════════════════════════════════════════════════════════════")
|
|
266
|
+
print("🎯 UBER-STYLE FOCUS MODE ACTIVATED")
|
|
267
|
+
print("🎯 Target services: " + ", ".join(parsed_targets))
|
|
268
|
+
print("🎯 ═══════════════════════════════════════════════════════════════")
|
|
269
|
+
|
|
270
|
+
skip_frontend = cfg.get("no-frontend", False)
|
|
271
|
+
include_monitoring = cfg.get("include-monitoring", False)
|
|
272
|
+
|
|
273
|
+
needed_list = get_all_needed_services(parsed_targets, skip_frontend)
|
|
274
|
+
needed = {}
|
|
275
|
+
for s in needed_list:
|
|
276
|
+
needed[s] = True
|
|
277
|
+
|
|
278
|
+
for infra in CORE_INFRA_EXPORT:
|
|
279
|
+
needed[infra] = True
|
|
280
|
+
if infra in INFRA_STACK_MAP_EXPORT:
|
|
281
|
+
needed[INFRA_STACK_MAP_EXPORT[infra]] = True
|
|
282
|
+
|
|
283
|
+
if include_monitoring:
|
|
284
|
+
needed["monitoring"] = True
|
|
285
|
+
for svc in OPTIONAL_INFRA_EXPORT.get("monitoring", []):
|
|
286
|
+
needed[svc] = True
|
|
287
|
+
|
|
288
|
+
if os.environ.get("INFISICAL_ENABLED", "true").lower() == "true":
|
|
289
|
+
needed["infisical"] = True
|
|
290
|
+
for svc in OPTIONAL_INFRA_EXPORT.get("infisical", []):
|
|
291
|
+
needed[svc] = True
|
|
292
|
+
|
|
293
|
+
for target in parsed_targets:
|
|
294
|
+
if target in get_resource_aliases_ref():
|
|
295
|
+
needed[target] = True
|
|
296
|
+
|
|
297
|
+
all_needed = needed.keys()
|
|
298
|
+
|
|
299
|
+
logic_toggles = [
|
|
300
|
+
"database-management",
|
|
301
|
+
"golden-image",
|
|
302
|
+
"proxy",
|
|
303
|
+
"verdaccio",
|
|
304
|
+
"infisical",
|
|
305
|
+
"monitoring",
|
|
306
|
+
"elk",
|
|
307
|
+
"debezium",
|
|
308
|
+
# Domains are auto-discovered from service manifests
|
|
309
|
+
# No hardcoded domain names - all from service.json
|
|
310
|
+
"backends-only",
|
|
311
|
+
]
|
|
312
|
+
# Infrastructure resources that exist as Tilt local_resource or docker_compose
|
|
313
|
+
# These are handled separately and should not be in resource_only_needed
|
|
314
|
+
infra_resource_names = CORE_INFRA_EXPORT + ["infisical-db", "infisical-redis"]
|
|
315
|
+
for opt_infra_list in OPTIONAL_INFRA_EXPORT.values():
|
|
316
|
+
for res in opt_infra_list:
|
|
317
|
+
if res not in infra_resource_names:
|
|
318
|
+
infra_resource_names.append(res)
|
|
319
|
+
|
|
320
|
+
# config.set_enabled_resources accepts only concrete Tilt resources.
|
|
321
|
+
# Logic toggles (e.g. "golden-image", "database-management") are excluded since they're config flags, not resources.
|
|
322
|
+
# Infrastructure resources (postgres, nats, traefik, etc.) are loaded via Infra.load_all()
|
|
323
|
+
# and excluded here since they may not be available in all projects.
|
|
324
|
+
# Only include resources that exist as discovered services (in resource aliases).
|
|
325
|
+
resource_aliases = get_resource_aliases_ref()
|
|
326
|
+
resource_only_needed = []
|
|
327
|
+
for r in all_needed:
|
|
328
|
+
if r in logic_toggles:
|
|
329
|
+
continue
|
|
330
|
+
if r not in resource_aliases:
|
|
331
|
+
continue
|
|
332
|
+
resource_only_needed.append(r)
|
|
333
|
+
|
|
334
|
+
print("🎯 Discovered " + str(len(all_needed)) + " entities via dependency graph:")
|
|
335
|
+
|
|
336
|
+
app_resources = [r for r in all_needed if any([x in r for x in ["backend", "frontend", "migrator"]])]
|
|
337
|
+
infra_resources = [r for r in all_needed if r in CORE_INFRA_EXPORT or any([r in v for v in OPTIONAL_INFRA_EXPORT.values()])]
|
|
338
|
+
db_resources = [r for r in all_needed if "provision-db" in r]
|
|
339
|
+
|
|
340
|
+
if app_resources:
|
|
341
|
+
print(" 📱 Apps: " + ", ".join(sorted(app_resources)))
|
|
342
|
+
if db_resources:
|
|
343
|
+
print(" 🗃️ Databases: " + ", ".join(sorted(db_resources)))
|
|
344
|
+
if infra_resources:
|
|
345
|
+
print(" 🏗️ Infrastructure: " + ", ".join(sorted(infra_resources)))
|
|
346
|
+
|
|
347
|
+
print("🎯 ═══════════════════════════════════════════════════════════════")
|
|
348
|
+
|
|
349
|
+
return (True, all_needed, resource_only_needed)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def create_should_enable_wrapper(focus_mode, focus_enabled_all, cfg, defaults):
|
|
353
|
+
def should_enable_wrapper(resource_name):
|
|
354
|
+
if focus_mode and focus_enabled_all:
|
|
355
|
+
# Check if resource_name itself is in the list (for infrastructure)
|
|
356
|
+
if resource_name in focus_enabled_all:
|
|
357
|
+
return True
|
|
358
|
+
# Check if resource_name starts with any domain in focus_enabled_all
|
|
359
|
+
# e.g., "identity-management-backend" starts with "identity"
|
|
360
|
+
for domain in focus_enabled_all:
|
|
361
|
+
if resource_name.startswith(domain + "-"):
|
|
362
|
+
return True
|
|
363
|
+
# Check get_resource_aliases_ref() (if it maps to resource lists)
|
|
364
|
+
if resource_name in get_resource_aliases_ref():
|
|
365
|
+
alias_value = get_resource_aliases_ref()[resource_name]
|
|
366
|
+
if type(alias_value) == "list":
|
|
367
|
+
return any([res in focus_enabled_all for res in alias_value])
|
|
368
|
+
return False
|
|
369
|
+
return Utils.should_enable(resource_name, cfg, defaults)
|
|
370
|
+
|
|
371
|
+
return should_enable_wrapper
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
Focus = struct(
|
|
375
|
+
get_needed_services = get_all_needed_services,
|
|
376
|
+
apply_focus = apply_focus_filter,
|
|
377
|
+
create_enabler = create_should_enable_wrapper,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
# Inlined constant
|
|
382
|
+
DEFAULTS = {}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# 🤖 TILT SDK - AGENTS.MD GENERATOR (free-tier stub)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Path: .tilt/providers/generators/agents_md.star
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# The full AI-agent guard rails (the multi-section AGENTS.md explaining the
|
|
7
|
+
# manifest-driven architecture, the do/don't table, and the emergency
|
|
8
|
+
# override procedure) are a paid TDK feature. When a valid license grants
|
|
9
|
+
# the "agents-md" resource, cli/src/generator/template-engine.ts
|
|
10
|
+
# (vendorTdkExtension) overwrites this file with the licensed version
|
|
11
|
+
# fetched via extension-fetch.ts before Tilt loads it. Same function
|
|
12
|
+
# signature either way, so nothing else in the generator pipeline changes.
|
|
13
|
+
# =============================================================================
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
17
|
+
OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
|
|
18
|
+
# === END INLINED CONSTANTS ===
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
load('../../../topologies/tilt/common/utils.star', 'Utils')
|
|
22
|
+
|
|
23
|
+
_STUB_NOTICE = """# ⚠️ AUTOGENERATED FILES - DO NOT MODIFY
|
|
24
|
+
|
|
25
|
+
**This folder (`.autogenerated/`) contains MACHINE-GENERATED files.** Any changes you make here will be overwritten the next time Tilt runs the configuration generators.
|
|
26
|
+
|
|
27
|
+
Full AI-agent guard rails (architecture explanation, do/don't table, emergency override procedure) are a paid TDK feature. Run `tdk upgrade` to enable the complete generated AGENTS.md for this service.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def generate_agents_md(manifest, write_fn=None):
|
|
32
|
+
"""
|
|
33
|
+
Free-tier stub - see module header. Signature matches the licensed
|
|
34
|
+
implementation so callers never need to know which one is active.
|
|
35
|
+
"""
|
|
36
|
+
resource_path = manifest.get('_resource_path', '')
|
|
37
|
+
app_name = manifest.get('appName', 'unknown-service')
|
|
38
|
+
app_type = manifest.get('appType', 'backend')
|
|
39
|
+
|
|
40
|
+
header = Utils.get_template_header(
|
|
41
|
+
'agents_md',
|
|
42
|
+
'AgentsMd.generate() [unlicensed stub]',
|
|
43
|
+
app_name,
|
|
44
|
+
'Output: .autogenerated/AGENTS.md',
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
content = header + _STUB_NOTICE
|
|
48
|
+
|
|
49
|
+
if write_fn:
|
|
50
|
+
output_path = resource_path + '/' + OUTPUT.AUTOGENERATED_FOLDER + '/AGENTS.md'
|
|
51
|
+
write_fn(output_path, content)
|
|
52
|
+
|
|
53
|
+
return content
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# =============================================================================
|
|
57
|
+
# 🎯 PUBLIC API
|
|
58
|
+
# =============================================================================
|
|
59
|
+
|
|
60
|
+
AgentsMd = struct(
|
|
61
|
+
generate = generate_agents_md,
|
|
62
|
+
)
|