@tdk-landscape/tdk-cli-core 1.3.156 → 1.3.157

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.
@@ -12,13 +12,12 @@ import { projectNeedsBun } from "../utils/bun-requirement.js";
12
12
  import { AUTOGENERATED_DIR, CONTAINER_RUNTIME_CHECK, MASTER_CONFIG_FILES, PACKAGE_JSON, REQUIRED_PACKAGE_SCRIPTS, } from "../utils/constants.js";
13
13
  import { isPathDiscovered, readDiscoveryPaths } from "../utils/discovery-paths.js";
14
14
  import { checkCrashLoopingContainers } from "../utils/doctor-crashloop.js";
15
- import { applyDoctorFixes, checkDuplicateTdkInstalls, hasFailedActions, planDoctorFixes, } from "../utils/doctor-fix.js";
15
+ import { applyDoctorFixes, checkDuplicateTdkInstalls, hasFailedActions, planDoctorFixes, projectTiltPids, } from "../utils/doctor-fix.js";
16
16
  import { checkDiskSpace, dockerDesktopStuck } from "../utils/doctor-host.js";
17
17
  import { collectDoctorChecks, createDoctorReport, getDoctorExitCode, } from "../utils/doctor-report.js";
18
18
  import { checkHealthRoutes, checkIngressPorts, checkPrivateNpmRegistry, checkTiltResourceHealth, projectConfigEnablesVerdaccio, summarizeAdvertisedProbes, summarizeServiceProbes, summarizeSmokeResults, } from "../utils/doctor-runtime.js";
19
19
  import { checkStarlarkLoadExports } from "../utils/doctor-starlark.js";
20
20
  import { checkDockerNetworkCapacity, checkDuplicateResourceNames, checkDuplicateResourcePorts, checkFrontendBackendUrls, checkMigrationsInApi, checkNatsBroker, checkPrismaConsistency, checkResourcePackageJson, checkServiceUrlPorts, checkSharedPlatformPostgres, checkSharedStackRoutes, checkTiltInstances, } from "../utils/doctor-wiring.js";
21
- import { findProjectTiltUpPids } from "../utils/down-cleanup.js";
22
21
  import { validateEnvFile } from "../utils/env-validator.js";
23
22
  import { execAsync, isExecTimeout } from "../utils/exec-async.js";
24
23
  import { formatCount } from "../utils/formatting.js";
@@ -1100,9 +1099,7 @@ export const doctorCommand = new Command("doctor")
1100
1099
  // An unreadable config is reported by the project checks below.
1101
1100
  }
1102
1101
  }
1103
- const tiltPids = projectRoot
1104
- ? findProjectTiltUpPids(join(projectRoot, ".tdk", ".tdk-out", "Tiltfile"))
1105
- : [];
1102
+ const tiltPids = projectRoot ? projectTiltPids(projectRoot) : [];
1106
1103
  const planned = await planDoctorFixes(projectName, undefined, tiltPids.length > 0
1107
1104
  ? `Tilt is running for this project (pid ${tiltPids.join(", ")}); run tdk down first`
1108
1105
  : undefined);
@@ -55,7 +55,8 @@ export function crashLoopHint(logs, state) {
55
55
  if (/ECONNREFUSED|connection refused|could not connect/i.test(logs)) {
56
56
  return "a dependency is not reachable: check that the service it connects to is running and healthy";
57
57
  }
58
- if (/(is not set|is required|missing required|undefined).*(env|environment|variable)|environment variable.*(missing|not set|required)/i.test(logs)) {
58
+ if (/\b(?:environment variable|env var)\b.*\b(?:missing|not set|required|undefined)\b/i.test(logs) ||
59
+ /\b[A-Z][A-Z0-9_]{2,}\b (?:is )?(?:not set|required|missing)\b/.test(logs)) {
59
60
  return "a required environment variable is missing: check the project's .env";
60
61
  }
61
62
  if (state.exitCode === 137)
@@ -2,8 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { execFile } from "node:child_process";
4
4
  import { realpathSync } from "node:fs";
5
+ import { join } from "node:path";
5
6
  import { promisify } from "node:util";
6
- import { projectNetworkNames } from "./down-cleanup.js";
7
+ import { findProjectTiltUpPids, projectNetworkNames } from "./down-cleanup.js";
7
8
  import { findAllOnPath } from "./which.js";
8
9
  const execFilePromise = promisify(execFile);
9
10
  const DOCKER_TIMEOUT_MS = 15_000;
@@ -209,3 +210,22 @@ export async function checkDuplicateTdkInstalls(installs) {
209
210
  fix: "Keep one: remove the others, or run tdk upgrade. The first on PATH is the one your shell runs; tools that launch /usr/local/bin/tdk directly may use another",
210
211
  };
211
212
  }
213
+ /**
214
+ * PIDs of `tilt up` processes for this project. The process list shows the Tiltfile path as it was typed at launch,
215
+ * which may or may not be the symlink-resolved path, so both spellings are looked up.
216
+ */
217
+ export function projectTiltPids(projectRoot, find = findProjectTiltUpPids) {
218
+ const roots = new Set([projectRoot]);
219
+ try {
220
+ roots.add(realpathSync(projectRoot));
221
+ }
222
+ catch {
223
+ // Keep the path as given.
224
+ }
225
+ const pids = new Set();
226
+ for (const root of roots) {
227
+ for (const pid of find(join(root, ".tdk", ".tdk-out", "Tiltfile")))
228
+ pids.add(pid);
229
+ }
230
+ return [...pids];
231
+ }