@tdk-landscape/tdk-cli-core 1.3.45 → 1.3.49
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/.github/workflows/release-binaries.yml +54 -0
- package/.pre-commit-config.yaml +57 -0
- package/Makefile +92 -0
- package/bun.lock +538 -0
- package/cli/AGENTS.md +390 -0
- package/cli/DESIGN.md +735 -0
- package/cli/biome.json +44 -0
- package/cli/dependency-graph.svg +1135 -0
- package/cli/knip.json +6 -0
- package/cli/package.json +77 -0
- package/cli/pnpm-lock.yaml +2305 -0
- package/cli/pnpm-workspace.yaml +2 -0
- package/cli/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +23 -0
- package/cli/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +464 -0
- package/cli/shared-platform-engineering/docker-templates/install-deps.sh +152 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +12 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +56 -0
- package/{dist/cli.js → cli/src/cli.ts} +21 -13
- package/cli/src/commands/__tests__/always-enabled-infra.test.ts +115 -0
- package/cli/src/commands/__tests__/config.test.ts +146 -0
- package/cli/src/commands/__tests__/doctor.test.ts +557 -0
- package/cli/src/commands/__tests__/error-handling.test.ts +78 -0
- package/cli/src/commands/__tests__/phases-model.test.ts +163 -0
- package/cli/src/commands/__tests__/project-resource-features-e2e.test.ts +207 -0
- package/cli/src/commands/__tests__/project.test.ts +68 -0
- package/cli/src/commands/__tests__/resource.test.ts +226 -0
- package/cli/src/commands/__tests__/saas-starter-integration.test.ts +196 -0
- package/cli/src/commands/__tests__/stack-features-e2e.test.ts +129 -0
- package/cli/src/commands/__tests__/upgrade.test.ts +101 -0
- package/{dist/commands/completion.js → cli/src/commands/completion.ts} +78 -72
- package/cli/src/commands/config.ts +299 -0
- package/cli/src/commands/doctor.ts +790 -0
- package/cli/src/commands/down.ts +37 -0
- package/cli/src/commands/help.ts +150 -0
- package/cli/src/commands/networks-design.md +80 -0
- package/cli/src/commands/networks.ts +332 -0
- package/cli/src/commands/project.ts +439 -0
- package/cli/src/commands/projects.ts +82 -0
- package/cli/src/commands/resource.ts +652 -0
- package/cli/src/commands/resources.ts +95 -0
- package/cli/src/commands/stack.ts +128 -0
- package/cli/src/commands/stacks.ts +52 -0
- package/cli/src/commands/status.ts +88 -0
- package/cli/src/commands/ui.tsx +843 -0
- package/cli/src/commands/up.ts +150 -0
- package/cli/src/commands/upgrade.ts +570 -0
- package/{dist/commands/version.js → cli/src/commands/version.ts} +5 -5
- package/cli/src/components/Accessible.tsx +21 -0
- package/cli/src/components/BaseTooltip.tsx +66 -0
- package/cli/src/components/DetailPanel.tsx +146 -0
- package/cli/src/components/FileTree.tsx +89 -0
- package/cli/src/components/ResourceSelectInput.tsx +30 -0
- package/cli/src/components/ResourceTable.tsx +78 -0
- package/cli/src/components/TabBar.tsx +53 -0
- package/cli/src/components/Tooltip.tsx +11 -0
- package/{dist/components/index.js → cli/src/components/index.ts} +0 -1
- package/cli/src/config/platform-standards.test.ts +11 -0
- package/cli/src/config/platform-standards.ts +196 -0
- package/cli/src/generator/__tests__/extension-fetch.test.ts +220 -0
- package/cli/src/generator/__tests__/template-engine.test.ts +70 -0
- package/cli/src/generator/extension-fetch.ts +279 -0
- package/cli/src/generator/template-engine.ts +754 -0
- package/cli/src/index.ts +86 -0
- package/cli/src/templates.d.ts +4 -0
- package/cli/src/types/index.ts +351 -0
- package/cli/src/utils/__tests__/cache.test.ts +98 -0
- package/cli/src/utils/__tests__/formatting.test.ts +170 -0
- package/cli/src/utils/__tests__/paths.test.ts +180 -0
- package/cli/src/utils/__tests__/port-assignment.test.ts +121 -0
- package/cli/src/utils/__tests__/service-urls.test.ts +174 -0
- package/cli/src/utils/__tests__/services.test.ts +531 -0
- package/cli/src/utils/__tests__/tilt.test.ts +143 -0
- package/cli/src/utils/__tests__/validation.test.ts +148 -0
- package/cli/src/utils/cache.ts +76 -0
- package/cli/src/utils/command-helpers.ts +54 -0
- package/cli/src/utils/constants.ts +126 -0
- package/cli/src/utils/discovery-context.ts +49 -0
- package/cli/src/utils/docker.ts +20 -0
- package/cli/src/utils/doctor-runtime.ts +604 -0
- package/cli/src/utils/env-validator.ts +139 -0
- package/cli/src/utils/errors.ts +168 -0
- package/cli/src/utils/file-helpers.ts +62 -0
- package/cli/src/utils/formatting.ts +215 -0
- package/cli/src/utils/paths.ts +53 -0
- package/cli/src/utils/port-assignment.ts +106 -0
- package/cli/src/utils/project-features.ts +118 -0
- package/cli/src/utils/project-templates.ts +28 -0
- package/cli/src/utils/prompt.ts +123 -0
- package/cli/src/utils/resource-features.ts +209 -0
- package/cli/src/utils/service-urls.ts +124 -0
- package/cli/src/utils/services.ts +363 -0
- package/cli/src/utils/stack-features.ts +30 -0
- package/cli/src/utils/tar.ts +24 -0
- package/cli/src/utils/tilt.ts +113 -0
- package/cli/src/utils/validation.ts +67 -0
- package/{templates → cli/templates}/Tiltfile.hbs +1 -1
- package/cli/tsconfig.json +25 -0
- package/cli/tsconfig.typecheck.json +8 -0
- package/docs/FEATURES.md +279 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +3 -3
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +1 -1
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +0 -3
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +1 -1
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +1 -1
- package/engine/topologies/platform/docker/secrets/infisical.star +19 -47
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +1 -1
- package/install.sh +242 -0
- package/knip.json +10 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/.openspec.yaml +2 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/design.md +102 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/proposal.md +31 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/specs/vscode-tdk-notifications/spec.md +48 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/specs/vscode-tdk-orchestration/spec.md +63 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/specs/vscode-tdk-troubleshooting/spec.md +56 -0
- package/openspec/changes/add-vscode-tdk-troubleshooter-plugin/tasks.md +61 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/design.md +114 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/proposal.md +32 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/specs/manifest-field-migration/spec.md +20 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/specs/resource-terminology-standard/spec.md +20 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/specs/stack-terminology-standard/spec.md +20 -0
- package/openspec/changes/archive/2026-04-28-rename-domain-to-stack-service-to-resource/tasks.md +194 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/design.md +111 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/proposal.md +33 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/specs/function-naming-alignment/spec.md +12 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/specs/optional-parameter-patterns/spec.md +18 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/specs/parameter-documentation/spec.md +16 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/specs/parameter-naming-consistency/spec.md +12 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/specs/parameter-ordering-standard/spec.md +12 -0
- package/openspec/changes/archive/2026-04-28-star-files-parameter-fixes/tasks.md +194 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/codebase-audit-report.md +62 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/design.md +84 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/proposal.md +31 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/specs/codebase-audit/spec.md +27 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/specs/dead-code-cleanup/spec.md +27 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/specs/test-gap-fill/spec.md +23 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/specs/todo-resolution/spec.md +27 -0
- package/openspec/changes/archive/2026-04-29-scan-repo-gaps-fix/tasks.md +39 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/.openspec.yaml +5 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/design.md +94 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/proposal.md +46 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/ai-slop-cleanup/CLEANUP_REPORT_8.md +174 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/ai-slop-cleanup/CRITICAL_ASSESSMENT_8.md +160 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/circular-deps/CRITICAL_ASSESSMENT_4.md +381 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/dead-code/CRITICAL_ASSESSMENT_3.md +316 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/deduplication/CRITICAL_ASSESSMENT_1.md +290 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/deduplication/IMPLEMENTATION_SUMMARY_1.md +233 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/defensive-cleanup/CRITICAL_ASSESSMENT_6.md +835 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/legacy-cleanup/CRITICAL_ASSESSMENT_7.md +254 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/legacy-cleanup/IMPLEMENTATION_SUMMARY_7.md +187 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/strong-typing/CRITICAL_ASSESSMENT_5.md +269 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/type-consolidation/CRITICAL_ASSESSMENT_2.md +312 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/specs/type-consolidation/IMPLEMENTATION_SUMMARY.md +170 -0
- package/openspec/changes/archive/2026-05-04-comprehensive-cleanup-final/tasks.md +137 -0
- package/openspec/changes/archive/2026-06-25-landscape-consolidation/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-06-25-landscape-consolidation/design.md +80 -0
- package/openspec/changes/archive/2026-06-25-landscape-consolidation/proposal.md +40 -0
- package/openspec/changes/archive/2026-06-25-landscape-consolidation/spec.md +52 -0
- package/openspec/changes/archive/2026-06-25-landscape-consolidation/tasks.md +51 -0
- package/openspec/changes/archive/2026-09-17-fix-generated-stack-boot/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-09-17-fix-generated-stack-boot/design.md +43 -0
- package/openspec/changes/archive/2026-09-17-fix-generated-stack-boot/proposal.md +29 -0
- package/openspec/changes/archive/2026-09-17-fix-generated-stack-boot/specs/self-contained-generated-projects/spec.md +67 -0
- package/openspec/changes/archive/2026-09-17-fix-generated-stack-boot/tasks.md +27 -0
- package/openspec/specs/manifest-field-migration/spec.md +24 -0
- package/openspec/specs/resource-terminology-standard/spec.md +24 -0
- package/openspec/specs/self-contained-generated-projects/spec.md +67 -0
- package/openspec/specs/stack-terminology-standard/spec.md +24 -0
- package/package.json +27 -64
- package/platform/services/platform/proxy/service.yaml +14 -0
- package/scripts/audit-codebase.sh +213 -0
- package/scripts/install-git-hooks.sh +14 -0
- package/scripts/release-binaries.sh +94 -0
- package/scripts/setup-pre-commit.sh +33 -0
- package/scripts/stage-npm-engine.sh +36 -0
- package/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +23 -0
- package/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +464 -0
- package/shared-platform-engineering/docker-templates/install-deps.sh +152 -0
- package/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +12 -0
- package/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +56 -0
- package/tests/tilt-engine/__init__.py +5 -0
- package/tests/tilt-engine/conftest.py +182 -0
- package/tests/tilt-engine/fixtures/appointment-frontend-service.json +11 -0
- package/tests/tilt-engine/fixtures/identity-backend-service.json +12 -0
- package/tests/tilt-engine/fixtures/invalid-service.json +4 -0
- package/tests/tilt-engine/test_agents_md_generator.py +341 -0
- package/tests/tilt-engine/test_agents_md_integration.py +378 -0
- package/tests/tilt-engine/test_cache_operations.py +181 -0
- package/tests/tilt-engine/test_cache_persistence.py +142 -0
- package/tests/tilt-engine/test_code_executor.py +152 -0
- package/tests/tilt-engine/test_code_viewer.py +127 -0
- package/tests/tilt-engine/test_compose_port_anchors.py +310 -0
- package/tests/tilt-engine/test_config_inspector.py +162 -0
- package/tests/tilt-engine/test_daemon_focus_mode.py +89 -0
- package/tests/tilt-engine/test_daemon_polling.py +122 -0
- package/tests/tilt-engine/test_daemon_registration.py +115 -0
- package/tests/tilt-engine/test_daemon_validation.py +107 -0
- package/tests/tilt-engine/test_docker_generator_bugs.py +493 -0
- package/tests/tilt-engine/test_docker_prune.py +119 -0
- package/tests/tilt-engine/test_dockerignore_path_bug.py +82 -0
- package/tests/tilt-engine/test_file_browser.py +193 -0
- package/tests/tilt-engine/test_frontend_basepath_manifest.py +27 -0
- package/tests/tilt-engine/test_health_dependencies.py +130 -0
- package/tests/tilt-engine/test_health_endpoints.py +118 -0
- package/tests/tilt-engine/test_health_tilt_ui.py +85 -0
- package/tests/tilt-engine/test_safety_aliases.py +84 -0
- package/tests/tilt-engine/test_snapshot_diff.py +136 -0
- package/tests/tilt-engine/test_snapshot_persistence.py +163 -0
- package/tests/tilt-engine/test_snapshot_scanning.py +123 -0
- package/tests/tilt-engine/test_standalone_project_boot.py +61 -0
- package/tests/tilt-engine/test_standalone_traefik.py +108 -0
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/completion.d.ts +0 -3
- package/dist/commands/completion.d.ts.map +0 -1
- package/dist/commands/completion.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -231
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -7
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -597
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/down.d.ts +0 -3
- package/dist/commands/down.d.ts.map +0 -1
- package/dist/commands/down.js +0 -32
- package/dist/commands/down.js.map +0 -1
- package/dist/commands/help.d.ts +0 -2
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js +0 -130
- package/dist/commands/help.js.map +0 -1
- package/dist/commands/networks.d.ts +0 -3
- package/dist/commands/networks.d.ts.map +0 -1
- package/dist/commands/networks.js +0 -260
- package/dist/commands/networks.js.map +0 -1
- package/dist/commands/project.d.ts +0 -3
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -373
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/projects.d.ts +0 -3
- package/dist/commands/projects.d.ts.map +0 -1
- package/dist/commands/projects.js +0 -71
- package/dist/commands/projects.js.map +0 -1
- package/dist/commands/resource.d.ts +0 -69
- package/dist/commands/resource.d.ts.map +0 -1
- package/dist/commands/resource.js +0 -579
- package/dist/commands/resource.js.map +0 -1
- package/dist/commands/resources.d.ts +0 -3
- package/dist/commands/resources.d.ts.map +0 -1
- package/dist/commands/resources.js +0 -73
- package/dist/commands/resources.js.map +0 -1
- package/dist/commands/stack.d.ts +0 -3
- package/dist/commands/stack.d.ts.map +0 -1
- package/dist/commands/stack.js +0 -97
- package/dist/commands/stack.js.map +0 -1
- package/dist/commands/stacks.d.ts +0 -3
- package/dist/commands/stacks.d.ts.map +0 -1
- package/dist/commands/stacks.js +0 -43
- package/dist/commands/stacks.js.map +0 -1
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -71
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/ui.d.ts +0 -3
- package/dist/commands/ui.d.ts.map +0 -1
- package/dist/commands/ui.js +0 -445
- package/dist/commands/ui.js.map +0 -1
- package/dist/commands/up.d.ts +0 -3
- package/dist/commands/up.d.ts.map +0 -1
- package/dist/commands/up.js +0 -110
- package/dist/commands/up.js.map +0 -1
- package/dist/commands/upgrade.d.ts +0 -11
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -496
- package/dist/commands/upgrade.js.map +0 -1
- package/dist/commands/version.d.ts +0 -3
- package/dist/commands/version.d.ts.map +0 -1
- package/dist/commands/version.js.map +0 -1
- package/dist/components/Accessible.d.ts +0 -8
- package/dist/components/Accessible.d.ts.map +0 -1
- package/dist/components/Accessible.js +0 -10
- package/dist/components/Accessible.js.map +0 -1
- package/dist/components/BaseTooltip.d.ts +0 -4
- package/dist/components/BaseTooltip.d.ts.map +0 -1
- package/dist/components/BaseTooltip.js +0 -28
- package/dist/components/BaseTooltip.js.map +0 -1
- package/dist/components/DetailPanel.d.ts +0 -4
- package/dist/components/DetailPanel.d.ts.map +0 -1
- package/dist/components/DetailPanel.js +0 -18
- package/dist/components/DetailPanel.js.map +0 -1
- package/dist/components/FileTree.d.ts +0 -4
- package/dist/components/FileTree.d.ts.map +0 -1
- package/dist/components/FileTree.js +0 -47
- package/dist/components/FileTree.js.map +0 -1
- package/dist/components/ResourceSelectInput.d.ts +0 -4
- package/dist/components/ResourceSelectInput.d.ts.map +0 -1
- package/dist/components/ResourceSelectInput.js +0 -7
- package/dist/components/ResourceSelectInput.js.map +0 -1
- package/dist/components/ResourceTable.d.ts +0 -4
- package/dist/components/ResourceTable.d.ts.map +0 -1
- package/dist/components/ResourceTable.js +0 -18
- package/dist/components/ResourceTable.js.map +0 -1
- package/dist/components/TabBar.d.ts +0 -4
- package/dist/components/TabBar.d.ts.map +0 -1
- package/dist/components/TabBar.js +0 -17
- package/dist/components/TabBar.js.map +0 -1
- package/dist/components/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip.js +0 -12
- package/dist/components/Tooltip.js.map +0 -1
- package/dist/components/index.d.ts +0 -8
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/config/platform-standards.d.ts +0 -159
- package/dist/config/platform-standards.d.ts.map +0 -1
- package/dist/config/platform-standards.js +0 -181
- package/dist/config/platform-standards.js.map +0 -1
- package/dist/generator/extension-fetch.d.ts +0 -25
- package/dist/generator/extension-fetch.d.ts.map +0 -1
- package/dist/generator/extension-fetch.js +0 -252
- package/dist/generator/extension-fetch.js.map +0 -1
- package/dist/generator/template-engine.d.ts +0 -61
- package/dist/generator/template-engine.d.ts.map +0 -1
- package/dist/generator/template-engine.js +0 -557
- package/dist/generator/template-engine.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -255
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -17
- package/dist/types/index.js.map +0 -1
- package/dist/utils/cache.d.ts +0 -19
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -64
- package/dist/utils/cache.js.map +0 -1
- package/dist/utils/command-helpers.d.ts +0 -17
- package/dist/utils/command-helpers.d.ts.map +0 -1
- package/dist/utils/command-helpers.js +0 -41
- package/dist/utils/command-helpers.js.map +0 -1
- package/dist/utils/constants.d.ts +0 -52
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -112
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/discovery-context.d.ts +0 -4
- package/dist/utils/discovery-context.d.ts.map +0 -1
- package/dist/utils/discovery-context.js +0 -39
- package/dist/utils/discovery-context.js.map +0 -1
- package/dist/utils/docker.d.ts +0 -4
- package/dist/utils/docker.d.ts.map +0 -1
- package/dist/utils/docker.js +0 -19
- package/dist/utils/docker.js.map +0 -1
- package/dist/utils/doctor-runtime.d.ts +0 -66
- package/dist/utils/doctor-runtime.d.ts.map +0 -1
- package/dist/utils/doctor-runtime.js +0 -469
- package/dist/utils/doctor-runtime.js.map +0 -1
- package/dist/utils/env-validator.d.ts +0 -15
- package/dist/utils/env-validator.d.ts.map +0 -1
- package/dist/utils/env-validator.js +0 -109
- package/dist/utils/env-validator.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -31
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -140
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/file-helpers.d.ts +0 -14
- package/dist/utils/file-helpers.d.ts.map +0 -1
- package/dist/utils/file-helpers.js +0 -45
- package/dist/utils/file-helpers.js.map +0 -1
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +0 -1
- package/dist/utils/formatting.js +0 -164
- package/dist/utils/formatting.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -3
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js +0 -41
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/port-assignment.d.ts +0 -6
- package/dist/utils/port-assignment.d.ts.map +0 -1
- package/dist/utils/port-assignment.js +0 -81
- package/dist/utils/port-assignment.js.map +0 -1
- package/dist/utils/project-features.d.ts +0 -23
- package/dist/utils/project-features.d.ts.map +0 -1
- package/dist/utils/project-features.js +0 -98
- package/dist/utils/project-features.js.map +0 -1
- package/dist/utils/project-templates.d.ts +0 -7
- package/dist/utils/project-templates.d.ts.map +0 -1
- package/dist/utils/project-templates.js +0 -24
- package/dist/utils/project-templates.js.map +0 -1
- package/dist/utils/prompt.d.ts +0 -28
- package/dist/utils/prompt.d.ts.map +0 -1
- package/dist/utils/prompt.js +0 -79
- package/dist/utils/prompt.js.map +0 -1
- package/dist/utils/resource-features.d.ts +0 -29
- package/dist/utils/resource-features.d.ts.map +0 -1
- package/dist/utils/resource-features.js +0 -171
- package/dist/utils/resource-features.js.map +0 -1
- package/dist/utils/service-urls.d.ts +0 -30
- package/dist/utils/service-urls.d.ts.map +0 -1
- package/dist/utils/service-urls.js +0 -93
- package/dist/utils/service-urls.js.map +0 -1
- package/dist/utils/services.d.ts +0 -18
- package/dist/utils/services.d.ts.map +0 -1
- package/dist/utils/services.js +0 -291
- package/dist/utils/services.js.map +0 -1
- package/dist/utils/stack-features.d.ts +0 -22
- package/dist/utils/stack-features.d.ts.map +0 -1
- package/dist/utils/stack-features.js +0 -13
- package/dist/utils/stack-features.js.map +0 -1
- package/dist/utils/tar.d.ts +0 -7
- package/dist/utils/tar.d.ts.map +0 -1
- package/dist/utils/tar.js +0 -21
- package/dist/utils/tar.js.map +0 -1
- package/dist/utils/tilt.d.ts +0 -19
- package/dist/utils/tilt.d.ts.map +0 -1
- package/dist/utils/tilt.js +0 -78
- package/dist/utils/tilt.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -16
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -58
- package/dist/utils/validation.js.map +0 -1
- /package/{README.md → cli/README.md} +0 -0
- /package/{bin → cli/bin}/tdk.js +0 -0
- /package/{templates → cli/templates}/.tiltignore.hbs +0 -0
- /package/{templates → cli/templates}/TILT_RESOURCE_DEFAULTS.star.hbs +0 -0
- /package/{templates → cli/templates}/TILT_TECH_STACK.star.hbs +0 -0
- /package/{templates → cli/templates}/spec.master.hbs +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for safety shell aliases.
|
|
3
|
+
Tests the alias configuration and functionality.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.safety
|
|
10
|
+
class TestSafetyAliases:
|
|
11
|
+
"""Tests for safety alias functionality."""
|
|
12
|
+
|
|
13
|
+
def test_safe_prune_alias_works(self):
|
|
14
|
+
"""
|
|
15
|
+
Scenario: Safe prune alias works
|
|
16
|
+
WHEN a user runs `docker-prune-safe` after sourcing aliases
|
|
17
|
+
THEN it SHALL execute `safe-docker-prune.sh standard`
|
|
18
|
+
"""
|
|
19
|
+
alias_mapping = {
|
|
20
|
+
"docker-prune-safe": "./scripts/safe-docker-prune.sh standard",
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
assert "docker-prune-safe" in alias_mapping
|
|
24
|
+
assert "safe-docker-prune.sh" in alias_mapping["docker-prune-safe"]
|
|
25
|
+
assert "standard" in alias_mapping["docker-prune-safe"]
|
|
26
|
+
|
|
27
|
+
def test_full_prune_alias_works(self):
|
|
28
|
+
"""
|
|
29
|
+
Scenario: Full prune alias works
|
|
30
|
+
WHEN a user runs `docker-prune-full` after sourcing aliases
|
|
31
|
+
THEN it SHALL execute `safe-docker-prune.sh full`
|
|
32
|
+
"""
|
|
33
|
+
alias_mapping = {
|
|
34
|
+
"docker-prune-full": "./scripts/safe-docker-prune.sh full",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
assert "docker-prune-full" in alias_mapping
|
|
38
|
+
assert "safe-docker-prune.sh" in alias_mapping["docker-prune-full"]
|
|
39
|
+
assert "full" in alias_mapping["docker-prune-full"]
|
|
40
|
+
|
|
41
|
+
def test_alias_is_idempotent(self):
|
|
42
|
+
"""
|
|
43
|
+
Scenario: Alias is idempotent
|
|
44
|
+
WHEN a user sources the aliases file multiple times
|
|
45
|
+
THEN the aliases SHALL remain functional
|
|
46
|
+
AND no duplicate definitions SHALL cause errors
|
|
47
|
+
"""
|
|
48
|
+
# Simulate sourcing aliases multiple times
|
|
49
|
+
aliases = {}
|
|
50
|
+
|
|
51
|
+
# First source
|
|
52
|
+
aliases["docker-prune-safe"] = "./scripts/safe-docker-prune.sh standard"
|
|
53
|
+
|
|
54
|
+
# Second source (should overwrite, not duplicate)
|
|
55
|
+
aliases["docker-prune-safe"] = "./scripts/safe-docker-prune.sh standard"
|
|
56
|
+
|
|
57
|
+
# Third source
|
|
58
|
+
aliases["docker-prune-safe"] = "./scripts/safe-docker-prune.sh standard"
|
|
59
|
+
|
|
60
|
+
# Should still work correctly
|
|
61
|
+
assert len(aliases) == 1
|
|
62
|
+
assert aliases["docker-prune-safe"] == "./scripts/safe-docker-prune.sh standard"
|
|
63
|
+
|
|
64
|
+
def test_protected_volumes_alias_exists(self):
|
|
65
|
+
"""Test that docker-protected-volumes alias exists."""
|
|
66
|
+
alias_mapping = {
|
|
67
|
+
"docker-protected-volumes": "docker volume ls | grep -E '(verdaccio|infisical)'",
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
assert "docker-protected-volumes" in alias_mapping
|
|
71
|
+
assert "verdaccio" in alias_mapping["docker-protected-volumes"]
|
|
72
|
+
assert "infisical" in alias_mapping["docker-protected-volumes"]
|
|
73
|
+
|
|
74
|
+
def test_alias_commands_are_safe(self):
|
|
75
|
+
"""Test that aliased commands don't use --volumes with prune."""
|
|
76
|
+
alias_commands = [
|
|
77
|
+
"./scripts/safe-docker-prune.sh standard",
|
|
78
|
+
"./scripts/safe-docker-prune.sh full",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
for cmd in alias_commands:
|
|
82
|
+
# Safe commands should use the script, not direct docker prune
|
|
83
|
+
assert "safe-docker-prune.sh" in cmd, "Should use safe script"
|
|
84
|
+
assert "docker system prune" not in cmd or "--volumes" not in cmd, "Should not use dangerous direct prune"
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for snapshot diff detection functionality.
|
|
3
|
+
Tests the comparison between old and new snapshots.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
11
|
+
from resource_snapshot import diff_snapshots
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.mark.snapshot
|
|
15
|
+
class TestSnapshotDiff:
|
|
16
|
+
"""Tests for snapshot diff detection."""
|
|
17
|
+
|
|
18
|
+
def test_detects_new_services(self):
|
|
19
|
+
"""
|
|
20
|
+
Scenario: Detecting new services
|
|
21
|
+
WHEN a new service.json file appears in a previously empty directory
|
|
22
|
+
THEN the diff SHALL report "added" with the new service path and metadata
|
|
23
|
+
"""
|
|
24
|
+
old = {"services": [], "count": 0}
|
|
25
|
+
new = ["services/product/new/service.json"]
|
|
26
|
+
|
|
27
|
+
added, removed, modified = diff_snapshots(old, new)
|
|
28
|
+
|
|
29
|
+
assert added == {"services/product/new/service.json"}
|
|
30
|
+
assert removed == set()
|
|
31
|
+
assert modified == set()
|
|
32
|
+
|
|
33
|
+
def test_detects_removed_services(self):
|
|
34
|
+
"""
|
|
35
|
+
Scenario: Detecting removed services
|
|
36
|
+
WHEN an existing service.json file is deleted
|
|
37
|
+
THEN the diff SHALL report "removed" with the removed service path
|
|
38
|
+
"""
|
|
39
|
+
old = {"services": ["services/product/old/service.json"], "count": 1}
|
|
40
|
+
new = []
|
|
41
|
+
|
|
42
|
+
added, removed, modified = diff_snapshots(old, new)
|
|
43
|
+
|
|
44
|
+
assert added == set()
|
|
45
|
+
assert removed == {"services/product/old/service.json"}
|
|
46
|
+
assert modified == set()
|
|
47
|
+
|
|
48
|
+
def test_detects_modified_services(self, temp_dir):
|
|
49
|
+
"""
|
|
50
|
+
Scenario: Detecting modified services
|
|
51
|
+
WHEN an existing service.json file changes its content (hash differs)
|
|
52
|
+
THEN the diff SHALL report "modified" with the field changes and service path
|
|
53
|
+
"""
|
|
54
|
+
import os
|
|
55
|
+
original_dir = os.getcwd()
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
os.chdir(temp_dir)
|
|
59
|
+
|
|
60
|
+
# Create a service file
|
|
61
|
+
resource_dir = temp_dir / "services" / "product" / "test"
|
|
62
|
+
resource_dir.mkdir(parents=True)
|
|
63
|
+
resource_file = resource_dir / "service.json"
|
|
64
|
+
resource_file.write_text('{"name": "test", "version": "1.0.0"}')
|
|
65
|
+
|
|
66
|
+
# Use relative path for service
|
|
67
|
+
rel_path = "services/product/test/service.json"
|
|
68
|
+
|
|
69
|
+
# Create old snapshot with hash of old content
|
|
70
|
+
from resource_snapshot import compute_resource_hash
|
|
71
|
+
old_hash = compute_resource_hash(rel_path)
|
|
72
|
+
old = {
|
|
73
|
+
"services": [rel_path],
|
|
74
|
+
"count": 1,
|
|
75
|
+
"resource_hashes": {rel_path: old_hash}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Modify the file
|
|
79
|
+
resource_file.write_text('{"name": "test", "version": "2.0.0"}')
|
|
80
|
+
new = [rel_path]
|
|
81
|
+
|
|
82
|
+
added, removed, modified = diff_snapshots(old, new, use_hashes=True)
|
|
83
|
+
|
|
84
|
+
assert added == set()
|
|
85
|
+
assert removed == set()
|
|
86
|
+
assert modified == {rel_path}
|
|
87
|
+
finally:
|
|
88
|
+
os.chdir(original_dir)
|
|
89
|
+
|
|
90
|
+
def test_no_changes_detected(self):
|
|
91
|
+
"""
|
|
92
|
+
Scenario: No changes detected
|
|
93
|
+
WHEN the filesystem matches the existing snapshot exactly
|
|
94
|
+
THEN the diff SHALL report an empty changeset
|
|
95
|
+
"""
|
|
96
|
+
old = {
|
|
97
|
+
"services": [
|
|
98
|
+
"services/product/a/service.json",
|
|
99
|
+
"services/product/b/service.json"
|
|
100
|
+
],
|
|
101
|
+
"count": 2,
|
|
102
|
+
"hash": "abc123" # This hash will mismatch, but individual hashes match
|
|
103
|
+
}
|
|
104
|
+
new = [
|
|
105
|
+
"services/product/a/service.json",
|
|
106
|
+
"services/product/b/service.json"
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
# Without actual hash computation, should find no changes
|
|
110
|
+
added, removed, modified = diff_snapshots(old, new, use_hashes=False)
|
|
111
|
+
|
|
112
|
+
assert added == set()
|
|
113
|
+
assert removed == set()
|
|
114
|
+
assert modified == set()
|
|
115
|
+
|
|
116
|
+
def test_detects_both_added_and_removed(self):
|
|
117
|
+
"""Test detecting simultaneous additions and removals."""
|
|
118
|
+
old = {"services": ["a/service.json", "b/service.json"], "count": 2}
|
|
119
|
+
new = ["b/service.json", "c/service.json"]
|
|
120
|
+
|
|
121
|
+
added, removed, modified = diff_snapshots(old, new)
|
|
122
|
+
|
|
123
|
+
assert added == {"c/service.json"}
|
|
124
|
+
assert removed == {"a/service.json"}
|
|
125
|
+
assert modified == set()
|
|
126
|
+
|
|
127
|
+
def test_empty_to_multiple_services(self):
|
|
128
|
+
"""Test diff when going from empty to multiple services."""
|
|
129
|
+
old = {"services": [], "count": 0}
|
|
130
|
+
new = ["a/service.json", "b/service.json", "c/service.json"]
|
|
131
|
+
|
|
132
|
+
added, removed, modified = diff_snapshots(old, new)
|
|
133
|
+
|
|
134
|
+
assert added == {"a/service.json", "b/service.json", "c/service.json"}
|
|
135
|
+
assert removed == set()
|
|
136
|
+
assert modified == set()
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for snapshot persistence functionality.
|
|
3
|
+
Tests saving and loading snapshots from the filesystem.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import pytest
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.mark.snapshot
|
|
13
|
+
class TestSnapshotPersistence:
|
|
14
|
+
"""Tests for snapshot save/load operations."""
|
|
15
|
+
|
|
16
|
+
def test_saving_snapshot_creates_file(self, temp_dir):
|
|
17
|
+
"""
|
|
18
|
+
Scenario: Saving snapshot creates file
|
|
19
|
+
WHEN a snapshot is saved to `.tdk/.tdk-out/snapshots/resource-snapshot.json`
|
|
20
|
+
THEN the file SHALL exist with valid JSON containing all service data
|
|
21
|
+
"""
|
|
22
|
+
import sys
|
|
23
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
24
|
+
from resource_snapshot import save_snapshot
|
|
25
|
+
|
|
26
|
+
original_dir = os.getcwd()
|
|
27
|
+
os.chdir(temp_dir)
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
services = [
|
|
31
|
+
"services/product/a/service.json",
|
|
32
|
+
"services/product/b/service.json"
|
|
33
|
+
]
|
|
34
|
+
save_snapshot(services)
|
|
35
|
+
|
|
36
|
+
snapshot_file = Path(".tdk/.tdk-out/snapshots/resource-snapshot.json")
|
|
37
|
+
assert snapshot_file.exists(), "Snapshot file should be created"
|
|
38
|
+
|
|
39
|
+
# Verify content
|
|
40
|
+
with open(snapshot_file) as f:
|
|
41
|
+
data = json.load(f)
|
|
42
|
+
assert data["count"] == 2
|
|
43
|
+
assert data["services"] == services
|
|
44
|
+
assert "timestamp" in data
|
|
45
|
+
assert "hash" in data
|
|
46
|
+
finally:
|
|
47
|
+
os.chdir(original_dir)
|
|
48
|
+
|
|
49
|
+
def test_loading_snapshot_reads_file(self, temp_dir):
|
|
50
|
+
"""
|
|
51
|
+
Scenario: Loading snapshot reads file
|
|
52
|
+
WHEN a snapshot is loaded from an existing `.tdk/.tdk-out/snapshots/resource-snapshot.json`
|
|
53
|
+
THEN it SHALL return the previously saved service data
|
|
54
|
+
"""
|
|
55
|
+
import sys
|
|
56
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
57
|
+
from resource_snapshot import save_snapshot, load_snapshot
|
|
58
|
+
|
|
59
|
+
original_dir = os.getcwd()
|
|
60
|
+
os.chdir(temp_dir)
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
# Create a snapshot first
|
|
64
|
+
services = ["services/product/test/service.json"]
|
|
65
|
+
save_snapshot(services)
|
|
66
|
+
|
|
67
|
+
# Load it
|
|
68
|
+
snapshot = load_snapshot()
|
|
69
|
+
|
|
70
|
+
assert snapshot["count"] == 1
|
|
71
|
+
assert snapshot["services"] == services
|
|
72
|
+
assert "timestamp" in snapshot
|
|
73
|
+
finally:
|
|
74
|
+
os.chdir(original_dir)
|
|
75
|
+
|
|
76
|
+
def test_loading_missing_snapshot(self, temp_dir):
|
|
77
|
+
"""
|
|
78
|
+
Scenario: Loading missing snapshot
|
|
79
|
+
WHEN a snapshot is loaded from a non-existent `.tdk/.tdk-out/snapshots/resource-snapshot.json`
|
|
80
|
+
THEN it SHALL return an empty list without error
|
|
81
|
+
"""
|
|
82
|
+
import sys
|
|
83
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
84
|
+
from resource_snapshot import load_snapshot
|
|
85
|
+
|
|
86
|
+
original_dir = os.getcwd()
|
|
87
|
+
os.chdir(temp_dir)
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
snapshot = load_snapshot()
|
|
91
|
+
|
|
92
|
+
assert snapshot["count"] == 0
|
|
93
|
+
assert snapshot["services"] == []
|
|
94
|
+
assert snapshot["timestamp"] is None
|
|
95
|
+
finally:
|
|
96
|
+
os.chdir(original_dir)
|
|
97
|
+
|
|
98
|
+
def test_saving_creates_directory_structure(self, temp_dir):
|
|
99
|
+
"""Test that saving creates the .tdk/.tdk-out/snapshots directory if it doesn't exist."""
|
|
100
|
+
import sys
|
|
101
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
102
|
+
from resource_snapshot import save_snapshot
|
|
103
|
+
|
|
104
|
+
original_dir = os.getcwd()
|
|
105
|
+
os.chdir(temp_dir)
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
services = ["services/test/service.json"]
|
|
109
|
+
save_snapshot(services)
|
|
110
|
+
|
|
111
|
+
assert Path(".tdk/.tdk-out/snapshots").exists(), ".tdk/.tdk-out/snapshots directory should be created"
|
|
112
|
+
assert Path(".tdk/.tdk-out/snapshots").is_dir(), ".tdk/.tdk-out/snapshots should be a directory"
|
|
113
|
+
finally:
|
|
114
|
+
os.chdir(original_dir)
|
|
115
|
+
|
|
116
|
+
def test_loading_invalid_json_returns_empty(self, temp_dir):
|
|
117
|
+
"""Test that loading invalid JSON returns empty snapshot."""
|
|
118
|
+
import sys
|
|
119
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
120
|
+
from resource_snapshot import load_snapshot
|
|
121
|
+
|
|
122
|
+
original_dir = os.getcwd()
|
|
123
|
+
os.chdir(temp_dir)
|
|
124
|
+
|
|
125
|
+
try:
|
|
126
|
+
# Create invalid JSON file
|
|
127
|
+
Path(".tilt").mkdir(parents=True, exist_ok=True)
|
|
128
|
+
with open(".tilt/resource-snapshot.json", "w") as f:
|
|
129
|
+
f.write("not valid json {{{")
|
|
130
|
+
|
|
131
|
+
snapshot = load_snapshot()
|
|
132
|
+
|
|
133
|
+
assert snapshot["count"] == 0
|
|
134
|
+
assert snapshot["services"] == []
|
|
135
|
+
finally:
|
|
136
|
+
os.chdir(original_dir)
|
|
137
|
+
|
|
138
|
+
def test_snapshot_includes_hashes(self, temp_dir):
|
|
139
|
+
"""Test that saved snapshot includes content hashes."""
|
|
140
|
+
import sys
|
|
141
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
142
|
+
from resource_snapshot import save_snapshot
|
|
143
|
+
|
|
144
|
+
# Create a service file to hash
|
|
145
|
+
resource_dir = temp_dir / "services" / "test"
|
|
146
|
+
resource_dir.mkdir(parents=True)
|
|
147
|
+
(resource_dir / "service.json").write_text('{"name": "test"}')
|
|
148
|
+
|
|
149
|
+
original_dir = os.getcwd()
|
|
150
|
+
os.chdir(temp_dir)
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
services = ["services/test/service.json"]
|
|
154
|
+
save_snapshot(services, include_hashes=True)
|
|
155
|
+
|
|
156
|
+
with open(".tdk/.tdk-out/snapshots/resource-snapshot.json") as f:
|
|
157
|
+
data = json.load(f)
|
|
158
|
+
|
|
159
|
+
assert "resource_hashes" in data
|
|
160
|
+
assert "services/test/service.json" in data["resource_hashes"]
|
|
161
|
+
assert len(data["resource_hashes"]["services/test/service.json"]) == 16
|
|
162
|
+
finally:
|
|
163
|
+
os.chdir(original_dir)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for resource snapshot scanning functionality.
|
|
3
|
+
Tests the filesystem scanning and service.json discovery.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import pytest
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.mark.snapshot
|
|
13
|
+
class TestSnapshotScanning:
|
|
14
|
+
"""Tests for filesystem scanning functionality."""
|
|
15
|
+
|
|
16
|
+
def test_scanning_finds_valid_resource_files(self, temp_dir, monkeypatch):
|
|
17
|
+
"""
|
|
18
|
+
Scenario: Scanning finds valid resource files
|
|
19
|
+
WHEN the scanner runs against a directory containing 3 valid service.json files
|
|
20
|
+
THEN it SHALL return a list of 3 resources with correct paths and parsed metadata
|
|
21
|
+
"""
|
|
22
|
+
# Create test directory structure with 3 resources
|
|
23
|
+
resources = [
|
|
24
|
+
("services/product/identity/identity-backend", "identity-backend"),
|
|
25
|
+
("services/product/identity/identity-frontend", "identity-frontend"),
|
|
26
|
+
("services/product/order/order-backend", "order-backend"),
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
for resource_path, resource_name in resources:
|
|
30
|
+
resource_dir = temp_dir / resource_path
|
|
31
|
+
resource_dir.mkdir(parents=True)
|
|
32
|
+
resource_file = resource_dir / "service.json"
|
|
33
|
+
resource_file.write_text(json.dumps({
|
|
34
|
+
"name": resource_name,
|
|
35
|
+
"type": "backend" if "backend" in resource_name else "frontend",
|
|
36
|
+
"stack": resource_path.split("/")[2],
|
|
37
|
+
"port": 4001 if "backend" in resource_name else 3001
|
|
38
|
+
}))
|
|
39
|
+
|
|
40
|
+
# Import and test
|
|
41
|
+
import sys
|
|
42
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
43
|
+
from resource_snapshot import get_current_resources
|
|
44
|
+
|
|
45
|
+
# Change to temp directory for scanning
|
|
46
|
+
original_dir = os.getcwd()
|
|
47
|
+
os.chdir(temp_dir)
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
found_resources = get_current_resources("services/product")
|
|
51
|
+
|
|
52
|
+
assert len(found_resources) == 3, f"Expected 3 resources, found {len(found_resources)}"
|
|
53
|
+
assert all("service.json" in r for r in found_resources), "All resources should be service.json files"
|
|
54
|
+
finally:
|
|
55
|
+
os.chdir(original_dir)
|
|
56
|
+
|
|
57
|
+
def test_scanning_ignores_non_resource_files(self, temp_dir, monkeypatch):
|
|
58
|
+
"""
|
|
59
|
+
Scenario: Scanning ignores non-resource files
|
|
60
|
+
WHEN the scanner runs against a directory containing service.json and package.json and README.md
|
|
61
|
+
THEN it SHALL only return the resource defined in service.json
|
|
62
|
+
"""
|
|
63
|
+
# Create directory with mixed files
|
|
64
|
+
resource_dir = temp_dir / "services" / "product" / "test"
|
|
65
|
+
resource_dir.mkdir(parents=True)
|
|
66
|
+
|
|
67
|
+
# Create service.json
|
|
68
|
+
(resource_dir / "service.json").write_text(json.dumps({"name": "test-resource"}))
|
|
69
|
+
# Create non-resource files
|
|
70
|
+
(resource_dir / "package.json").write_text('{"name": "test"}')
|
|
71
|
+
(resource_dir / "README.md").write_text("# Test Resource")
|
|
72
|
+
(resource_dir / "config.ts").write_text("export const config = {};")
|
|
73
|
+
|
|
74
|
+
import sys
|
|
75
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
76
|
+
from resource_snapshot import get_current_resources
|
|
77
|
+
|
|
78
|
+
original_dir = os.getcwd()
|
|
79
|
+
os.chdir(temp_dir)
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
found_resources = get_current_resources("services/product")
|
|
83
|
+
|
|
84
|
+
assert len(found_resources) == 1, f"Expected 1 resource, found {len(found_resources)}"
|
|
85
|
+
assert "service.json" in found_resources[0], "Should only find service.json files"
|
|
86
|
+
assert "package.json" not in found_resources[0], "Should not include package.json"
|
|
87
|
+
finally:
|
|
88
|
+
os.chdir(original_dir)
|
|
89
|
+
|
|
90
|
+
def test_scanning_handles_nested_directories(self, temp_dir, monkeypatch):
|
|
91
|
+
"""
|
|
92
|
+
Scenario: Scanning handles nested directories
|
|
93
|
+
WHEN the scanner runs against a directory with nested resources/ subdirectory containing service.json
|
|
94
|
+
THEN it SHALL find resources at any depth and return correct relative paths
|
|
95
|
+
"""
|
|
96
|
+
# Create deeply nested structure
|
|
97
|
+
nested_dirs = [
|
|
98
|
+
"services/product/stack1/backend/service.json",
|
|
99
|
+
"services/product/stack1/frontend/service.json",
|
|
100
|
+
"services/product/stack2/substack/backend/service.json",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
for path in nested_dirs:
|
|
104
|
+
full_path = temp_dir / path
|
|
105
|
+
full_path.parent.mkdir(parents=True, exist_ok=True)
|
|
106
|
+
full_path.write_text(json.dumps({"name": "test"}))
|
|
107
|
+
|
|
108
|
+
import sys
|
|
109
|
+
sys.path.insert(0, str(Path("discovery").resolve()))
|
|
110
|
+
from resource_snapshot import get_current_resources
|
|
111
|
+
|
|
112
|
+
original_dir = os.getcwd()
|
|
113
|
+
os.chdir(temp_dir)
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
found_resources = get_current_resources("services/product")
|
|
117
|
+
|
|
118
|
+
assert len(found_resources) == 3, f"Expected 3 resources, found {len(found_resources)}"
|
|
119
|
+
# Verify all paths are relative and contain the full path
|
|
120
|
+
assert all("stack1" in r or "stack2" in r for r in found_resources)
|
|
121
|
+
assert all("service.json" in r for r in found_resources)
|
|
122
|
+
finally:
|
|
123
|
+
os.chdir(original_dir)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Regression tests for standalone generated-project boot.
|
|
2
|
+
|
|
3
|
+
Standalone TDK projects do not ship Traefik/Verdaccio compose files. The
|
|
4
|
+
Tiltfile still has to load the project-root .env and publish host ports so
|
|
5
|
+
the generated API is reachable at localhost:<port>.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
pytestmark = [pytest.mark.fast, pytest.mark.generator]
|
|
13
|
+
|
|
14
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_load_dotenv_uses_tdk_project_root():
|
|
18
|
+
source = (
|
|
19
|
+
REPO_ROOT
|
|
20
|
+
/ "engine"
|
|
21
|
+
/ "topologies"
|
|
22
|
+
/ "tilt"
|
|
23
|
+
/ "common"
|
|
24
|
+
/ "utils_env.star"
|
|
25
|
+
).read_text()
|
|
26
|
+
assert "TDK_PROJECT_ROOT" in source
|
|
27
|
+
assert "if not project_root:" in source
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_tiltfile_template_passes_project_root_to_load_dotenv():
|
|
31
|
+
source = (REPO_ROOT / "cli" / "templates" / "Tiltfile.hbs").read_text()
|
|
32
|
+
assert "Utils.load_dotenv(PROJECT_ROOT)" in source
|
|
33
|
+
assert "Utils.load_dotenv()" not in source
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_compose_registration_applies_port_override_when_present():
|
|
37
|
+
source = (
|
|
38
|
+
REPO_ROOT
|
|
39
|
+
/ "engine"
|
|
40
|
+
/ "topologies"
|
|
41
|
+
/ "tilt"
|
|
42
|
+
/ "resources"
|
|
43
|
+
/ "orchestrator"
|
|
44
|
+
/ "apply_compose_resource_registration.star"
|
|
45
|
+
).read_text()
|
|
46
|
+
assert "docker-compose.port-override.yml" in source
|
|
47
|
+
assert "Applying port override" in source
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_verdaccio_dependency_requires_compose_file():
|
|
51
|
+
source = (
|
|
52
|
+
REPO_ROOT
|
|
53
|
+
/ "engine"
|
|
54
|
+
/ "topologies"
|
|
55
|
+
/ "tilt"
|
|
56
|
+
/ "resources"
|
|
57
|
+
/ "orchestrator"
|
|
58
|
+
/ "apply_compose_resource_registration.star"
|
|
59
|
+
).read_text()
|
|
60
|
+
assert "docker-compose.verdaccio.yml" in source
|
|
61
|
+
assert "infra_deps.append(PlatformDockerConstants.VERDACCIO_RESOURCE_NAME)" in source
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""Standalone TDK projects must serve api.{project}.localhost via Traefik."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
pytestmark = [pytest.mark.fast, pytest.mark.generator]
|
|
8
|
+
|
|
9
|
+
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_standalone_traefik_compose_generator_exists():
|
|
13
|
+
source = (
|
|
14
|
+
REPO_ROOT
|
|
15
|
+
/ "engine"
|
|
16
|
+
/ "topologies"
|
|
17
|
+
/ "platform"
|
|
18
|
+
/ "docker"
|
|
19
|
+
/ "compose"
|
|
20
|
+
/ "traefik_standalone.star"
|
|
21
|
+
).read_text()
|
|
22
|
+
assert "generate_standalone_traefik_compose" in source
|
|
23
|
+
assert "entrypoints.web.address=:80" in source
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_infra_loader_falls_back_to_standalone_traefik():
|
|
27
|
+
source = (
|
|
28
|
+
REPO_ROOT
|
|
29
|
+
/ "engine"
|
|
30
|
+
/ "topologies"
|
|
31
|
+
/ "tilt"
|
|
32
|
+
/ "resources"
|
|
33
|
+
/ "infra-loader.star"
|
|
34
|
+
).read_text()
|
|
35
|
+
assert "_load_standalone_traefik" in source
|
|
36
|
+
assert "using standalone Traefik" in source
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_project_router_uses_cli_api_path():
|
|
40
|
+
source = (
|
|
41
|
+
REPO_ROOT
|
|
42
|
+
/ "engine"
|
|
43
|
+
/ "topologies"
|
|
44
|
+
/ "platform"
|
|
45
|
+
/ "docker"
|
|
46
|
+
/ "networking"
|
|
47
|
+
/ "traefik_helpers.star"
|
|
48
|
+
).read_text()
|
|
49
|
+
assert "def cli_api_path(" in source
|
|
50
|
+
assert "tdk up" in source
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_tiltfile_keeps_traefik_in_focus_mode():
|
|
54
|
+
source = (REPO_ROOT / "cli" / "templates" / "Tiltfile.hbs").read_text()
|
|
55
|
+
assert "'traefik'" in source
|
|
56
|
+
assert "init-networks" in source
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _infra_loader_source() -> str:
|
|
60
|
+
return (
|
|
61
|
+
REPO_ROOT
|
|
62
|
+
/ "engine"
|
|
63
|
+
/ "topologies"
|
|
64
|
+
/ "tilt"
|
|
65
|
+
/ "resources"
|
|
66
|
+
/ "infra-loader.star"
|
|
67
|
+
).read_text()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_standalone_traefik_stops_conflicting_container_before_compose_up():
|
|
71
|
+
"""Two standalone TDK projects both generate Traefik with hardcoded host
|
|
72
|
+
ports 80/8080 (so api.{project}.localhost works without a port suffix), so
|
|
73
|
+
only one can bind port 80 at a time. `tdk up` on a new project must take
|
|
74
|
+
over the port from a stale Traefik left running by a previous project
|
|
75
|
+
rather than letting `docker compose up` die deep inside Tilt with a
|
|
76
|
+
cryptic "port is already allocated" networking error.
|
|
77
|
+
"""
|
|
78
|
+
source = _infra_loader_source()
|
|
79
|
+
assert "_stop_conflicting_traefik" in source
|
|
80
|
+
|
|
81
|
+
# The takeover must run before docker_compose() is invoked for the
|
|
82
|
+
# standalone Traefik compose, not after. Search from the function body
|
|
83
|
+
# (not its definition line, which also contains the substring
|
|
84
|
+
# "..._traefik()").
|
|
85
|
+
load_standalone_def = source.index("def _load_standalone_traefik(")
|
|
86
|
+
stop_call = source.index("_stop_conflicting_traefik()", load_standalone_def)
|
|
87
|
+
docker_compose_call = source.index("_docker_compose(compose_file, env_file)", load_standalone_def)
|
|
88
|
+
assert load_standalone_def < stop_call < docker_compose_call
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_traefik_conflict_takeover_stops_other_project_and_logs_it():
|
|
92
|
+
source = _infra_loader_source()
|
|
93
|
+
stop_start = source.index("def _stop_conflicting_traefik():")
|
|
94
|
+
stop_body = source[stop_start:source.index("def _load_standalone_traefik(")]
|
|
95
|
+
|
|
96
|
+
# Detects other containers publishing the ports this project's Traefik needs.
|
|
97
|
+
assert "docker ps" in stop_body
|
|
98
|
+
assert "publish=80" in stop_body
|
|
99
|
+
assert "publish=8080" in stop_body
|
|
100
|
+
|
|
101
|
+
# Must not stop this project's own (already-running) Traefik.
|
|
102
|
+
assert "PlatformDockerConstants.PROJECT_NAME" in stop_body
|
|
103
|
+
assert "own_container" in stop_body
|
|
104
|
+
|
|
105
|
+
# Actually stops the other project's container and logs what was stopped,
|
|
106
|
+
# instead of just erroring out.
|
|
107
|
+
assert "docker stop" in stop_body
|
|
108
|
+
assert "print(" in stop_body
|
package/dist/cli.d.ts
DELETED
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|