@tdk-landscape/tdk-cli-core 1.3.135 → 1.3.137

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/cli/dist/commands/doctor.js +13 -13
  3. package/cli/dist/commands/resource.js +15 -14
  4. package/cli/dist/generator/template-engine.js +16 -9
  5. package/cli/dist/utils/constants.js +22 -3
  6. package/cli/dist/utils/discovery-paths.js +29 -5
  7. package/cli/dist/utils/doctor-report.js +2 -1
  8. package/cli/dist/utils/doctor-runtime.js +12 -4
  9. package/cli/dist/utils/doctor-wiring.js +5 -4
  10. package/cli/dist/utils/generated-paths.js +3 -2
  11. package/cli/dist/utils/host-port-config.js +1 -1
  12. package/cli/dist/utils/project-config-defaults.js +2 -1
  13. package/cli/dist/utils/project-features.js +5 -13
  14. package/cli/dist/utils/resource-features.js +2 -1
  15. package/cli/dist/utils/services.js +2 -2
  16. package/cli/dist/utils/shared-platform-postgres.js +30 -10
  17. package/cli/dist/utils/smoke.js +6 -2
  18. package/cli/dist/utils/stack-features.js +5 -2
  19. package/cli/dist-bundle/chunk-DUOGIS2Y.js +315 -0
  20. package/cli/dist-bundle/cli.js +207 -207
  21. package/cli/dist-bundle/{cold-preflight-DQVK4J7J.js → cold-preflight-UATSRM67.js} +1 -1
  22. package/cli/package.json +1 -1
  23. package/engine/assets/docker/wake-gateway/server.ts +3 -3
  24. package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +3 -3
  25. package/engine/topologies/platform/docker/compose/compose.star +4 -4
  26. package/engine/topologies/platform/docker/constants.star +25 -0
  27. package/engine/topologies/platform/docker/dockerfile/language_dockerfile.star +9 -8
  28. package/engine/topologies/platform/docker/networking/traefik_static_routes.star +3 -1
  29. package/engine/topologies/tilt/generators/vite/templates.star +13 -9
  30. package/engine/topologies/tilt/resources/infra-loader.star +20 -14
  31. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +4 -4
  32. package/engine/topologies/tilt/resources/orchestrator/generators/env.star +3 -2
  33. package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +2 -1
  34. package/ext/ide-components/shared/templates/base.html +4 -0
  35. package/package.json +1 -1
  36. package/cli/dist-bundle/chunk-M4T3FXXB.js +0 -315
@@ -3,14 +3,14 @@
3
3
  import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
4
4
  import { dirname, join } from "node:path";
5
5
  import { Cache, createCacheValidator } from "./cache.js";
6
- import { AUTOGENERATED_FILE_PATTERNS, SKIP_DIRECTORIES } from "./constants.js";
6
+ import { AUTOGENERATED_FILE_PATTERNS, SERVICE_JSON, SKIP_DIRECTORIES } from "./constants.js";
7
7
  import { errorFactories } from "./errors.js";
8
8
  import { formatCount } from "./formatting.js";
9
9
  import { findProjectRoot } from "./paths.js";
10
10
  import { getInvalidServiceRoutePathFields, validateGeneratedStringFields, validateServiceManifest, } from "./service-manifest.js";
11
11
  import { deriveStackStatus } from "./stack-status.js";
12
12
  import { includes } from "./validation.js";
