@tdk-landscape/tdk-cli-core 1.3.15 → 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/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,693 @@
|
|
|
1
|
+
# 📋 Manifest Module
|
|
2
|
+
|
|
3
|
+
**Status:** ✅ All Phases Complete! (Phase 1-5)
|
|
4
|
+
**Location:** `.tilt/topologies/tilt/manifest/`
|
|
5
|
+
**Purpose:** Clean, modular manifest parsing, loading, validation, and discovery integration system
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
### Basic Usage
|
|
12
|
+
|
|
13
|
+
```starlark
|
|
14
|
+
# Load the manifest system
|
|
15
|
+
load("../manifest/__init__.star", "Manifest")
|
|
16
|
+
|
|
17
|
+
# Access constants
|
|
18
|
+
print(Manifest.filename) # service.json
|
|
19
|
+
print(Manifest.defaults) # Default field values
|
|
20
|
+
|
|
21
|
+
# Load and validate a manifest
|
|
22
|
+
result = Manifest.load_from_file("services/product/user/user-management-backend/service.json")
|
|
23
|
+
if result.error:
|
|
24
|
+
print("Error:", result.error)
|
|
25
|
+
else:
|
|
26
|
+
manifest = result.manifest
|
|
27
|
+
|
|
28
|
+
# Validate the manifest
|
|
29
|
+
validation = Manifest.validate(manifest)
|
|
30
|
+
if validation.valid:
|
|
31
|
+
print("✅ Valid:", manifest['appName'])
|
|
32
|
+
else:
|
|
33
|
+
print("❌ Validation failed:")
|
|
34
|
+
for error in validation.errors:
|
|
35
|
+
print(" -", Manifest.format_error(error))
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Validation Example
|
|
39
|
+
|
|
40
|
+
```starlark
|
|
41
|
+
# Validate a manifest with full reporting
|
|
42
|
+
report = Manifest.get_validation_report(my_manifest)
|
|
43
|
+
print(report)
|
|
44
|
+
|
|
45
|
+
# Quick check
|
|
46
|
+
if Manifest.is_valid(my_manifest):
|
|
47
|
+
print("Manifest is valid!")
|
|
48
|
+
|
|
49
|
+
# Validate against all resources (checks port conflicts, dependencies)
|
|
50
|
+
all_manifests = Manifest.load_all("services/product").manifests
|
|
51
|
+
result = Manifest.validate_dependencies(my_manifest, all_manifests)
|
|
52
|
+
if not result.valid:
|
|
53
|
+
print("Cross-service validation failed")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Module Structure
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
manifest/
|
|
62
|
+
├── __init__.star # Main API facade
|
|
63
|
+
├── constants.star # Constants and defaults
|
|
64
|
+
├── schema.star # Field schema definitions
|
|
65
|
+
├── errors.star # Error handling
|
|
66
|
+
├── loader.star # File loading and I/O
|
|
67
|
+
├── parser.star # JSON parsing and normalization
|
|
68
|
+
├── validator.star # Comprehensive validation
|
|
69
|
+
├── integration.star # Discovery system integration ⭐ NEW (Phase 4)
|
|
70
|
+
├── PHASE4_DISCOVERY_PATCH.md # Migration guide ⭐ NEW (Phase 4)
|
|
71
|
+
├── tests/
|
|
72
|
+
│ ├── test_manifest.star # Unit tests (Phase 1)
|
|
73
|
+
│ ├── test_loader_parser.star # Integration tests (Phase 2)
|
|
74
|
+
│ ├── test_validator.star # Validator tests (Phase 3)
|
|
75
|
+
│ └── test_integration.star # Integration tests (Phase 4) ⭐ NEW
|
|
76
|
+
└── README.md # This file
|
|
77
|
+
```
|
|
78
|
+
manifest/
|
|
79
|
+
├── __init__.star # Main API facade
|
|
80
|
+
├── constants.star # Constants and defaults
|
|
81
|
+
├── schema.star # Field schema definitions
|
|
82
|
+
├── errors.star # Error handling
|
|
83
|
+
├── loader.star # File loading and I/O
|
|
84
|
+
├── parser.star # JSON parsing and normalization
|
|
85
|
+
├── validator.star # Comprehensive validation ⭐ NEW (Phase 3)
|
|
86
|
+
├── tests/
|
|
87
|
+
│ ├── test_manifest.star # Unit tests (Phase 1)
|
|
88
|
+
│ ├── test_loader_parser.star # Integration tests (Phase 2)
|
|
89
|
+
│ └── test_validator.star # Validator tests (Phase 3) ⭐ NEW
|
|
90
|
+
└── README.md # This file
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## API Reference
|
|
96
|
+
|
|
97
|
+
### Constants
|
|
98
|
+
|
|
99
|
+
| Export | Description |
|
|
100
|
+
|--------|-------------|
|
|
101
|
+
| `Manifest.filename` | Manifest filename constant |
|
|
102
|
+
| `Manifest.defaults` | Default field values |
|
|
103
|
+
| `Manifest.app_types` | Valid app types |
|
|
104
|
+
| `Manifest.stacks` | Valid stacks |
|
|
105
|
+
| `Manifest.features` | Valid features |
|
|
106
|
+
| `Manifest.port_ranges` | Port ranges by app type |
|
|
107
|
+
| `Manifest.autogenerated_paths` | Autogenerated config paths |
|
|
108
|
+
|
|
109
|
+
### Loading Functions ⭐ NEW (Phase 2)
|
|
110
|
+
|
|
111
|
+
| Function | Description | Example |
|
|
112
|
+
|----------|-------------|---------|
|
|
113
|
+
| `load_from_file(path)` | Load manifest from file | `Manifest.load_from_file("path/to/manifest.json")` |
|
|
114
|
+
| `load_from_path(resource_path)` | Load from resource directory | `Manifest.load_from_path("services/product/user/my-resource")` |
|
|
115
|
+
| `load_all(root, filters)` | Load all with optional filters | `Manifest.load_all("services/product", {'appType': 'backend'})` |
|
|
116
|
+
| `get_manifest_path(path)` | Get expected manifest path | `Manifest.get_manifest_path("services/product/user/my-resource")` |
|
|
117
|
+
| `clear_cache()` | Clear manifest cache | `Manifest.clear_cache()` |
|
|
118
|
+
| `get_cache_stats()` | Get cache statistics | `Manifest.get_cache_stats()` |
|
|
119
|
+
| `is_cached(path)` | Check if path is cached | `Manifest.is_cached("path/to/manifest.json")` |
|
|
120
|
+
|
|
121
|
+
**Loading Result Structure:**
|
|
122
|
+
|
|
123
|
+
```starlark
|
|
124
|
+
result = Manifest.load_from_file("path/to/manifest.json")
|
|
125
|
+
|
|
126
|
+
# Result struct contains:
|
|
127
|
+
# result.manifest - Parsed manifest dict or None
|
|
128
|
+
# result.error - Error message or None
|
|
129
|
+
# result.warnings - List of warning messages
|
|
130
|
+
# result.metadata - Dict with path, from_cache, load_time_ms
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Load All Result Structure:**
|
|
134
|
+
|
|
135
|
+
```starlark
|
|
136
|
+
result = Manifest.load_all("services/product")
|
|
137
|
+
|
|
138
|
+
# Result struct contains:
|
|
139
|
+
# result.manifests - List of loaded manifests
|
|
140
|
+
# result.errors - List of error structs
|
|
141
|
+
# result.warnings - List of warning messages
|
|
142
|
+
# result.stats - Dict with total_found, successful, failed, filtered_out, from_cache
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Parsing Functions
|
|
146
|
+
|
|
147
|
+
| Function | Description | Example |
|
|
148
|
+
|----------|-------------|---------|
|
|
149
|
+
| `parse(content, path)` | Parse JSON content | `Manifest.parse(json_string, "path/for/context")` |
|
|
150
|
+
| `normalize(manifest, path)` | Apply defaults and compute fields | `Manifest.normalize(manifest, resource_path)` |
|
|
151
|
+
| `get_normalized(content, path)` | Parse + normalize in one call | `Manifest.get_normalized(json_string, resource_path)` |
|
|
152
|
+
| `extract_resource_path(manifest_path)` | Extract resource path | `Manifest.extract_resource_path("path/to/manifest.json")` |
|
|
153
|
+
| `extract_stack(resource_path)` | Extract stack from path | `Manifest.extract_stack("services/product/user/...")` |
|
|
154
|
+
| `parse_traefik(manifest)` | Parse Traefik config | `Manifest.parse_traefik(manifest)` |
|
|
155
|
+
| `merge_manifests(base, overlay)` | Merge two manifests | `Manifest.merge_manifests(base, overlay)` |
|
|
156
|
+
| `get_description(manifest)` | Get human-readable description | `Manifest.get_description(manifest)` |
|
|
157
|
+
|
|
158
|
+
**Parse Result Structure:**
|
|
159
|
+
|
|
160
|
+
```starlark
|
|
161
|
+
result = Manifest.parse(json_content)
|
|
162
|
+
|
|
163
|
+
# Result struct contains:
|
|
164
|
+
# result.manifest - Parsed manifest dict or None
|
|
165
|
+
# result.error - Error message or None
|
|
166
|
+
# result.warnings - List of warnings (e.g., deprecated fields)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Validation Functions ⭐ NEW (Phase 3)
|
|
170
|
+
|
|
171
|
+
| Function | Description | Example |
|
|
172
|
+
|----------|-------------|---------|
|
|
173
|
+
| `validate(manifest, context, level)` | Comprehensive validation | `Manifest.validate(manifest, level='all')` |
|
|
174
|
+
| `is_valid(manifest)` | Quick validity check | `if Manifest.is_valid(manifest): ...` |
|
|
175
|
+
| `get_validation_report(manifest)` | Generate detailed report | `print(Manifest.get_validation_report(m))` |
|
|
176
|
+
| `validate_schema(manifest)` | Schema validation only | `Manifest.validate_schema(manifest)` |
|
|
177
|
+
| `validate_values(manifest)` | Value validation only | `Manifest.validate_values(manifest)` |
|
|
178
|
+
| `validate_dependencies(manifest, all)` | Cross-resource validation | `Manifest.validate_dependencies(m, all_manifests)` |
|
|
179
|
+
|
|
180
|
+
**Validation Levels:**
|
|
181
|
+
|
|
182
|
+
| Level | Description |
|
|
183
|
+
|-------|-------------|
|
|
184
|
+
| `'schema'` | Structure and field types |
|
|
185
|
+
| `'values'` | Value ranges, patterns, formats |
|
|
186
|
+
| `'cross_field'` | Cross-field dependencies (e.g., frontend needs backend) |
|
|
187
|
+
| `'cross_resource'` | Port conflicts, dependency existence |
|
|
188
|
+
| `'all'` | All validations (default) |
|
|
189
|
+
|
|
190
|
+
**Validation Result Structure:**
|
|
191
|
+
|
|
192
|
+
```starlark
|
|
193
|
+
result = Manifest.validate(manifest, level='all')
|
|
194
|
+
|
|
195
|
+
# Result struct contains:
|
|
196
|
+
# result.valid - True if no errors
|
|
197
|
+
# result.errors - List of error structs
|
|
198
|
+
# result.warnings - List of warning structs
|
|
199
|
+
# result.stats - Dict with fields_checked, rules_passed, rules_failed
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Validation Context:**
|
|
203
|
+
|
|
204
|
+
```starlark
|
|
205
|
+
context = {
|
|
206
|
+
'all_manifests': all_manifests, # For cross-resource checks
|
|
207
|
+
'resource_path': path, # For error context
|
|
208
|
+
'strict': True, # Treat warnings as errors
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
result = Manifest.validate(manifest, context, level='all')
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Schema Functions
|
|
215
|
+
|
|
216
|
+
| Function | Description | Example |
|
|
217
|
+
|----------|-------------|---------|
|
|
218
|
+
| `get_field(name)` | Get field schema | `Manifest.get_field('port')` |
|
|
219
|
+
| `get_required_fields()` | List required fields | `Manifest.get_required_fields()` |
|
|
220
|
+
| `get_default(name)` | Get default value | `Manifest.get_default('replicas')` |
|
|
221
|
+
| `get_valid_values(name)` | Get enum values | `Manifest.get_valid_values('appType')` |
|
|
222
|
+
| `is_required(name)` | Check if required | `Manifest.is_required('appName')` |
|
|
223
|
+
| `is_deprecated(name)` | Check if deprecated | `Manifest.is_deprecated('apiBasePath')` |
|
|
224
|
+
| `get_all_fields()` | Get all field names | `Manifest.get_all_fields()` |
|
|
225
|
+
|
|
226
|
+
### Error Handling
|
|
227
|
+
|
|
228
|
+
| Function | Description |
|
|
229
|
+
|----------|-------------|
|
|
230
|
+
| `format_error(error)` | Format error for display |
|
|
231
|
+
| `group_errors(errors)` | Group errors by category |
|
|
232
|
+
| `has_critical_errors(errors)` | Check for critical errors |
|
|
233
|
+
| `get_error_summary(errors)` | Get error statistics |
|
|
234
|
+
|
|
235
|
+
### Integration Functions ⭐ NEW (Phase 4)
|
|
236
|
+
|
|
237
|
+
| Function | Description | Example |
|
|
238
|
+
|----------|-------------|---------|
|
|
239
|
+
| `load_and_validate_integration(path, all, use_new)` | Load with validation | `Manifest.load_and_validate_integration(path, all_manifests)` |
|
|
240
|
+
| `load_all_integration(root, filters, validate)` | Load all with integration | `Manifest.load_all_integration("services/product")` |
|
|
241
|
+
| `convert_to_resource(manifest)` | Convert to discovery format | `Manifest.convert_to_resource(manifest)` |
|
|
242
|
+
| `get_validation_summary(manifests)` | Get validation stats | `Manifest.get_validation_summary(all_manifests)` |
|
|
243
|
+
| `check_port_conflicts(manifests)` | Find port conflicts | `Manifest.check_port_conflicts(manifests)` |
|
|
244
|
+
| `check_dependencies_valid(manifests)` | Validate dependencies | `Manifest.check_dependencies_valid(manifests)` |
|
|
245
|
+
|
|
246
|
+
**Integration Result Structure:**
|
|
247
|
+
|
|
248
|
+
```starlark
|
|
249
|
+
result = Manifest.load_all_integration("services/product")
|
|
250
|
+
|
|
251
|
+
# Result struct contains:
|
|
252
|
+
# result.manifests - List of normalized manifests
|
|
253
|
+
# result.errors - List of error strings
|
|
254
|
+
# result.warnings - List of warning strings
|
|
255
|
+
# result.stats - Loading statistics
|
|
256
|
+
# result.by_name - Dict mapping appName to manifest
|
|
257
|
+
# result.by_port - Dict mapping port to manifest
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Convenience Functions
|
|
261
|
+
|
|
262
|
+
| Function | Description |
|
|
263
|
+
|----------|-------------|
|
|
264
|
+
| `is_valid_manifest(manifest)` | Quick validation check |
|
|
265
|
+
| `get_resource_type(manifest)` | Get human-readable type description |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Usage Examples
|
|
270
|
+
|
|
271
|
+
### Example 1: Load and Validate a Single Manifest
|
|
272
|
+
|
|
273
|
+
```starlark
|
|
274
|
+
load("../manifest/__init__.star", "Manifest")
|
|
275
|
+
|
|
276
|
+
manifest_path = "services/product/user/user-management-backend/service.json"
|
|
277
|
+
|
|
278
|
+
result = Manifest.load_from_file(manifest_path)
|
|
279
|
+
|
|
280
|
+
if result.error:
|
|
281
|
+
print("❌ Failed to load:", result.error)
|
|
282
|
+
else:
|
|
283
|
+
manifest = result.manifest
|
|
284
|
+
|
|
285
|
+
# Check if valid
|
|
286
|
+
if Manifest.is_valid_manifest(manifest):
|
|
287
|
+
print("✅ Valid manifest:", manifest['appName'])
|
|
288
|
+
print(" Type:", manifest['appType'])
|
|
289
|
+
print(" Stack:", manifest['stack'])
|
|
290
|
+
print(" Port:", manifest['port'])
|
|
291
|
+
else:
|
|
292
|
+
print("⚠️ Invalid manifest structure")
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Example 2: Parse and Normalize JSON
|
|
296
|
+
|
|
297
|
+
```starlark
|
|
298
|
+
json_content = '''
|
|
299
|
+
{
|
|
300
|
+
"appName": "my-new-service",
|
|
301
|
+
"appType": "backend",
|
|
302
|
+
"stack": "user",
|
|
303
|
+
"port": 4001,
|
|
304
|
+
"features": ["nats", "prisma"]
|
|
305
|
+
}
|
|
306
|
+
'''
|
|
307
|
+
|
|
308
|
+
result = Manifest.get_normalized(json_content, "services/product/user/my-new-service")
|
|
309
|
+
|
|
310
|
+
if result.error:
|
|
311
|
+
print("Error:", result.error)
|
|
312
|
+
else:
|
|
313
|
+
manifest = result.manifest
|
|
314
|
+
|
|
315
|
+
# Defaults applied
|
|
316
|
+
print("Replicas:", manifest['replicas']) # 1 (default)
|
|
317
|
+
print("Runtime:", manifest['runtime']) # bun (default)
|
|
318
|
+
print("Syncs:", manifest['syncs']) # auto-computed
|
|
319
|
+
|
|
320
|
+
# Traefik config created
|
|
321
|
+
print("Traefik pathPrefix:", manifest['traefik']['pathPrefix'])
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Example 3: Load All Backend Services
|
|
325
|
+
|
|
326
|
+
```starlark
|
|
327
|
+
# Load only backend services
|
|
328
|
+
result = Manifest.load_all(
|
|
329
|
+
"services/product",
|
|
330
|
+
filters={
|
|
331
|
+
'appType': 'backend',
|
|
332
|
+
'stack': ['user', 'order'],
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
print("Found {} manifests ({} successful, {} filtered out)".format(
|
|
337
|
+
result.stats['total_found'],
|
|
338
|
+
result.stats['successful'],
|
|
339
|
+
result.stats['filtered_out']
|
|
340
|
+
))
|
|
341
|
+
|
|
342
|
+
for manifest in result.manifests:
|
|
343
|
+
desc = Manifest.get_description(manifest)
|
|
344
|
+
print(" -", desc)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Example 4: Handle Loading Errors
|
|
348
|
+
|
|
349
|
+
```starlark
|
|
350
|
+
result = Manifest.load_all("services/product")
|
|
351
|
+
|
|
352
|
+
if result.errors:
|
|
353
|
+
print("⚠️ Some manifests failed to load:")
|
|
354
|
+
for error in result.errors:
|
|
355
|
+
formatted = Manifest.format_error(error)
|
|
356
|
+
print(" -", formatted)
|
|
357
|
+
|
|
358
|
+
# Check for critical errors
|
|
359
|
+
if Manifest.has_critical_errors(result.errors):
|
|
360
|
+
print("❌ Critical errors detected - aborting")
|
|
361
|
+
else:
|
|
362
|
+
print("✅ No critical errors")
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Example 5: Validate a Manifest ⭐ NEW (Phase 3)
|
|
366
|
+
|
|
367
|
+
```starlark
|
|
368
|
+
manifest = {
|
|
369
|
+
'appName': 'my-service',
|
|
370
|
+
'appType': 'backend',
|
|
371
|
+
'stack': 'user',
|
|
372
|
+
'port': 4001,
|
|
373
|
+
'features': ['nats', 'prisma'],
|
|
374
|
+
'databaseName': 'my_db',
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
# Full validation
|
|
378
|
+
result = Manifest.validate(manifest, level='all')
|
|
379
|
+
|
|
380
|
+
if result.valid:
|
|
381
|
+
print("✅ Manifest is valid!")
|
|
382
|
+
print(" Fields checked:", result.stats['fields_checked'])
|
|
383
|
+
else:
|
|
384
|
+
print("❌ Validation failed:")
|
|
385
|
+
for error in result.errors:
|
|
386
|
+
print(" -", Manifest.format_error(error))
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Example 6: Cross-Service Validation ⭐ NEW (Phase 3)
|
|
390
|
+
|
|
391
|
+
```starlark
|
|
392
|
+
# Load all manifests for cross-reference
|
|
393
|
+
all_manifests = Manifest.load_all("services/product").manifests
|
|
394
|
+
|
|
395
|
+
# Validate a new manifest against existing ones
|
|
396
|
+
new_manifest = {
|
|
397
|
+
'appName': 'new-frontend',
|
|
398
|
+
'appType': 'frontend',
|
|
399
|
+
'stack': 'user',
|
|
400
|
+
'port': 3005,
|
|
401
|
+
'backendName': 'user-management-backend', # References existing service
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
result = Manifest.validate_dependencies(new_manifest, all_manifests)
|
|
405
|
+
|
|
406
|
+
if result.valid:
|
|
407
|
+
print("✅ Dependencies valid!")
|
|
408
|
+
else:
|
|
409
|
+
print("❌ Dependency issues:")
|
|
410
|
+
for error in result.errors:
|
|
411
|
+
print(" -", error.message)
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Example 7: Generate Validation Report ⭐ NEW (Phase 3)
|
|
415
|
+
|
|
416
|
+
```starlark
|
|
417
|
+
manifest = {
|
|
418
|
+
'appName': 'test-service',
|
|
419
|
+
'appType': 'backend',
|
|
420
|
+
'stack': 'user',
|
|
421
|
+
'port': 4001,
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
# Generate detailed report
|
|
425
|
+
report = Manifest.get_validation_report(manifest)
|
|
426
|
+
print(report)
|
|
427
|
+
|
|
428
|
+
# Output:
|
|
429
|
+
# ======================================================================
|
|
430
|
+
# 📋 MANIFEST VALIDATION REPORT
|
|
431
|
+
# ======================================================================
|
|
432
|
+
# Status: ✅ PASSED
|
|
433
|
+
#
|
|
434
|
+
# Fields Checked: 15
|
|
435
|
+
# Rules Passed: 14
|
|
436
|
+
# Rules Failed: 0
|
|
437
|
+
#
|
|
438
|
+
# ======================================================================
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Example 8: Schema-Only Validation ⭐ NEW (Phase 3)
|
|
442
|
+
|
|
443
|
+
```starlark
|
|
444
|
+
# Just check structure and types
|
|
445
|
+
result = Manifest.validate_schema(manifest)
|
|
446
|
+
|
|
447
|
+
# Just check values (ranges, patterns)
|
|
448
|
+
result = Manifest.validate_values(manifest)
|
|
449
|
+
|
|
450
|
+
# Quick check
|
|
451
|
+
if Manifest.is_valid(manifest):
|
|
452
|
+
print("Manifest is valid!")
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Example 9: Batch Validation with Integration ⭐ NEW (Phase 4)
|
|
456
|
+
|
|
457
|
+
```starlark
|
|
458
|
+
# Load all manifests with integration
|
|
459
|
+
result = Manifest.load_all_integration("services/product")
|
|
460
|
+
|
|
461
|
+
print("Loaded {} manifests".format(len(result.manifests)))
|
|
462
|
+
print("Errors: {}".format(len(result.errors)))
|
|
463
|
+
print("Warnings: {}".format(len(result.warnings)))
|
|
464
|
+
|
|
465
|
+
# Get validation summary
|
|
466
|
+
summary = Manifest.get_validation_summary(result.manifests)
|
|
467
|
+
print("Valid: {}/{}".format(summary['valid'], summary['total']))
|
|
468
|
+
print("Errors by severity: {}".format(summary['by_severity']))
|
|
469
|
+
|
|
470
|
+
# Check for port conflicts
|
|
471
|
+
conflicts = Manifest.check_port_conflicts(result.manifests)
|
|
472
|
+
if conflicts:
|
|
473
|
+
print("⚠️ Port conflicts detected:")
|
|
474
|
+
for conflict in conflicts:
|
|
475
|
+
print(" -", Manifest.format_error(conflict))
|
|
476
|
+
|
|
477
|
+
# Check dependencies
|
|
478
|
+
dep_issues = Manifest.check_dependencies_valid(result.manifests)
|
|
479
|
+
if dep_issues:
|
|
480
|
+
print("⚠️ Dependency issues:")
|
|
481
|
+
for issue in dep_issues:
|
|
482
|
+
print(" -", Manifest.format_error(issue))
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Example 10: Discovery Integration ⭐ NEW (Phase 4)
|
|
486
|
+
|
|
487
|
+
```starlark
|
|
488
|
+
# Use integration layer for discovery system
|
|
489
|
+
result = Manifest.load_and_validate_integration(
|
|
490
|
+
manifest_path="services/product/user/user-management-backend/service.json",
|
|
491
|
+
all_manifests=all_manifests, # For cross-validation
|
|
492
|
+
)
|
|
493
|
+
|
|
494
|
+
if result.validation:
|
|
495
|
+
print("Validation: {} errors, {} warnings".format(
|
|
496
|
+
len([e for e in result.validation.errors if e.severity == 'error']),
|
|
497
|
+
len(result.validation.warnings)
|
|
498
|
+
))
|
|
499
|
+
|
|
500
|
+
# Convert to discovery resource format
|
|
501
|
+
resource = Manifest.convert_to_resource(result.manifest)
|
|
502
|
+
print("Resource name:", resource['name'])
|
|
503
|
+
print("Resource type:", 'frontend' if resource.get('frontend') else 'backend')
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## Backward Compatibility
|
|
509
|
+
|
|
510
|
+
**Old imports still work (deprecated):**
|
|
511
|
+
|
|
512
|
+
```starlark
|
|
513
|
+
# DEPRECATED - will be removed in Phase 5
|
|
514
|
+
load("../discovery/manifest/constants.star", "MANIFEST_DEFAULTS")
|
|
515
|
+
|
|
516
|
+
# NEW - recommended
|
|
517
|
+
load("../manifest/__init__.star", "Manifest")
|
|
518
|
+
# Use Manifest.defaults instead of MANIFEST_DEFAULTS
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Testing
|
|
524
|
+
|
|
525
|
+
### Run Unit Tests
|
|
526
|
+
|
|
527
|
+
```starlark
|
|
528
|
+
# Phase 1 tests (constants, schema, errors)
|
|
529
|
+
load("./manifest/tests/test_manifest.star", "TestManifest")
|
|
530
|
+
TestManifest.run()
|
|
531
|
+
|
|
532
|
+
# Phase 2 tests (loader, parser)
|
|
533
|
+
load("./manifest/tests/test_loader_parser.star", "TestLoaderParser")
|
|
534
|
+
TestLoaderParser.run()
|
|
535
|
+
|
|
536
|
+
# Phase 3 tests (validator)
|
|
537
|
+
load("./manifest/tests/test_validator.star", "TestValidator")
|
|
538
|
+
TestValidator.run()
|
|
539
|
+
|
|
540
|
+
# Phase 4 tests (integration)
|
|
541
|
+
load("./manifest/tests/test_integration.star", "TestIntegration")
|
|
542
|
+
TestIntegration.run()
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Run All Tests
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
# When Tilt test runner is available:
|
|
549
|
+
tilt test manifest/
|
|
550
|
+
|
|
551
|
+
# Or manually in Tiltfile:
|
|
552
|
+
load("./manifest/tests/test_manifest.star", "TestManifest")
|
|
553
|
+
load("./manifest/tests/test_loader_parser.star", "TestLoaderParser")
|
|
554
|
+
load("./manifest/tests/test_validator.star", "TestValidator")
|
|
555
|
+
load("./manifest/tests/test_integration.star", "TestIntegration")
|
|
556
|
+
|
|
557
|
+
print("\n=== Phase 1 Tests ===")
|
|
558
|
+
TestManifest.run()
|
|
559
|
+
|
|
560
|
+
print("\n=== Phase 2 Tests ===")
|
|
561
|
+
TestLoaderParser.run()
|
|
562
|
+
|
|
563
|
+
print("\n=== Phase 3 Tests ===")
|
|
564
|
+
TestValidator.run()
|
|
565
|
+
|
|
566
|
+
print("\n=== Phase 4 Tests ===")
|
|
567
|
+
TestIntegration.run()
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Migration Phases
|
|
573
|
+
|
|
574
|
+
| Phase | Status | Description |
|
|
575
|
+
|-------|--------|-------------|
|
|
576
|
+
| Phase 1 | ✅ Complete | Foundation: constants, errors, schema |
|
|
577
|
+
| Phase 2 | ✅ Complete | Core: loader, parser |
|
|
578
|
+
| Phase 3 | ✅ Complete | Validation: validator, rules |
|
|
579
|
+
| Phase 4 | ✅ Complete | Integration: discovery system integration |
|
|
580
|
+
| Phase 5 | ✅ Complete | Cleanup: removed deprecated code |
|
|
581
|
+
|
|
582
|
+
### Phase 5 Features (✅ Complete)
|
|
583
|
+
|
|
584
|
+
- **Final Cleanup**
|
|
585
|
+
- Removed backward compatibility layer
|
|
586
|
+
- Removed feature flags
|
|
587
|
+
- Updated discovery.star to use new system exclusively
|
|
588
|
+
- Deleted migration patch files
|
|
589
|
+
- All 5 phases complete!
|
|
590
|
+
|
|
591
|
+
### Phase 4 Features (✅ Complete)
|
|
592
|
+
|
|
593
|
+
- **Discovery Integration** (`integration.star`)
|
|
594
|
+
- Integration layer for discovery system
|
|
595
|
+
- Backward compatibility with legacy discovery
|
|
596
|
+
- Batch validation across all resources
|
|
597
|
+
- Port conflict detection across resources
|
|
598
|
+
- Dependency validation across resources
|
|
599
|
+
- Validation summary reports
|
|
600
|
+
- Feature flag for gradual rollout
|
|
601
|
+
|
|
602
|
+
### Phase 3 Features (✅ Complete)
|
|
603
|
+
|
|
604
|
+
- **Validation** (`validator.star`)
|
|
605
|
+
- 4-level validation (schema, values, cross-field, cross-resource)
|
|
606
|
+
- Schema validation (required fields, types, constraints)
|
|
607
|
+
- Value validation (port ranges, name formats, patterns)
|
|
608
|
+
- Cross-field validation (frontend needs backend, prisma needs database)
|
|
609
|
+
- Cross-resource validation (port conflicts, dependency existence)
|
|
610
|
+
- Validation reports with detailed statistics
|
|
611
|
+
- Strict mode (warnings as errors)
|
|
612
|
+
|
|
613
|
+
### Phase 2 Features (✅ Complete)
|
|
614
|
+
|
|
615
|
+
- **File Loading** (`loader.star`)
|
|
616
|
+
- Load single manifest from file
|
|
617
|
+
- Load from resource directory
|
|
618
|
+
- Load all with filtering
|
|
619
|
+
- In-memory caching
|
|
620
|
+
- Error handling with context
|
|
621
|
+
|
|
622
|
+
- **Parsing & Normalization** (`parser.star`)
|
|
623
|
+
- JSON parsing with validation
|
|
624
|
+
- Automatic field normalization
|
|
625
|
+
- Default value application
|
|
626
|
+
- Stack/appType extraction from paths
|
|
627
|
+
- Traefik configuration generation
|
|
628
|
+
- Manifest merging for inheritance
|
|
629
|
+
- Frontend/backend detection
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
## Performance
|
|
634
|
+
|
|
635
|
+
### Caching
|
|
636
|
+
|
|
637
|
+
The loader maintains an in-memory cache to avoid redundant file I/O:
|
|
638
|
+
|
|
639
|
+
```starlark
|
|
640
|
+
# First load reads from disk
|
|
641
|
+
result1 = Manifest.load_from_file("path/to/manifest.json")
|
|
642
|
+
print(result1.metadata['from_cache']) # False
|
|
643
|
+
|
|
644
|
+
# Second load uses cache
|
|
645
|
+
result2 = Manifest.load_from_file("path/to/manifest.json")
|
|
646
|
+
print(result2.metadata['from_cache']) # True
|
|
647
|
+
|
|
648
|
+
# Clear cache when needed
|
|
649
|
+
Manifest.clear_cache()
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### Loading Statistics
|
|
653
|
+
|
|
654
|
+
```starlark
|
|
655
|
+
result = Manifest.load_all("services/product")
|
|
656
|
+
print("Loaded {} manifests in {} ms".format(
|
|
657
|
+
result.stats['successful'],
|
|
658
|
+
result.stats.get('total_time_ms', 0)
|
|
659
|
+
))
|
|
660
|
+
print("From cache:", result.stats['from_cache'])
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
## Future Enhancements
|
|
666
|
+
|
|
667
|
+
- **Phase 4:** `fetch.star` - Remote manifest fetching
|
|
668
|
+
- **Phase 5:** Cleanup deprecated code
|
|
669
|
+
|
|
670
|
+
### Completed Phases
|
|
671
|
+
|
|
672
|
+
- **Phase 1:** Foundation (constants, schema, errors) ✅
|
|
673
|
+
- **Phase 2:** Core (loader, parser) ✅
|
|
674
|
+
- **Phase 3:** Validation (validator, comprehensive rules) ✅
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
## Contributing
|
|
679
|
+
|
|
680
|
+
When adding new features:
|
|
681
|
+
|
|
682
|
+
1. Add implementation to appropriate module
|
|
683
|
+
2. Wire up to `__init__.star` facade
|
|
684
|
+
3. Add tests to `tests/` directory
|
|
685
|
+
4. Update this README with examples
|
|
686
|
+
5. Mark Phase X status if applicable
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
## See Also
|
|
691
|
+
|
|
692
|
+
- [Refactoring Plan](../REFACTORING_MANIFEST_SYSTEM.md) - Full refactoring roadmap
|
|
693
|
+
- [AGENTS.md](../../../AGENTS.md) - Agent ecosystem documentation
|