@tdk-landscape/tdk-cli-core 1.3.45 → 1.3.48
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
package/cli/src/index.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AutogeneratedFile,
|
|
3
|
+
BaseTooltipProps,
|
|
4
|
+
CheckResult,
|
|
5
|
+
CreatableResourceType,
|
|
6
|
+
DetailPanelProps,
|
|
7
|
+
DiscoveredResource,
|
|
8
|
+
DiscoveredStack,
|
|
9
|
+
DiscoveryContext,
|
|
10
|
+
ErrorScreenProps,
|
|
11
|
+
FileGenerationTask,
|
|
12
|
+
FileNode,
|
|
13
|
+
FileTreeProps,
|
|
14
|
+
FileType,
|
|
15
|
+
HelpPanelProps,
|
|
16
|
+
JsonArray,
|
|
17
|
+
JsonObject,
|
|
18
|
+
JsonValue,
|
|
19
|
+
LoadingScreenProps,
|
|
20
|
+
ProjectConfig,
|
|
21
|
+
ProjectDiscovery,
|
|
22
|
+
ProjectOptionalInfra,
|
|
23
|
+
ProjectPhaseDefinition,
|
|
24
|
+
ResourceConfig,
|
|
25
|
+
ResourceFileType,
|
|
26
|
+
ResourceMetadata,
|
|
27
|
+
ResourceSelectInputProps,
|
|
28
|
+
ResourceStatus,
|
|
29
|
+
ResourceTableProps,
|
|
30
|
+
ResourceType,
|
|
31
|
+
SelectItem,
|
|
32
|
+
ServiceUrl,
|
|
33
|
+
StackHealthStatus,
|
|
34
|
+
StackMetadata,
|
|
35
|
+
StatusCategory,
|
|
36
|
+
StatusValue,
|
|
37
|
+
Tab,
|
|
38
|
+
TabBarProps,
|
|
39
|
+
TabId,
|
|
40
|
+
TiltBuildStatus,
|
|
41
|
+
TiltCommandResult,
|
|
42
|
+
TiltResourceStatus,
|
|
43
|
+
TiltRuntimeStatus,
|
|
44
|
+
TooltipProps,
|
|
45
|
+
ValidationResult,
|
|
46
|
+
} from "./types/index.js";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
CREATABLE_RESOURCE_TYPES,
|
|
50
|
+
isCreatableResourceType,
|
|
51
|
+
} from "./types/index.js";
|
|
52
|
+
export {
|
|
53
|
+
Cache,
|
|
54
|
+
createCacheValidator,
|
|
55
|
+
} from "./utils/cache.js";
|
|
56
|
+
export {
|
|
57
|
+
assertValid,
|
|
58
|
+
confirmAction,
|
|
59
|
+
confirmOrCancel,
|
|
60
|
+
handleDryRun,
|
|
61
|
+
} from "./utils/command-helpers.js";
|
|
62
|
+
// Re-export discovery-context functions for resources-by-stack operations
|
|
63
|
+
export { createDiscoveryContext } from "./utils/discovery-context.js";
|
|
64
|
+
export { writeFilesWithProgress } from "./utils/file-helpers.js";
|
|
65
|
+
export { findProjectRoot } from "./utils/paths.js";
|
|
66
|
+
export {
|
|
67
|
+
checkPortStatus,
|
|
68
|
+
findAvailablePort,
|
|
69
|
+
} from "./utils/port-assignment.js";
|
|
70
|
+
export {
|
|
71
|
+
clearMetadataCache,
|
|
72
|
+
discoverResources,
|
|
73
|
+
discoverStacks,
|
|
74
|
+
getAllStacks,
|
|
75
|
+
getResourceMetadata,
|
|
76
|
+
getResourcesForStack,
|
|
77
|
+
getStackMetadata,
|
|
78
|
+
stackExists,
|
|
79
|
+
} from "./utils/services.js";
|
|
80
|
+
export {
|
|
81
|
+
buildTiltDownArgs,
|
|
82
|
+
buildTiltUpArgs,
|
|
83
|
+
getTiltfilePath,
|
|
84
|
+
isTiltAvailable,
|
|
85
|
+
runTilt,
|
|
86
|
+
} from "./utils/tilt.js";
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
export interface DiscoveredResource {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
configPath: string;
|
|
5
|
+
config?: ResourceConfig;
|
|
6
|
+
stack?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
type?: ResourceType;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ResourceConfig {
|
|
12
|
+
appName: string;
|
|
13
|
+
appType: "backend" | "frontend" | "library" | "sdk" | "worker" | "migrator";
|
|
14
|
+
stack?: string;
|
|
15
|
+
port?: number;
|
|
16
|
+
replicas?: number;
|
|
17
|
+
runtime?: string;
|
|
18
|
+
featuresEnabled?: string[];
|
|
19
|
+
dependsOn?: string[];
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
basePath?: string;
|
|
22
|
+
backendName?: string;
|
|
23
|
+
apiPath?: string;
|
|
24
|
+
/** On-demand scaling via Sablier (Premium - requires TDK_LICENSE_KEY). See hasSablierLicense() in extension-fetch.ts. */
|
|
25
|
+
sablier?: {
|
|
26
|
+
enable?: boolean;
|
|
27
|
+
group?: string;
|
|
28
|
+
sessionDuration?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DiscoveredStack {
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
resources: DiscoveredResource[];
|
|
36
|
+
resourceCount: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TiltCommandResult {
|
|
40
|
+
exitCode: number;
|
|
41
|
+
stdout: string;
|
|
42
|
+
stderr: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type FileType = "docker" | "tilt" | "config" | "prisma" | "generated" | "unknown";
|
|
46
|
+
|
|
47
|
+
export interface AutogeneratedFile {
|
|
48
|
+
name: string;
|
|
49
|
+
path: string;
|
|
50
|
+
type: FileType;
|
|
51
|
+
size: number;
|
|
52
|
+
lastModified: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type ResourceFileType = "json" | "text";
|
|
56
|
+
|
|
57
|
+
export interface FileGenerationTask {
|
|
58
|
+
type: ResourceFileType;
|
|
59
|
+
filename: string;
|
|
60
|
+
content: JsonValue;
|
|
61
|
+
description: string;
|
|
62
|
+
emoji: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type ResourceType = "frontend" | "backend" | "library" | "sdk" | "worker" | "migrator";
|
|
66
|
+
|
|
67
|
+
export const CREATABLE_RESOURCE_TYPES = ["backend", "frontend", "worker"] as const;
|
|
68
|
+
|
|
69
|
+
export type CreatableResourceType = Extract<
|
|
70
|
+
ResourceType,
|
|
71
|
+
(typeof CREATABLE_RESOURCE_TYPES)[number]
|
|
72
|
+
>;
|
|
73
|
+
|
|
74
|
+
export function isCreatableResourceType(value: unknown): value is CreatableResourceType {
|
|
75
|
+
return (
|
|
76
|
+
typeof value === "string" && (CREATABLE_RESOURCE_TYPES as readonly string[]).includes(value)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type ResourceStatus = "ready" | "pending" | "error" | "unknown";
|
|
81
|
+
|
|
82
|
+
export interface ResourceMetadata {
|
|
83
|
+
name: string;
|
|
84
|
+
stack?: string;
|
|
85
|
+
type: ResourceType;
|
|
86
|
+
port?: number;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
lastModified: string;
|
|
89
|
+
dependencies: string[];
|
|
90
|
+
hasDockerfile: boolean;
|
|
91
|
+
hasTiltfile: boolean;
|
|
92
|
+
hasDockerCompose: boolean;
|
|
93
|
+
autogeneratedFiles: AutogeneratedFile[];
|
|
94
|
+
status: ResourceStatus;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type StackHealthStatus = "healthy" | "degraded" | "error" | "unknown";
|
|
98
|
+
|
|
99
|
+
export interface StackMetadata {
|
|
100
|
+
name: string;
|
|
101
|
+
resourceCount: number;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
lastModified: string;
|
|
104
|
+
resources: ResourceMetadata[];
|
|
105
|
+
overallStatus: StackHealthStatus;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type TiltRuntimeStatus = "running" | "pending" | "error" | "unknown";
|
|
109
|
+
|
|
110
|
+
export type TiltBuildStatus = "ok" | "error" | "in_progress" | "unknown";
|
|
111
|
+
|
|
112
|
+
export interface TiltResourceStatus {
|
|
113
|
+
runtimeStatus: TiltRuntimeStatus;
|
|
114
|
+
buildStatus: TiltBuildStatus;
|
|
115
|
+
lastBuildTime: string | null;
|
|
116
|
+
currentBuildTime: string | null;
|
|
117
|
+
available: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
|
|
121
|
+
|
|
122
|
+
export interface JsonArray extends Array<JsonValue> {}
|
|
123
|
+
export interface JsonObject extends Record<string, JsonValue> {}
|
|
124
|
+
|
|
125
|
+
export interface ProjectPhaseDefinition {
|
|
126
|
+
name: string;
|
|
127
|
+
description: string;
|
|
128
|
+
enabledStacks: string[];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface LegacyProjectStackDefinition {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
services: string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface ProjectOptionalInfra {
|
|
138
|
+
monitoring: boolean;
|
|
139
|
+
elk: boolean;
|
|
140
|
+
debezium: boolean;
|
|
141
|
+
golden_image: boolean;
|
|
142
|
+
verdaccio: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ProjectDiscovery {
|
|
146
|
+
paths: string[];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ProjectConfig {
|
|
150
|
+
version: string;
|
|
151
|
+
project: {
|
|
152
|
+
name: string;
|
|
153
|
+
version: string;
|
|
154
|
+
};
|
|
155
|
+
phases: {
|
|
156
|
+
pre_alpha: ProjectPhaseDefinition;
|
|
157
|
+
alpha: ProjectPhaseDefinition;
|
|
158
|
+
beta: ProjectPhaseDefinition;
|
|
159
|
+
out_of_scope: ProjectPhaseDefinition;
|
|
160
|
+
};
|
|
161
|
+
stacks?: {
|
|
162
|
+
pre_alpha: LegacyProjectStackDefinition;
|
|
163
|
+
alpha: LegacyProjectStackDefinition;
|
|
164
|
+
beta: LegacyProjectStackDefinition;
|
|
165
|
+
out_of_scope: LegacyProjectStackDefinition;
|
|
166
|
+
};
|
|
167
|
+
always_enabled_infra?: string[];
|
|
168
|
+
optional_infra: ProjectOptionalInfra;
|
|
169
|
+
discovery: ProjectDiscovery;
|
|
170
|
+
overrides?: Record<string, JsonValue>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export type TabId = "overview" | "resources" | "events" | "files" | "config";
|
|
174
|
+
|
|
175
|
+
export interface Tab {
|
|
176
|
+
id: TabId;
|
|
177
|
+
label: string;
|
|
178
|
+
shortcut: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface TabBarProps {
|
|
182
|
+
activeTab: TabId;
|
|
183
|
+
onTabChange: (tab: TabId) => void;
|
|
184
|
+
compact?: boolean;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Reuse BaseTooltipProps instead of duplicating
|
|
188
|
+
export type TooltipProps = BaseTooltipProps;
|
|
189
|
+
|
|
190
|
+
export interface DetailPanelProps {
|
|
191
|
+
stack: DiscoveredStack | null;
|
|
192
|
+
service: DiscoveredResource | null;
|
|
193
|
+
stackMetadata?: StackMetadata | null;
|
|
194
|
+
visible: boolean;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface ResourceTableProps {
|
|
198
|
+
resources: ResourceMetadata[];
|
|
199
|
+
maxWidth?: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface ResourceSelectInputProps {
|
|
203
|
+
items: SelectItem[];
|
|
204
|
+
onSelect: (item: SelectItem) => void;
|
|
205
|
+
highlightedIndex: number;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface FileNode {
|
|
209
|
+
name: string;
|
|
210
|
+
path: string;
|
|
211
|
+
type: "directory" | "file";
|
|
212
|
+
fileType?: FileType;
|
|
213
|
+
children?: FileNode[];
|
|
214
|
+
size?: number;
|
|
215
|
+
lastModified?: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface ValidationResult {
|
|
219
|
+
valid: boolean;
|
|
220
|
+
error?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface CheckResult {
|
|
224
|
+
name: string;
|
|
225
|
+
didPass: boolean;
|
|
226
|
+
message: string;
|
|
227
|
+
fix?: string;
|
|
228
|
+
/** Check could not run meaningfully (e.g. nothing started yet); not a failure. */
|
|
229
|
+
isSkipped?: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface ServiceUrl {
|
|
233
|
+
name: string;
|
|
234
|
+
stack?: string;
|
|
235
|
+
basePath: string;
|
|
236
|
+
url: string;
|
|
237
|
+
port?: number;
|
|
238
|
+
status: "running" | "stopped" | "unknown";
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface SelectItem {
|
|
242
|
+
label: string;
|
|
243
|
+
value: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export type StatusValue =
|
|
247
|
+
| ResourceStatus
|
|
248
|
+
| StackHealthStatus
|
|
249
|
+
| TiltRuntimeStatus
|
|
250
|
+
| ServiceUrl["status"]
|
|
251
|
+
| "active"
|
|
252
|
+
| "failed"
|
|
253
|
+
| "critical"
|
|
254
|
+
| "stopped"
|
|
255
|
+
| "starting"
|
|
256
|
+
| "building"
|
|
257
|
+
| undefined;
|
|
258
|
+
|
|
259
|
+
export type StatusCategory = "success" | "error" | "warning" | "unknown";
|
|
260
|
+
|
|
261
|
+
export interface DiscoveryContext {
|
|
262
|
+
resources: DiscoveredResource[];
|
|
263
|
+
stacks: DiscoveredStack[];
|
|
264
|
+
stackNames: string[];
|
|
265
|
+
unassignedResources: DiscoveredResource[];
|
|
266
|
+
resourcesByStack: Map<string, DiscoveredResource[]>;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface FileTreeProps {
|
|
270
|
+
nodes: FileNode[];
|
|
271
|
+
onSelect?: (node: FileNode) => void;
|
|
272
|
+
selectedPath?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface BaseTooltipProps {
|
|
276
|
+
content: string;
|
|
277
|
+
shortcut?: string;
|
|
278
|
+
visible: boolean;
|
|
279
|
+
maxWidth?: number;
|
|
280
|
+
wrapText?: boolean;
|
|
281
|
+
prefix?: string;
|
|
282
|
+
marginTop?: number;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface LoadingScreenProps {
|
|
286
|
+
progress: number;
|
|
287
|
+
message: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface ErrorScreenProps {
|
|
291
|
+
error: string;
|
|
292
|
+
onRetry: () => void;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface HelpPanelProps {
|
|
296
|
+
onClose: () => void;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// Cache Types (consolidated from utils/cache.ts)
|
|
301
|
+
// ============================================================================
|
|
302
|
+
|
|
303
|
+
export interface CacheEntry<T> {
|
|
304
|
+
value: T;
|
|
305
|
+
timestamp: number;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface CacheOptions {
|
|
309
|
+
ttlMs: number;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ============================================================================
|
|
313
|
+
// Package Types (consolidated from utils/paths.ts)
|
|
314
|
+
// ============================================================================
|
|
315
|
+
|
|
316
|
+
export interface PackageInfo {
|
|
317
|
+
name: string;
|
|
318
|
+
version: string;
|
|
319
|
+
fullPackage: JsonObject;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// ============================================================================
|
|
323
|
+
// Port Assignment Types (consolidated from utils/port-assignment.ts)
|
|
324
|
+
// ============================================================================
|
|
325
|
+
|
|
326
|
+
export type PortAssignableResourceType = Extract<
|
|
327
|
+
CreatableResourceType,
|
|
328
|
+
"backend" | "frontend" | "worker" | "migrator"
|
|
329
|
+
>;
|
|
330
|
+
|
|
331
|
+
// ============================================================================
|
|
332
|
+
// Config Types (consolidated from commands/config.ts)
|
|
333
|
+
// ============================================================================
|
|
334
|
+
|
|
335
|
+
export type MasterConfigFileName =
|
|
336
|
+
| "TILT_TECH_STACK.star"
|
|
337
|
+
| "TILT_RESOURCE_DEFAULTS.star"
|
|
338
|
+
| "spec.master";
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Type guard to validate filename is a known master config file.
|
|
342
|
+
* Eliminates the need for 'as MasterConfigFileName' assertion.
|
|
343
|
+
*/
|
|
344
|
+
export function isMasterConfigFileName(filename: string): filename is MasterConfigFileName {
|
|
345
|
+
const validNames: readonly string[] = [
|
|
346
|
+
"TILT_TECH_STACK.star",
|
|
347
|
+
"TILT_RESOURCE_DEFAULTS.star",
|
|
348
|
+
"spec.master",
|
|
349
|
+
];
|
|
350
|
+
return validNames.includes(filename);
|
|
351
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { Cache, createCacheValidator } from "../cache.js";
|
|
3
|
+
|
|
4
|
+
describe("Cache", () => {
|
|
5
|
+
it("should store and retrieve values", () => {
|
|
6
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
7
|
+
cache.set("key1", "value1");
|
|
8
|
+
expect(cache.get("key1")).toBe("value1");
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should return undefined for missing keys", () => {
|
|
12
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
13
|
+
expect(cache.get("nonexistent")).toBeUndefined();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should report has() correctly", () => {
|
|
17
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
18
|
+
cache.set("key1", "value1");
|
|
19
|
+
expect(cache.has("key1")).toBe(true);
|
|
20
|
+
expect(cache.has("nonexistent")).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should delete values", () => {
|
|
24
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
25
|
+
cache.set("key1", "value1");
|
|
26
|
+
cache.delete("key1");
|
|
27
|
+
expect(cache.get("key1")).toBeUndefined();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should clear all values", () => {
|
|
31
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
32
|
+
cache.set("key1", "value1");
|
|
33
|
+
cache.set("key2", "value2");
|
|
34
|
+
cache.clear();
|
|
35
|
+
expect(cache.size()).toBe(0);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should expire entries after TTL", async () => {
|
|
39
|
+
const cache = new Cache<string>({ ttlMs: 10 });
|
|
40
|
+
cache.set("key1", "value1");
|
|
41
|
+
expect(cache.has("key1")).toBe(true);
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
43
|
+
expect(cache.has("key1")).toBe(false);
|
|
44
|
+
expect(cache.get("key1")).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should return correct size", () => {
|
|
48
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
49
|
+
expect(cache.size()).toBe(0);
|
|
50
|
+
cache.set("a", "1");
|
|
51
|
+
expect(cache.size()).toBe(1);
|
|
52
|
+
cache.set("b", "2");
|
|
53
|
+
expect(cache.size()).toBe(2);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should return all valid keys", () => {
|
|
57
|
+
const cache = new Cache<string>({ ttlMs: 5000 });
|
|
58
|
+
cache.set("a", "1");
|
|
59
|
+
cache.set("b", "2");
|
|
60
|
+
cache.set("c", "3");
|
|
61
|
+
expect(cache.keys().sort()).toEqual(["a", "b", "c"]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should not include expired keys in keys()", async () => {
|
|
65
|
+
const cache = new Cache<string>({ ttlMs: 10 });
|
|
66
|
+
cache.set("a", "1");
|
|
67
|
+
cache.set("b", "2");
|
|
68
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
69
|
+
expect(cache.keys()).toEqual([]);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("createCacheValidator", () => {
|
|
74
|
+
it("should start as invalid", () => {
|
|
75
|
+
const validator = createCacheValidator(1000);
|
|
76
|
+
expect(validator.isValid()).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("should be valid after markUpdated", () => {
|
|
80
|
+
const validator = createCacheValidator(1000);
|
|
81
|
+
validator.markUpdated();
|
|
82
|
+
expect(validator.isValid()).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("should expire after TTL", async () => {
|
|
86
|
+
const validator = createCacheValidator(10);
|
|
87
|
+
validator.markUpdated();
|
|
88
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
89
|
+
expect(validator.isValid()).toBe(false);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("should reset to invalid", () => {
|
|
93
|
+
const validator = createCacheValidator(1000);
|
|
94
|
+
validator.markUpdated();
|
|
95
|
+
validator.reset();
|
|
96
|
+
expect(validator.isValid()).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
formatBoxLine,
|
|
4
|
+
formatBytes,
|
|
5
|
+
formatCentered,
|
|
6
|
+
formatCount,
|
|
7
|
+
formatDate,
|
|
8
|
+
formatPadded,
|
|
9
|
+
formatShortDate,
|
|
10
|
+
getStatusColor,
|
|
11
|
+
getStatusIcon,
|
|
12
|
+
truncate,
|
|
13
|
+
} from "../formatting.js";
|
|
14
|
+
|
|
15
|
+
describe("formatCount", () => {
|
|
16
|
+
it("should format singular", () => {
|
|
17
|
+
expect(formatCount(1, "resource")).toBe("1 resource");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should format plural with default suffix", () => {
|
|
21
|
+
expect(formatCount(3, "resource")).toBe("3 resources");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should format plural with custom plural", () => {
|
|
25
|
+
expect(formatCount(2, "index", "indices")).toBe("2 indices");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should handle zero as plural", () => {
|
|
29
|
+
expect(formatCount(0, "service")).toBe("0 services");
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("formatDate", () => {
|
|
34
|
+
it("should return a string", () => {
|
|
35
|
+
const result = formatDate(new Date().toISOString());
|
|
36
|
+
expect(typeof result).toBe("string");
|
|
37
|
+
expect(result.length).toBeGreaterThan(0);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should handle ISO date strings", () => {
|
|
41
|
+
const date = new Date("2024-01-15T10:30:00Z");
|
|
42
|
+
expect(formatDate(date.toISOString())).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe("formatShortDate", () => {
|
|
47
|
+
it("should return a short date string", () => {
|
|
48
|
+
const result = formatShortDate(new Date().toISOString());
|
|
49
|
+
expect(typeof result).toBe("string");
|
|
50
|
+
expect(result.length).toBeGreaterThan(0);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("getStatusColor", () => {
|
|
55
|
+
it("should return green for ready status", () => {
|
|
56
|
+
expect(getStatusColor("ready")).toBe("green");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should return green for healthy status", () => {
|
|
60
|
+
expect(getStatusColor("healthy")).toBe("green");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should return red for error status", () => {
|
|
64
|
+
expect(getStatusColor("error")).toBe("red");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should return yellow for pending status", () => {
|
|
68
|
+
expect(getStatusColor("pending")).toBe("yellow");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("should return gray for unknown status", () => {
|
|
72
|
+
expect(getStatusColor("unknown")).toBe("gray");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("should handle undefined status", () => {
|
|
76
|
+
expect(getStatusColor(undefined)).toBe("gray");
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("getStatusIcon", () => {
|
|
81
|
+
it("should return ✓ for ready", () => {
|
|
82
|
+
expect(getStatusIcon("ready")).toBe("✓");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("should return ✗ for error", () => {
|
|
86
|
+
expect(getStatusIcon("error")).toBe("✗");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("should return ? for unknown", () => {
|
|
90
|
+
expect(getStatusIcon("unknown")).toBe("?");
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("truncate", () => {
|
|
95
|
+
it("should not truncate short strings", () => {
|
|
96
|
+
expect(truncate("hello", 10)).toBe("hello");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("should truncate long strings with ellipsis", () => {
|
|
100
|
+
const result = truncate("hello world this is long", 10);
|
|
101
|
+
expect(result).toBe("hello w...");
|
|
102
|
+
expect(result.length).toBe(10);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("should handle empty string", () => {
|
|
106
|
+
expect(truncate("", 5)).toBe("");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("should handle exactly max length", () => {
|
|
110
|
+
expect(truncate("hello", 5)).toBe("hello");
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe("formatBytes", () => {
|
|
115
|
+
it("should format bytes", () => {
|
|
116
|
+
expect(formatBytes(500)).toBe("500 B");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("should format kilobytes", () => {
|
|
120
|
+
expect(formatBytes(2048)).toBe("2.0 KB");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("should format megabytes", () => {
|
|
124
|
+
expect(formatBytes(1048576)).toBe("1.0 MB");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("should handle zero", () => {
|
|
128
|
+
expect(formatBytes(0)).toBe("0 B");
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("formatCentered", () => {
|
|
133
|
+
it("should center text within width", () => {
|
|
134
|
+
const result = formatCentered("hi", 10);
|
|
135
|
+
expect(result.length).toBe(10);
|
|
136
|
+
expect(result).toContain("hi");
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("should handle text longer than width (returns as-is, no truncation)", () => {
|
|
140
|
+
const result = formatCentered("hello world", 5);
|
|
141
|
+
expect(result).toBe("hello world");
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe("formatPadded", () => {
|
|
146
|
+
it("should pad short text to width", () => {
|
|
147
|
+
const result = formatPadded("hi", 10);
|
|
148
|
+
expect(result.length).toBe(10);
|
|
149
|
+
expect(result).toMatch(/^hi\s+$/);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it("should truncate long text with ellipsis", () => {
|
|
153
|
+
const result = formatPadded("hello world", 6);
|
|
154
|
+
expect(result).toBe("hello…");
|
|
155
|
+
expect(result.length).toBe(6);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe("formatBoxLine", () => {
|
|
160
|
+
it("should return default width line", () => {
|
|
161
|
+
const result = formatBoxLine();
|
|
162
|
+
expect(result.length).toBe(62);
|
|
163
|
+
expect(result).toBe("─".repeat(62));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("should accept custom char and width", () => {
|
|
167
|
+
const result = formatBoxLine("=", 10);
|
|
168
|
+
expect(result).toBe("=".repeat(10));
|
|
169
|
+
});
|
|
170
|
+
});
|