13
- const RESOURCE_JSON_FILENAME = "service.json";
13
+ const RESOURCE_JSON_FILENAME = SERVICE_JSON;
14
14
  function findServiceJsonFiles(dir, maxDepth = 5, currentDepth = 0) {
15
15
  const results = [];
16
16
  if (currentDepth > maxDepth) {
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
+ import { DATABASE_MANAGEMENT_FEATURE } from "./constants.js";
5
6
  import { DEFAULT_ALWAYS_ENABLED_INFRA } from "./project-config-defaults.js";
6
7
  import { discoverResourcesFromRoot } from "./services.js";
7
8
  /**
@@ -18,7 +19,7 @@ import { discoverResourcesFromRoot } from "./services.js";
18
19
  *
19
20
  * Spec: openspec/changes/dependson-starts-platform-postgres
20
21
  */
21
- export const POSTGRES_DEPENDENCY_NAMES = ["postgres", "database-management"];
22
+ export const POSTGRES_DEPENDENCY_NAMES = ["postgres", DATABASE_MANAGEMENT_FEATURE];
22
23
  const PHASE_KEYS = ["pre_alpha", "alpha", "beta", "out_of_scope"];
23
24
  export function isSharedPlatformPostgresDependency(name) {
24
25
  return POSTGRES_DEPENDENCY_NAMES.includes(name);
@@ -39,12 +40,31 @@ function readTextIfExists(path) {
39
40
  return undefined;
40
41
  }
41
42
  }
43
+ // Finds `name = [ ... ]` and returns its quoted strings. Plain string scanning, not a RegExp built from the name.
42
44
  function parseStarlarkStringList(source, name) {
43
- const re = new RegExp(`${name}\\s*=\\s*\\[([^\\]]*)\\]`);
44
- const m = source.match(re);
45
- if (!m)
46
- return undefined;
47
- return [...m[1].matchAll(/"([^"]+)"|'([^']+)'/g)].map((x) => x[1] ?? x[2] ?? "");
45
+ const skipSpaces = (at) => {
46
+ let i = at;
47
+ while (i < source.length && /\s/.test(source[i]))
48
+ i += 1;
49
+ return i;
50
+ };
51
+ let from = 0;
52
+ for (;;) {
53
+ const at = source.indexOf(name, from);
54
+ if (at === -1)
55
+ return undefined;
56
+ let i = skipSpaces(at + name.length);
57
+ if (source[i] === "=") {
58
+ i = skipSpaces(i + 1);
59
+ if (source[i] === "[") {
60
+ const end = source.indexOf("]", i + 1);
61
+ if (end === -1)
62
+ return undefined;
63
+ return [...source.slice(i + 1, end).matchAll(/"([^"]+)"|'([^']+)'/g)].map((x) => x[1] ?? x[2] ?? "");
64
+ }
65
+ }
66
+ from = at + name.length;
67
+ }
48
68
  }
49
69
  function tiltfileAlwaysEnabledInfra(projectRoot) {
50
70
  const path = join(projectRoot, ".tdk", ".tdk-out", "Tiltfile");
@@ -86,12 +106,12 @@ function projectJsonFeatureOn(projectRoot) {
86
106
  const phases = (parsed.phases ?? {});
87
107
  for (const phase of PHASE_KEYS) {
88
108
  const stacks = phases[phase]?.enabledStacks;
89
- if (Array.isArray(stacks) && stacks.includes("database-management")) {
109
+ if (Array.isArray(stacks) && stacks.includes(DATABASE_MANAGEMENT_FEATURE)) {
90
110
  return true;
91
111
  }
92
112
  }
93
113
  const alwaysEnabled = parsed.always_enabled_infra ?? DEFAULT_ALWAYS_ENABLED_INFRA;
94
- return Array.isArray(alwaysEnabled) && alwaysEnabled.includes("database-management");
114
+ return Array.isArray(alwaysEnabled) && alwaysEnabled.includes(DATABASE_MANAGEMENT_FEATURE);
95
115
  }
96
116
  /**
97
117
  * True when database-management is on for this project from project.json
@@ -101,7 +121,7 @@ export function databaseManagementEnabled(projectRoot) {
101
121
  if (projectJsonFeatureOn(projectRoot))
102
122
  return true;
103
123
  const fromTilt = tiltfileAlwaysEnabledInfra(projectRoot);
104
- if (Array.isArray(fromTilt) && fromTilt.includes("database-management"))
124
+ if (Array.isArray(fromTilt) && fromTilt.includes(DATABASE_MANAGEMENT_FEATURE))
105
125
  return true;
106
126
  if (specMasterHasDatabaseManagement(projectRoot) === true)
107
127
  return true;
@@ -153,7 +173,7 @@ function knownDependsonNames(projectRoot) {
153
173
  export function evaluateSharedPlatformPostgres(projectRoot) {
154
174
  const featureOnFromProjectJson = projectJsonFeatureOn(projectRoot);
155
175
  const fromTilt = tiltfileAlwaysEnabledInfra(projectRoot);
156
- const featureOnFromTiltfile = Array.isArray(fromTilt) && fromTilt.includes("database-management");
176
+ const featureOnFromTiltfile = Array.isArray(fromTilt) && fromTilt.includes(DATABASE_MANAGEMENT_FEATURE);
157
177
  const featureOnFromSpecMaster = specMasterHasDatabaseManagement(projectRoot) === true;
158
178
  const featureOn = featureOnFromProjectJson || featureOnFromTiltfile || featureOnFromSpecMaster;
159
179
  const focusWouldEnableDatabaseManagement = !featureOnFromProjectJson && generatedDefaultFocusEnablesDatabaseManagement(projectRoot);
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { copyFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
+ import { BRING_YOUR_OWN_TYPE } from "./constants.js";
5
6
  import { isApiServiceType } from "./resource-kind.js";
6
7
  import { resolveServicePath, resolveSubdomainBases } from "./service-urls.js";
7
8
  export const DEFAULT_SMOKE_TIMEOUT_SECONDS = 60;
@@ -87,14 +88,14 @@ export function buildSmokePlans(resources, ingressPort) {
87
88
  if (!config?.smoke)
88
89
  continue;
89
90
  const appType = config.appType;
90
- const isApi = isApiServiceType(appType) || appType === "bring-your-own";
91
+ const isApi = isApiServiceType(appType) || appType === BRING_YOUR_OWN_TYPE;
91
92
  if (!isApi && appType !== "frontend")
92
93
  continue;
93
94
  if (config.exposeViaProxy === false)
94
95
  continue;
95
96
  const base = isApi ? apiBase : appBase;
96
97
  // The container healthcheck path (default /health for APIs) is the one request that is safe to repeat while the route comes up.
97
- const readyPath = config.healthCheckPath || (isApi && appType !== "bring-your-own" ? "/health" : undefined);
98
+ const readyPath = config.healthCheckPath || (isApi && appType !== BRING_YOUR_OWN_TYPE ? "/health" : undefined);
98
99
  plans.push({
99
100
  name: resource.name,
100
101
  baseUrl: `${base}${resolveServicePath(resource).replace(/\/+$/, "")}`,
@@ -110,6 +111,9 @@ function readPath(value, path) {
110
111
  for (const part of parts) {
111
112
  if (current === null || current === undefined)
112
113
  return undefined;
114
+ // Own properties only: a path like "__proto__" must not reach inherited values.
115
+ if (!Object.hasOwn(current, part))
116
+ return undefined;
113
117
  current = current[part];
114
118
  }
115
119
  return current;
@@ -1,6 +1,9 @@
1
+ // Copyright (c) 2026 TDK Landscape contributors
2
+ // SPDX-License-Identifier: MIT
3
+ import { DATABASE_MANAGEMENT_FEATURE } from "./constants.js";
1
4
  export const STACK_FEATURES = {
2
- "database-management": {
3
- name: "database-management",
5
+ [DATABASE_MANAGEMENT_FEATURE]: {
6
+ name: DATABASE_MANAGEMENT_FEATURE,
4
7
  description: "Generate and load the stack-level PostgreSQL docker-compose file",
5
8
  generatedFiles: ["services/platform/database-management/docker-compose.yml"],
6
9
  },