@contentful/experience-design-system-cli 2.34.1-dev-build-1576344.0 → 2.34.1

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/dist/src/index.js CHANGED
@@ -21,78 +21,8 @@ var init_agent_names = __esm({
21
21
  }
22
22
  });
23
23
 
24
- // packages/experience-design-system-generation/dist/src/lib/binary-launch.js
25
- import { spawn } from "node:child_process";
26
- import { accessSync, constants } from "node:fs";
27
- import { delimiter, isAbsolute, join } from "node:path";
28
- function executableExtensions(platform) {
29
- return platform === "win32" ? [".exe", ".cmd", ".bat", ".com"] : [""];
30
- }
31
- function findBinary(binary, platform = process.platform) {
32
- const extensions = executableExtensions(platform);
33
- if (isAbsolute(binary)) {
34
- for (const extension of ["", ...extensions]) {
35
- try {
36
- accessSync(binary + extension, constants.F_OK);
37
- return binary + extension;
38
- } catch {
39
- continue;
40
- }
41
- }
42
- return null;
43
- }
44
- for (const directory of (process.env["PATH"] ?? "").split(delimiter)) {
45
- if (!directory || !isAbsolute(directory))
46
- continue;
47
- for (const extension of extensions) {
48
- const candidate = join(directory, binary + extension);
49
- try {
50
- accessSync(candidate, constants.X_OK);
51
- return candidate;
52
- } catch {
53
- continue;
54
- }
55
- }
56
- }
57
- return null;
58
- }
59
- function binaryExists(binary, platform = process.platform) {
60
- return findBinary(binary, platform) !== null;
61
- }
62
- function spawnSpec(resolved, args, platform = process.platform) {
63
- if (platform !== "win32" || /\.(exe|com)$/i.test(resolved)) {
64
- return { command: resolved, args };
65
- }
66
- const shell = process.env["ComSpec"] || "cmd.exe";
67
- const quote = (value) => `"${value.replace(/"/g, '""')}"`;
68
- const commandLine = [resolved, ...args].map(quote).join(" ");
69
- return {
70
- command: shell,
71
- // /d skips AutoRun scripts, /s keeps the outer quotes intact, /c runs and exits.
72
- args: ["/d", "/s", "/c", `"${commandLine}"`],
73
- windowsVerbatimArguments: true
74
- };
75
- }
76
- function resolveSpawn(binary, args, platform = process.platform) {
77
- const resolved = findBinary(binary, platform);
78
- if (!resolved)
79
- return null;
80
- return spawnSpec(resolved, args, platform);
81
- }
82
- function spawnBinary(command, args, options = {}) {
83
- const launch = resolveSpawn(command, args) ?? { command, args };
84
- return spawn(launch.command, launch.args, {
85
- ...options,
86
- ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
87
- });
88
- }
89
- var init_binary_launch = __esm({
90
- "packages/experience-design-system-generation/dist/src/lib/binary-launch.js"() {
91
- "use strict";
92
- }
93
- });
94
-
95
24
  // packages/experience-design-system-generation/dist/src/agent-runner.js
25
+ import { spawn } from "node:child_process";
96
26
  function findJsonObjectEnd(line) {
97
27
  let depth = 0;
98
28
  let inString = false;
@@ -367,22 +297,10 @@ function codexBedrockConfigArgs() {
367
297
  const region = process.env.AWS_REGION?.trim() || process.env.AWS_DEFAULT_REGION?.trim() || DEFAULT_CODEX_BEDROCK_REGION;
368
298
  return ["-c", "model_provider=amazon-bedrock", "-c", `model_providers.amazon-bedrock.region=${region}`];
369
299
  }
370
- function agentSupportsStdinPrompt(agent) {
371
- return STDIN_CAPABLE_AGENTS.has(agent);
372
- }
373
- function shouldUseStdinPrompt(agent, prompt2) {
374
- return agentSupportsStdinPrompt(agent) && prompt2.length > ARGV_PROMPT_LIMIT;
375
- }
376
- function promptExceedsArgvLimit(agent, prompt2, platform = process.platform) {
377
- if (agentSupportsStdinPrompt(agent))
378
- return false;
379
- return platform === "win32" && prompt2.length > 8191;
380
- }
381
300
  function buildArgs(agent, prompt2, model, promptViaStdin = false, bedrock = false) {
382
301
  const resolvedModel = resolveAgentModel(agent, model, bedrock);
383
302
  const modelArg = resolvedModel ? ["--model", resolvedModel] : [];
384
- const useStdin2 = promptViaStdin && agentSupportsStdinPrompt(agent);
385
- const promptArg = useStdin2 ? [] : [prompt2];
303
+ const promptArg = promptViaStdin ? [] : [prompt2];
386
304
  switch (agent) {
387
305
  case "claude":
388
306
  return ["--print", ...modelArg, ...promptArg];
@@ -405,7 +323,7 @@ async function runAgent(options) {
405
323
  const { agent, prompt: prompt2, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
406
324
  const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === "1";
407
325
  const binary = resolveBinary(agent);
408
- const useStdin2 = agentSupportsStdinPrompt(agent) && (!!promptViaStdin || shouldUseStdinPrompt(agent, prompt2));
326
+ const useStdin2 = !!promptViaStdin;
409
327
  const args = buildArgs(agent, prompt2, model, useStdin2, bedrock);
410
328
  const startedAt = Date.now();
411
329
  onDebugEvent?.("run.start", {
@@ -419,7 +337,7 @@ async function runAgent(options) {
419
337
  });
420
338
  return new Promise((resolve29) => {
421
339
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
422
- const child = spawnBinary(binary, args, {
340
+ const child = spawn(binary, args, {
423
341
  stdio: ["pipe", "pipe", "pipe"],
424
342
  ...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
425
343
  });
@@ -472,13 +390,20 @@ async function runAgent(options) {
472
390
  }
473
391
  async function checkAgentAuth(agent) {
474
392
  const binary = resolveBinary(agent);
475
- const resolvedBinary = findBinary(binary);
476
- if (!resolvedBinary)
393
+ const binaryExists2 = await new Promise((resolve29) => {
394
+ if (binary.startsWith("/")) {
395
+ import("node:fs/promises").then((fs2) => fs2.access(binary).then(() => resolve29(true), () => resolve29(false)));
396
+ return;
397
+ }
398
+ const child = spawn("which", [binary], { stdio: "ignore" });
399
+ child.on("close", (code) => resolve29(code === 0));
400
+ });
401
+ if (!binaryExists2)
477
402
  return "not-found";
478
403
  if (agent !== "claude")
479
404
  return "ok";
480
405
  return new Promise((resolve29) => {
481
- const child = spawnBinary(resolvedBinary, ["auth", "status", "--json"], {
406
+ const child = spawn(binary, ["auth", "status", "--json"], {
482
407
  stdio: ["ignore", "pipe", "pipe"]
483
408
  });
484
409
  let stdout = "";
@@ -532,11 +457,10 @@ function extractSentinelOutput(stdout) {
532
457
  return "multiple";
533
458
  return stdout.slice(startIdx + START.length, endIdx).trim();
534
459
  }
535
- var VALID_SELECT_TOOL_NAMES, VALID_TOOL_NAMES, VALID_TOKEN_TOOL_NAMES, VALID_CDF_TYPES, VALID_CATEGORIES, AGENT_BINARIES, BEDROCK_ENV_BY_AGENT, BEDROCK_CAPABLE_AGENTS, DEFAULT_CODEX_BEDROCK_REGION, DEFAULT_OPENCODE_MODEL, DEFAULT_MODELS, DEFAULT_CODEX_BEDROCK_MODEL, STDIN_CAPABLE_AGENTS, ARGV_PROMPT_LIMIT;
460
+ var VALID_SELECT_TOOL_NAMES, VALID_TOOL_NAMES, VALID_TOKEN_TOOL_NAMES, VALID_CDF_TYPES, VALID_CATEGORIES, AGENT_BINARIES, BEDROCK_ENV_BY_AGENT, BEDROCK_CAPABLE_AGENTS, DEFAULT_CODEX_BEDROCK_REGION, DEFAULT_OPENCODE_MODEL, DEFAULT_MODELS, DEFAULT_CODEX_BEDROCK_MODEL;
536
461
  var init_agent_runner = __esm({
537
462
  "packages/experience-design-system-generation/dist/src/agent-runner.js"() {
538
463
  "use strict";
539
- init_binary_launch();
540
464
  init_agent_names();
541
465
  VALID_SELECT_TOOL_NAMES = /* @__PURE__ */ new Set(["select_component", "reject_component"]);
542
466
  VALID_TOOL_NAMES = /* @__PURE__ */ new Set(["classify_prop", "exclude_prop", "classify_component", "classify_slot"]);
@@ -565,8 +489,6 @@ var init_agent_runner = __esm({
565
489
  // the only model guaranteed on every Copilot plan (Free/Pro/Business/Enterprise); Pro+ users override via EDS_AGENT_MODEL_COPILOT
566
490
  };
567
491
  DEFAULT_CODEX_BEDROCK_MODEL = "openai.gpt-5.6-luna";
568
- STDIN_CAPABLE_AGENTS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "cursor"]);
569
- ARGV_PROMPT_LIMIT = 4096;
570
492
  }
571
493
  });
572
494
 
@@ -592,7 +514,7 @@ var init_agent_invoker = __esm({
592
514
  // packages/experience-design-system-generation/dist/src/prompt-builder.js
593
515
  import { existsSync } from "node:fs";
594
516
  import { readFile } from "node:fs/promises";
595
- import { dirname, join as join2, resolve } from "node:path";
517
+ import { dirname, join, resolve } from "node:path";
596
518
  import { fileURLToPath } from "node:url";
597
519
  import { flattenDTCG } from "@contentful/experience-design-system-types";
598
520
  function formatCustomPromptBanner(skill, path) {
@@ -616,9 +538,9 @@ function resolveSkillPath(skill) {
616
538
  const thisDir = dirname(fileURLToPath(import.meta.url));
617
539
  let dir = thisDir;
618
540
  for (; ; ) {
619
- const candidate = join2(dir, "skills");
541
+ const candidate = join(dir, "skills");
620
542
  if (existsSync(candidate))
621
- return join2(candidate, SKILL_FILES[skill]);
543
+ return join(candidate, SKILL_FILES[skill]);
622
544
  const parent = resolve(dir, "..");
623
545
  if (parent === dir) {
624
546
  throw new Error(`skill file missing from CLI installation (could not locate skills/ directory from: ${thisDir})`);
@@ -969,15 +891,12 @@ __export(src_exports, {
969
891
  AGENT_NAMES: () => AGENT_NAMES,
970
892
  DEFAULT_AGENT_NAME: () => DEFAULT_AGENT_NAME,
971
893
  agentSupportsBedrock: () => agentSupportsBedrock,
972
- agentSupportsStdinPrompt: () => agentSupportsStdinPrompt,
973
- binaryExists: () => binaryExists,
974
894
  buildArgs: () => buildArgs,
975
895
  buildPrompt: () => buildPrompt,
976
896
  checkAgentAuth: () => checkAgentAuth,
977
897
  createLocalCliAgentInvoker: () => createLocalCliAgentInvoker,
978
898
  describeAgentFailure: () => describeAgentFailure,
979
899
  extractSentinelOutput: () => extractSentinelOutput,
980
- findBinary: () => findBinary,
981
900
  formatCustomPromptBanner: () => formatCustomPromptBanner,
982
901
  formatGenerateProgressLine: () => formatGenerateProgressLine,
983
902
  isAgentName: () => isAgentName,
@@ -985,13 +904,10 @@ __export(src_exports, {
985
904
  parseSelectToolCallLines: () => parseSelectToolCallLines,
986
905
  parseTokenToolCallLines: () => parseTokenToolCallLines,
987
906
  parseToolCallLines: () => parseToolCallLines,
988
- promptExceedsArgvLimit: () => promptExceedsArgvLimit,
989
907
  resolveAgentModel: () => resolveAgentModel,
990
908
  resolveBinary: () => resolveBinary,
991
909
  resolveSkillPath: () => resolveSkillPath,
992
- runAgent: () => runAgent,
993
- shouldUseStdinPrompt: () => shouldUseStdinPrompt,
994
- spawnBinary: () => spawnBinary
910
+ runAgent: () => runAgent
995
911
  });
996
912
  var init_src = __esm({
997
913
  "packages/experience-design-system-generation/dist/src/index.js"() {
@@ -1001,7 +917,6 @@ var init_src = __esm({
1001
917
  init_agent_invoker();
1002
918
  init_prompt_builder();
1003
919
  init_progress();
1004
- init_binary_launch();
1005
920
  }
1006
921
  });
1007
922
 
@@ -1017,7 +932,7 @@ var init_types = __esm({
1017
932
 
1018
933
  // packages/experience-design-system-extraction/dist/src/extract/tsx-shared.js
1019
934
  import { existsSync as existsSync2, readFileSync } from "node:fs";
1020
- import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
935
+ import { dirname as dirname2, join as join2, resolve as resolve2 } from "node:path";
1021
936
  import { Node, Project, SyntaxKind } from "ts-morph";
1022
937
  import ts from "typescript";
1023
938
  function createTsxProject(filePaths) {
@@ -1174,7 +1089,7 @@ function findNearestTsConfigPath(filePath) {
1174
1089
  let currentDir = dirname2(filePath);
1175
1090
  while (true) {
1176
1091
  for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
1177
- const candidatePath = join3(currentDir, candidateName);
1092
+ const candidatePath = join2(currentDir, candidateName);
1178
1093
  if (existsSync2(candidatePath)) {
1179
1094
  nearestTsConfigPathCache.set(filePath, candidatePath);
1180
1095
  return candidatePath;
@@ -1231,10 +1146,10 @@ function resolveImportSourcePath(basePath) {
1231
1146
  `${basePath}.tsx`,
1232
1147
  `${basePath}.js`,
1233
1148
  `${basePath}.jsx`,
1234
- join3(basePath, "index.ts"),
1235
- join3(basePath, "index.tsx"),
1236
- join3(basePath, "index.js"),
1237
- join3(basePath, "index.jsx")
1149
+ join2(basePath, "index.ts"),
1150
+ join2(basePath, "index.tsx"),
1151
+ join2(basePath, "index.js"),
1152
+ join2(basePath, "index.jsx")
1238
1153
  ];
1239
1154
  return candidates.find((candidatePath) => existsSync2(candidatePath));
1240
1155
  }
@@ -1245,10 +1160,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
1245
1160
  `${resolvedPath}.tsx`,
1246
1161
  `${resolvedPath}.js`,
1247
1162
  `${resolvedPath}.jsx`,
1248
- join3(resolvedPath, "index.ts"),
1249
- join3(resolvedPath, "index.tsx"),
1250
- join3(resolvedPath, "index.js"),
1251
- join3(resolvedPath, "index.jsx")
1163
+ join2(resolvedPath, "index.ts"),
1164
+ join2(resolvedPath, "index.tsx"),
1165
+ join2(resolvedPath, "index.js"),
1166
+ join2(resolvedPath, "index.jsx")
1252
1167
  ];
1253
1168
  for (const candidatePath of candidatePaths) {
1254
1169
  const sourceFile = project.getSourceFile(candidatePath);
@@ -1269,10 +1184,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
1269
1184
  if (!packageRootDir)
1270
1185
  return void 0;
1271
1186
  const preferredEntryPaths = [
1272
- join3(packageRootDir, "src/index.ts"),
1273
- join3(packageRootDir, "src/index.tsx"),
1274
- join3(packageRootDir, "index.ts"),
1275
- join3(packageRootDir, "index.tsx")
1187
+ join2(packageRootDir, "src/index.ts"),
1188
+ join2(packageRootDir, "src/index.tsx"),
1189
+ join2(packageRootDir, "index.ts"),
1190
+ join2(packageRootDir, "index.tsx")
1276
1191
  ];
1277
1192
  for (const entryPath of preferredEntryPaths) {
1278
1193
  const entrySourceFile = project.getSourceFile(entryPath);
@@ -1280,7 +1195,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
1280
1195
  return entrySourceFile;
1281
1196
  }
1282
1197
  }
1283
- return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join3(packageRootDir, "src"));
1198
+ return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join2(packageRootDir, "src"));
1284
1199
  }
1285
1200
  function getWorkspacePackageManifestForSourceFile(sourceFile) {
1286
1201
  const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
@@ -1289,7 +1204,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
1289
1204
  if (workspacePackageManifestCache.has(packageRootDir)) {
1290
1205
  return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
1291
1206
  }
1292
- const packageJsonPath = join3(packageRootDir, "package.json");
1207
+ const packageJsonPath = join2(packageRootDir, "package.json");
1293
1208
  try {
1294
1209
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
1295
1210
  const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
@@ -1306,7 +1221,7 @@ function findNearestPackageRootDir(filePath) {
1306
1221
  }
1307
1222
  let currentDir = dirname2(filePath);
1308
1223
  while (true) {
1309
- if (existsSync2(join3(currentDir, "package.json"))) {
1224
+ if (existsSync2(join2(currentDir, "package.json"))) {
1310
1225
  packageRootByFilePathCache.set(filePath, currentDir);
1311
1226
  return currentDir;
1312
1227
  }
@@ -4306,7 +4221,7 @@ var init_vue_tsx = __esm({
4306
4221
 
4307
4222
  // packages/experience-design-system-extraction/dist/src/extract/resolve-local-module.js
4308
4223
  import { existsSync as existsSync3, statSync } from "node:fs";
4309
- import { dirname as dirname3, join as join4, resolve as resolve3 } from "node:path";
4224
+ import { dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
4310
4225
  function resolveLocalModule(importingFilePath, specifier, options = {}) {
4311
4226
  const basePath = resolve3(dirname3(importingFilePath), specifier);
4312
4227
  const candidates = [
@@ -4315,10 +4230,10 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
4315
4230
  `${basePath}.ts`,
4316
4231
  `${basePath}.mjs`,
4317
4232
  `${basePath}.cjs`,
4318
- join4(basePath, "index.js"),
4319
- join4(basePath, "index.ts"),
4320
- join4(basePath, "index.mjs"),
4321
- join4(basePath, "index.cjs")
4233
+ join3(basePath, "index.js"),
4234
+ join3(basePath, "index.ts"),
4235
+ join3(basePath, "index.mjs"),
4236
+ join3(basePath, "index.cjs")
4322
4237
  ];
4323
4238
  for (const candidate of candidates) {
4324
4239
  if (existsSync3(candidate) && statSync(candidate).isFile())
@@ -4356,7 +4271,7 @@ var init_resolve_type_property = __esm({
4356
4271
  });
4357
4272
 
4358
4273
  // packages/experience-design-system-extraction/dist/src/extract/vue.js
4359
- import { basename, dirname as dirname4, resolve as resolve4, join as join5 } from "node:path";
4274
+ import { basename, dirname as dirname4, resolve as resolve4, join as join4 } from "node:path";
4360
4275
  import { readFile as readFile3 } from "node:fs/promises";
4361
4276
  import { existsSync as existsSync4, readFileSync as readFileSync2, readdirSync, statSync as statSync2 } from "node:fs";
4362
4277
  import os from "node:os";
@@ -4572,11 +4487,11 @@ function findWorkspaceRoot(startDir) {
4572
4487
  return workspaceRootCache.get(startDir);
4573
4488
  let dir = startDir;
4574
4489
  while (true) {
4575
- const pkgJsonPath = join5(dir, "package.json");
4490
+ const pkgJsonPath = join4(dir, "package.json");
4576
4491
  if (existsSync4(pkgJsonPath)) {
4577
4492
  try {
4578
4493
  const pkg4 = JSON.parse(readFileSync2(pkgJsonPath, "utf8"));
4579
- if (pkg4.workspaces || existsSync4(join5(dir, "pnpm-workspace.yaml"))) {
4494
+ if (pkg4.workspaces || existsSync4(join4(dir, "pnpm-workspace.yaml"))) {
4580
4495
  workspaceRootCache.set(startDir, dir);
4581
4496
  return dir;
4582
4497
  }
@@ -4596,7 +4511,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
4596
4511
  return workspacePackageDirsCache.get(workspaceRoot);
4597
4512
  }
4598
4513
  const packageMap = /* @__PURE__ */ new Map();
4599
- const packagesDir = join5(workspaceRoot, "packages");
4514
+ const packagesDir = join4(workspaceRoot, "packages");
4600
4515
  if (!existsSync4(packagesDir)) {
4601
4516
  workspacePackageDirsCache.set(workspaceRoot, packageMap);
4602
4517
  return packageMap;
@@ -4610,7 +4525,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
4610
4525
  } catch {
4611
4526
  return;
4612
4527
  }
4613
- const pkgJsonPath = join5(dir, "package.json");
4528
+ const pkgJsonPath = join4(dir, "package.json");
4614
4529
  if (existsSync4(pkgJsonPath)) {
4615
4530
  try {
4616
4531
  const pkg4 = JSON.parse(readFileSync2(pkgJsonPath, "utf8"));
@@ -4623,7 +4538,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
4623
4538
  for (const entry of entries) {
4624
4539
  if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
4625
4540
  continue;
4626
- const entryPath = join5(dir, entry);
4541
+ const entryPath = join4(dir, entry);
4627
4542
  try {
4628
4543
  const stat8 = statSync2(entryPath);
4629
4544
  if (stat8.isDirectory()) {
@@ -4663,7 +4578,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
4663
4578
  const packageDir = packageDirs.get(packageName);
4664
4579
  if (!packageDir)
4665
4580
  return null;
4666
- const pkgJsonPath = join5(packageDir, "package.json");
4581
+ const pkgJsonPath = join4(packageDir, "package.json");
4667
4582
  try {
4668
4583
  const pkg4 = JSON.parse(readFileSync2(pkgJsonPath, "utf8"));
4669
4584
  if (pkg4.exports && subpath !== ".") {
@@ -4676,8 +4591,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
4676
4591
  }
4677
4592
  if (subpath !== ".") {
4678
4593
  const subDir = resolve4(packageDir, subpath.replace(/^\.\//, ""));
4679
- for (const base of [join5(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
4680
- const subPkgPath = join5(base, "package.json");
4594
+ for (const base of [join4(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
4595
+ const subPkgPath = join4(base, "package.json");
4681
4596
  if (existsSync4(subPkgPath)) {
4682
4597
  try {
4683
4598
  const subPkg = JSON.parse(readFileSync2(subPkgPath, "utf8"));
@@ -5141,7 +5056,7 @@ var init_astro = __esm({
5141
5056
  });
5142
5057
 
5143
5058
  // packages/experience-design-system-extraction/dist/src/extract/web-components.js
5144
- import { basename as basename3, dirname as dirname5, join as join6, resolve as resolve5 } from "node:path";
5059
+ import { basename as basename3, dirname as dirname5, join as join5, resolve as resolve5 } from "node:path";
5145
5060
  import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
5146
5061
  function normalizeComponentName(input) {
5147
5062
  return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
@@ -5794,14 +5709,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
5794
5709
  if (!specifier.startsWith(spectrumPrefix)) {
5795
5710
  return null;
5796
5711
  }
5797
- const packagesMarker = `${join6("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
5712
+ const packagesMarker = `${join5("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
5798
5713
  const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
5799
5714
  if (markerIndex === -1) {
5800
5715
  return null;
5801
5716
  }
5802
5717
  const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
5803
5718
  const componentPath = specifier.slice(spectrumPrefix.length);
5804
- return join6(packagesRoot, "core", "components", componentPath, "index.ts");
5719
+ return join5(packagesRoot, "core", "components", componentPath, "index.ts");
5805
5720
  }
5806
5721
  function getImportedBaseClass(classDecl, project, visitedFiles) {
5807
5722
  const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
@@ -6067,7 +5982,7 @@ var init_scoring = __esm({
6067
5982
  });
6068
5983
 
6069
5984
  // packages/experience-design-system-extraction/dist/src/extract/svelte.js
6070
- import { basename as basename4, dirname as dirname6, resolve as resolve6, join as join7 } from "node:path";
5985
+ import { basename as basename4, dirname as dirname6, resolve as resolve6, join as join6 } from "node:path";
6071
5986
  import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
6072
5987
  import { createRequire } from "node:module";
6073
5988
  import os3 from "node:os";
@@ -6202,7 +6117,7 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
6202
6117
  function findNearestTsconfig(startDir) {
6203
6118
  let dir = startDir;
6204
6119
  for (let i = 0; i < 16; i++) {
6205
- const candidate = join7(dir, "tsconfig.json");
6120
+ const candidate = join6(dir, "tsconfig.json");
6206
6121
  if (existsSync5(candidate))
6207
6122
  return candidate;
6208
6123
  const parent = dirname6(dir);
@@ -6338,7 +6253,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
6338
6253
  const seedDir = resolvedJs ? dirname6(resolvedJs) : dirname6(parentFile);
6339
6254
  const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
6340
6255
  if (pkgRoot) {
6341
- const pkgJsonPath = join7(pkgRoot, "package.json");
6256
+ const pkgJsonPath = join6(pkgRoot, "package.json");
6342
6257
  if (existsSync5(pkgJsonPath)) {
6343
6258
  try {
6344
6259
  const pkgRaw = readFileSync3(pkgJsonPath, "utf-8");
@@ -6359,7 +6274,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
6359
6274
  }
6360
6275
  }
6361
6276
  for (const entry of ["index.d.ts", "index.d.mts"]) {
6362
- const candidate = join7(pkgRoot, entry);
6277
+ const candidate = join6(pkgRoot, entry);
6363
6278
  if (existsSync5(candidate))
6364
6279
  return candidate;
6365
6280
  }
@@ -6377,9 +6292,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
6377
6292
  function findPackageRootForSpecifier(seedDir, specifier) {
6378
6293
  let dir = seedDir;
6379
6294
  for (let i = 0; i < 32; i++) {
6380
- if (existsSync5(join7(dir, "package.json"))) {
6295
+ if (existsSync5(join6(dir, "package.json"))) {
6381
6296
  try {
6382
- const pkgRaw = readFileSync3(join7(dir, "package.json"), "utf-8");
6297
+ const pkgRaw = readFileSync3(join6(dir, "package.json"), "utf-8");
6383
6298
  const pkg4 = JSON.parse(pkgRaw);
6384
6299
  if (pkg4.name === specifier)
6385
6300
  return dir;
@@ -7354,11 +7269,11 @@ function getPathPreferenceScore(filePath) {
7354
7269
  const normalized = filePath.replace(/\\/g, "/");
7355
7270
  const segments = normalized.split("/").filter(Boolean);
7356
7271
  const filename = segments.at(-1) ?? "";
7357
- const basename8 = filename.replace(/\.[^.]+$/, "");
7272
+ const basename7 = filename.replace(/\.[^.]+$/, "");
7358
7273
  let score = 0;
7359
7274
  if (/^index\.[jt]sx?$/.test(filename))
7360
7275
  score += 100;
7361
- if (basename8 && segments.at(-2) === basename8)
7276
+ if (basename7 && segments.at(-2) === basename7)
7362
7277
  score -= 10;
7363
7278
  const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
7364
7279
  score -= componentsSegmentCount * 8;
@@ -8190,18 +8105,18 @@ var init_src2 = __esm({
8190
8105
 
8191
8106
  // packages/experience-design-system-cli/src/lib/cli-path.ts
8192
8107
  import { existsSync as existsSync6 } from "node:fs";
8193
- import { dirname as dirname7, join as join8 } from "node:path";
8108
+ import { dirname as dirname7, join as join7 } from "node:path";
8194
8109
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8195
8110
  function findCliPath() {
8196
8111
  let dir = dirname7(fileURLToPath2(import.meta.url));
8197
8112
  for (let i = 0; i < 8; i++) {
8198
- const candidate = join8(dir, "bin", "cli.js");
8113
+ const candidate = join7(dir, "bin", "cli.js");
8199
8114
  if (existsSync6(candidate)) return candidate;
8200
8115
  const parent = dirname7(dir);
8201
8116
  if (parent === dir) break;
8202
8117
  dir = parent;
8203
8118
  }
8204
- return join8(fileURLToPath2(import.meta.url), "..", "..", "..", "..", "bin", "cli.js");
8119
+ return join7(fileURLToPath2(import.meta.url), "..", "..", "..", "..", "bin", "cli.js");
8205
8120
  }
8206
8121
  function findPkgRoot() {
8207
8122
  return dirname7(dirname7(findCliPath()));
@@ -8214,7 +8129,7 @@ var init_cli_path = __esm({
8214
8129
 
8215
8130
  // packages/experience-design-system-cli/src/analyze/select/tui/components/TopBar.tsx
8216
8131
  import { readFileSync as readFileSync4 } from "node:fs";
8217
- import { join as join9 } from "node:path";
8132
+ import { join as join8 } from "node:path";
8218
8133
  import { Box, Text } from "ink";
8219
8134
  import { jsx, jsxs } from "react/jsx-runtime";
8220
8135
  function TopBar({ subcommand, hints }) {
@@ -8231,7 +8146,7 @@ var init_TopBar = __esm({
8231
8146
  "packages/experience-design-system-cli/src/analyze/select/tui/components/TopBar.tsx"() {
8232
8147
  "use strict";
8233
8148
  init_cli_path();
8234
- VERSION = JSON.parse(readFileSync4(join9(findPkgRoot(), "package.json"), "utf8")).version;
8149
+ VERSION = JSON.parse(readFileSync4(join8(findPkgRoot(), "package.json"), "utf8")).version;
8235
8150
  }
8236
8151
  });
8237
8152
 
@@ -11028,13 +10943,13 @@ var init_persistence = __esm({
11028
10943
  // packages/experience-design-system-cli/src/analyze/select/parser.ts
11029
10944
  import { createHash as createHash6 } from "node:crypto";
11030
10945
  import { access as access2 } from "node:fs/promises";
11031
- import { isAbsolute as isAbsolute2, relative, resolve as resolve10 } from "node:path";
10946
+ import { isAbsolute, relative, resolve as resolve10 } from "node:path";
11032
10947
  function createComponentId(name, resolvedSourcePath) {
11033
10948
  const sourceHash = createHash6("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
11034
10949
  return `${name}-${sourceHash}`;
11035
10950
  }
11036
10951
  async function resolveComponentSourcePath(source, reviewRoot) {
11037
- if (isAbsolute2(source)) {
10952
+ if (isAbsolute(source)) {
11038
10953
  try {
11039
10954
  await access2(source);
11040
10955
  return source;
@@ -11044,7 +10959,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
11044
10959
  }
11045
10960
  const candidate = resolve10(reviewRoot, source);
11046
10961
  const relativeToRoot = relative(reviewRoot, candidate);
11047
- if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute2(relativeToRoot)) {
10962
+ if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
11048
10963
  throw new Error(
11049
10964
  `Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`
11050
10965
  );
@@ -12835,7 +12750,7 @@ var init_host_utils = __esm({
12835
12750
 
12836
12751
  // packages/experience-design-system-cli/src/lib/debug-logger.ts
12837
12752
  import { mkdirSync as mkdirSync2, appendFileSync } from "node:fs";
12838
- import { join as join10, dirname as dirname9 } from "node:path";
12753
+ import { join as join9, dirname as dirname9 } from "node:path";
12839
12754
  import { homedir as homedir3 } from "node:os";
12840
12755
  function redactValue(value, seen) {
12841
12756
  if (value === null || value === void 0) return value;
@@ -12861,7 +12776,7 @@ function redactForDebug(payload) {
12861
12776
  return redactValue(payload, /* @__PURE__ */ new WeakSet());
12862
12777
  }
12863
12778
  function defaultDebugRoot() {
12864
- return process.env[DEBUG_ROOT_ENV] ?? join10(homedir3(), ".contentful", "experience-design-system-cli", "debug");
12779
+ return process.env[DEBUG_ROOT_ENV] ?? join9(homedir3(), ".contentful", "experience-design-system-cli", "debug");
12865
12780
  }
12866
12781
  function makeSessionTimestamp() {
12867
12782
  const override = process.env["EDSI_DEBUG_TS"];
@@ -12885,7 +12800,7 @@ function initDebugLogger(opts) {
12885
12800
  const root = opts.root ?? defaultDebugRoot();
12886
12801
  const ts3 = makeSessionTimestamp();
12887
12802
  const suffix = opts.command ? `-${opts.command}` : "";
12888
- const path = join10(root, `${ts3}${suffix}.jsonl`);
12803
+ const path = join9(root, `${ts3}${suffix}.jsonl`);
12889
12804
  singleton = new FileDebugLogger(path);
12890
12805
  process.env[DEBUG_LOG_ENV] = path;
12891
12806
  if (opts.command) singleton.event("config", "command.start", { command: opts.command });
@@ -13006,7 +12921,7 @@ var init_debug_logger = __esm({
13006
12921
 
13007
12922
  // packages/experience-design-system-cli/src/lib/user-agent.ts
13008
12923
  import { readFileSync as readFileSync6 } from "node:fs";
13009
- import { join as join11 } from "node:path";
12924
+ import { join as join10 } from "node:path";
13010
12925
  function buildUserAgent(version = pkg.version) {
13011
12926
  const parts = [`app ${APP}/${version}`, `platform node.js/${process.version}`];
13012
12927
  const os4 = OS_NAMES[process.platform];
@@ -13018,7 +12933,7 @@ var init_user_agent = __esm({
13018
12933
  "packages/experience-design-system-cli/src/lib/user-agent.ts"() {
13019
12934
  "use strict";
13020
12935
  init_cli_path();
13021
- pkg = JSON.parse(readFileSync6(join11(findPkgRoot(), "package.json"), "utf8"));
12936
+ pkg = JSON.parse(readFileSync6(join10(findPkgRoot(), "package.json"), "utf8"));
13022
12937
  APP = "contentful.experience-design-system-cli";
13023
12938
  OS_NAMES = {
13024
12939
  android: "Android",
@@ -14464,7 +14379,7 @@ __export(credentials_store_exports, {
14464
14379
  writeExperiencesCredentials: () => writeExperiencesCredentials
14465
14380
  });
14466
14381
  import { readFile as readFile8, writeFile as writeFile2, mkdir as mkdir2 } from "node:fs/promises";
14467
- import { join as join12 } from "node:path";
14382
+ import { join as join11 } from "node:path";
14468
14383
  import { homedir as homedir4 } from "node:os";
14469
14384
  async function readExperiencesCredentials() {
14470
14385
  try {
@@ -14540,14 +14455,14 @@ var init_credentials_store = __esm({
14540
14455
  "use strict";
14541
14456
  init_host_utils();
14542
14457
  init_composition_mode();
14543
- CREDENTIALS_DIR = join12(homedir4(), ".config", "experiences");
14544
- CREDENTIALS_PATH = join12(CREDENTIALS_DIR, "credentials.json");
14458
+ CREDENTIALS_DIR = join11(homedir4(), ".config", "experiences");
14459
+ CREDENTIALS_PATH = join11(CREDENTIALS_DIR, "credentials.json");
14545
14460
  }
14546
14461
  });
14547
14462
 
14548
14463
  // packages/experience-design-system-cli/src/analytics/client.ts
14549
14464
  import { readFileSync as readFileSync7 } from "node:fs";
14550
- import { join as join13 } from "node:path";
14465
+ import { join as join12 } from "node:path";
14551
14466
  import { Analytics } from "@segment/analytics-node";
14552
14467
  function cliVersion() {
14553
14468
  return pkg2.version;
@@ -14601,7 +14516,7 @@ var init_client2 = __esm({
14601
14516
  "packages/experience-design-system-cli/src/analytics/client.ts"() {
14602
14517
  "use strict";
14603
14518
  init_cli_path();
14604
- pkg2 = JSON.parse(readFileSync7(join13(findPkgRoot(), "package.json"), "utf8"));
14519
+ pkg2 = JSON.parse(readFileSync7(join12(findPkgRoot(), "package.json"), "utf8"));
14605
14520
  DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
14606
14521
  analyticsClient = null;
14607
14522
  persistedDisabled = false;
@@ -14898,7 +14813,7 @@ var init_path_exists = __esm({
14898
14813
  import { createElement, useState as useState6 } from "react";
14899
14814
  import { render, useInput as useInput2 } from "ink";
14900
14815
  import { readFile as readFile9, readdir, stat } from "node:fs/promises";
14901
- import { join as join14 } from "node:path";
14816
+ import { join as join13 } from "node:path";
14902
14817
  import {
14903
14818
  validateCDF,
14904
14819
  flattenDTCG as flattenDTCG2,
@@ -14942,7 +14857,7 @@ async function collectJsonFiles(dir) {
14942
14857
  await Promise.all(
14943
14858
  entries.map(async (entry) => {
14944
14859
  if (IGNORE_TOKEN_DIRS.has(entry)) return;
14945
- const full = join14(current, entry);
14860
+ const full = join13(current, entry);
14946
14861
  let s;
14947
14862
  try {
14948
14863
  s = await stat(full);
@@ -16763,7 +16678,7 @@ var init_fetch_existing_contentful_entities = __esm({
16763
16678
 
16764
16679
  // packages/experience-design-system-cli/src/helpers/fetch-and-persist-existing-contentful-entities.ts
16765
16680
  import { writeFile as writeFile5 } from "node:fs/promises";
16766
- import { join as join20 } from "node:path";
16681
+ import { join as join19 } from "node:path";
16767
16682
  async function fetchAndPersistExistingContentfulEntities(params) {
16768
16683
  const t0 = Date.now();
16769
16684
  try {
@@ -16775,7 +16690,7 @@ async function fetchAndPersistExistingContentfulEntities(params) {
16775
16690
  spaceId: params.spaceId,
16776
16691
  environmentId: params.environmentId
16777
16692
  });
16778
- const path = join20(params.outDir, ".existing-entities.json");
16693
+ const path = join19(params.outDir, ".existing-entities.json");
16779
16694
  await writeFile5(path, JSON.stringify(entities, null, 2), "utf8");
16780
16695
  return { ok: true, path, durationMs: Date.now() - t0, entities };
16781
16696
  } catch (error) {
@@ -16796,7 +16711,7 @@ var init_fetch_and_persist_existing_contentful_entities = __esm({
16796
16711
 
16797
16712
  // packages/experience-design-system-cli/src/runs/save-path-resolver.ts
16798
16713
  import { access as access7 } from "node:fs/promises";
16799
- import { join as join22 } from "node:path";
16714
+ import { join as join21 } from "node:path";
16800
16715
  function isConflictMode(value) {
16801
16716
  return CONFLICT_MODES.includes(value);
16802
16717
  }
@@ -16804,7 +16719,7 @@ async function listConflictingFiles(path) {
16804
16719
  const conflicts = [];
16805
16720
  for (const name of SAVE_FILES) {
16806
16721
  try {
16807
- await access7(join22(path, name));
16722
+ await access7(join21(path, name));
16808
16723
  conflicts.push(name);
16809
16724
  } catch {
16810
16725
  }
@@ -16824,7 +16739,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
16824
16739
  const hh = pad2(now.getHours());
16825
16740
  const mm = pad2(now.getMinutes());
16826
16741
  const ss = pad2(now.getSeconds());
16827
- return join22(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
16742
+ return join21(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
16828
16743
  }
16829
16744
  async function resolveSavePath(path, options = {}) {
16830
16745
  const conflicts = await listConflictingFiles(path);
@@ -16855,7 +16770,7 @@ var init_save_path_resolver = __esm({
16855
16770
 
16856
16771
  // packages/experience-design-system-cli/src/runs/store.ts
16857
16772
  import { readFile as readFile21, writeFile as writeFile6, mkdir as mkdir6, rename } from "node:fs/promises";
16858
- import { join as join23 } from "node:path";
16773
+ import { join as join22 } from "node:path";
16859
16774
  import { homedir as homedir7 } from "node:os";
16860
16775
  import { randomBytes as randomBytes2 } from "node:crypto";
16861
16776
  function runsFilePath() {
@@ -16976,8 +16891,8 @@ var init_store = __esm({
16976
16891
  RUNS_FILE_VERSION = 3;
16977
16892
  RUNS_FILE_CAP = 200;
16978
16893
  READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
16979
- RUNS_DIR = join23(homedir7(), ".config", "experiences");
16980
- RUNS_PATH = join23(RUNS_DIR, "runs.json");
16894
+ RUNS_DIR = join22(homedir7(), ".config", "experiences");
16895
+ RUNS_PATH = join22(RUNS_DIR, "runs.json");
16981
16896
  CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
16982
16897
  }
16983
16898
  });
@@ -17012,12 +16927,11 @@ async function resolveRunTarget(arg) {
17012
16927
  }
17013
16928
  function looksLikePath2(arg) {
17014
16929
  if (arg === "." || arg === "~") return true;
17015
- if (/^[A-Za-z]:[\\/]/.test(arg) || arg.startsWith("\\\\")) return true;
17016
- return arg.startsWith("/") || arg.startsWith("./") || arg.startsWith("../") || arg.startsWith(".\\") || arg.startsWith("..\\") || arg.startsWith("~/") || arg.startsWith("~\\");
16930
+ return arg.startsWith("/") || arg.startsWith("./") || arg.startsWith("../") || arg.startsWith("~/");
17017
16931
  }
17018
16932
  function expandHome(arg) {
17019
16933
  if (arg === "~") return homedir8();
17020
- if (arg.startsWith("~/") || arg.startsWith("~\\")) return resolvePath(homedir8(), arg.slice(2));
16934
+ if (arg.startsWith("~/")) return resolvePath(homedir8(), arg.slice(2));
17021
16935
  return arg;
17022
16936
  }
17023
16937
  var init_resolve_run_target = __esm({
@@ -17058,13 +16972,13 @@ var init_use_blinking_cursor = __esm({
17058
16972
  import { useState as useState10 } from "react";
17059
16973
  import { Box as Box20, Text as Text21 } from "ink";
17060
16974
  import { readdirSync as readdirSync3 } from "node:fs";
17061
- import { dirname as dirname14, basename as basename7, join as join24 } from "node:path";
16975
+ import { dirname as dirname14, basename as basename6, join as join23 } from "node:path";
17062
16976
  import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
17063
16977
  function autocomplete(partial) {
17064
16978
  if (!partial) return null;
17065
16979
  const normalized = normalizePath(partial);
17066
16980
  const dir = dirname14(normalized);
17067
- const base = basename7(normalized);
16981
+ const base = basename6(normalized);
17068
16982
  let entries;
17069
16983
  try {
17070
16984
  entries = readdirSync3(dir);
@@ -17073,13 +16987,13 @@ function autocomplete(partial) {
17073
16987
  }
17074
16988
  const matches = entries.filter((e) => e.startsWith(base));
17075
16989
  if (matches.length === 0) return null;
17076
- if (matches.length === 1) return join24(dir, matches[0]);
16990
+ if (matches.length === 1) return join23(dir, matches[0]);
17077
16991
  let prefix = matches[0];
17078
16992
  for (const m of matches) {
17079
16993
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
17080
16994
  if (!prefix) break;
17081
16995
  }
17082
- return prefix.length > base.length ? join24(dir, prefix) : null;
16996
+ return prefix.length > base.length ? join23(dir, prefix) : null;
17083
16997
  }
17084
16998
  function PathPrompt({
17085
16999
  defaultPath,
@@ -17671,7 +17585,7 @@ var init_WelcomeStep = __esm({
17671
17585
  import { useState as useState14, useEffect as useEffect4 } from "react";
17672
17586
  import { Box as Box25, Text as Text26 } from "ink";
17673
17587
  import { promises as fs } from "node:fs";
17674
- import { join as join25 } from "node:path";
17588
+ import { join as join24 } from "node:path";
17675
17589
  import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
17676
17590
  async function countFiles(dir) {
17677
17591
  const counts = {
@@ -17695,7 +17609,7 @@ async function countFiles(dir) {
17695
17609
  await Promise.all(
17696
17610
  entries.map(async (entry) => {
17697
17611
  if (IGNORE_DIRS.has(entry)) return;
17698
- const full = join25(current, entry);
17612
+ const full = join24(current, entry);
17699
17613
  let stat8;
17700
17614
  try {
17701
17615
  stat8 = await fs.stat(full);
@@ -28024,11 +27938,11 @@ __export(WizardApp_exports, {
28024
27938
  });
28025
27939
  import { useEffect as useEffect13, useRef as useRef10, useState as useState33 } from "react";
28026
27940
  import { Box as Box57, Text as Text61, useStdout as useStdout7 } from "ink";
28027
- import { join as join26, resolve as resolve25 } from "node:path";
27941
+ import { join as join25, resolve as resolve25 } from "node:path";
28028
27942
  import { appendFileSync as appendFileSync2, writeFileSync } from "node:fs";
28029
27943
  import { access as access8, readFile as readFile23, stat as stat6 } from "node:fs/promises";
28030
27944
  import { tmpdir } from "node:os";
28031
- import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
27945
+ import { execFile as execFile4, spawn as spawn4 } from "node:child_process";
28032
27946
  import { mkdir as mkdir7 } from "node:fs/promises";
28033
27947
  import { buildManifest as buildManifest4 } from "@contentful/experience-design-system-types";
28034
27948
  import { jsx as jsx65, jsxs as jsxs58 } from "react/jsx-runtime";
@@ -28096,14 +28010,14 @@ function formatAcceptanceSummary(opts) {
28096
28010
  }
28097
28011
  function runCli2(args) {
28098
28012
  return new Promise((res) => {
28099
- execFile3(process.execPath, [findCliPath(), ...args], (error, stdout, stderr) => {
28013
+ execFile4("node", [findCliPath(), ...args], (error, stdout, stderr) => {
28100
28014
  res({ exitCode: error?.code ? Number(error.code) : 0, stdout, stderr });
28101
28015
  });
28102
28016
  });
28103
28017
  }
28104
28018
  function runSpawnedCli(args, onStderr) {
28105
28019
  return new Promise((res) => {
28106
- const child = spawn4(process.execPath, args);
28020
+ const child = spawn4("node", args);
28107
28021
  let stdout = "";
28108
28022
  let stderr = "";
28109
28023
  child.stdout.on("data", (d) => {
@@ -28202,8 +28116,8 @@ function WizardApp({
28202
28116
  const rawTokensEntryReady = !modifyEntryReady && !pushFromPickerReady && !!initialRawTokensPath;
28203
28117
  const effectiveNoCache = resolveNoCacheForGenerate({ cliNoCache: noCache });
28204
28118
  const initialStepResolved = modifyEntryReady ? "final-review" : pushFromPickerReady ? "push-from-picker" : rawTokensEntryReady ? "generating-tokens" : initialProjectPath ? "token-input" : "welcome";
28205
- const initialOutDir = initialProjectPath ? join26(resolve25(initialProjectPath), ".contentful") : "";
28206
- const initialTokensPath = (modifyEntryReady || pushFromPickerReady) && initialOutDir && seedTokenSessionId ? join26(initialOutDir, "tokens.json") : "";
28119
+ const initialOutDir = initialProjectPath ? join25(resolve25(initialProjectPath), ".contentful") : "";
28120
+ const initialTokensPath = (modifyEntryReady || pushFromPickerReady) && initialOutDir && seedTokenSessionId ? join25(initialOutDir, "tokens.json") : "";
28207
28121
  const [state, setState] = useState33({
28208
28122
  step: modifyEntryReady || rawTokensEntryReady || pushFromPickerReady ? initialStepResolved : initialRuns && initialRuns.length > 0 ? "run-picker" : initialStepResolved,
28209
28123
  agent: initialAgent ?? "claude",
@@ -28360,7 +28274,7 @@ If you are using AWS Bedrock, run:
28360
28274
  }
28361
28275
  const sessionMatch = /^session=(.+)$/m.exec(result.stdout);
28362
28276
  const tokenSessionId = sessionMatch ? sessionMatch[1].trim() : null;
28363
- const tokensPath = join26(outDir, "tokens.json");
28277
+ const tokensPath = join25(outDir, "tokens.json");
28364
28278
  const printArgs = ["print", "tokens", "--out", tokensPath];
28365
28279
  if (tokenSessionId) printArgs.push("--session", tokenSessionId);
28366
28280
  const r = await runCli2(printArgs);
@@ -28380,7 +28294,7 @@ If you are using AWS Bedrock, run:
28380
28294
  tokenCount,
28381
28295
  skipComponents: true,
28382
28296
  acceptedCount: 0,
28383
- outDir: state.outDir || join26(process.cwd(), ".contentful")
28297
+ outDir: state.outDir || join25(process.cwd(), ".contentful")
28384
28298
  });
28385
28299
  if (noPush) {
28386
28300
  void startSaveFlow();
@@ -28447,7 +28361,7 @@ If you are using AWS Bedrock, run:
28447
28361
  return true;
28448
28362
  };
28449
28363
  const runExtract = async (projectPath) => {
28450
- const outDir = join26(resolve25(projectPath), ".contentful");
28364
+ const outDir = join25(resolve25(projectPath), ".contentful");
28451
28365
  update({ step: "extracting", outDir, extractProgress: null, compositionPhase: null });
28452
28366
  const extractArgs = [findCliPath(), "analyze", "extract", "--project", projectPath];
28453
28367
  if (compositionMode === "composite") {
@@ -28546,7 +28460,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
28546
28460
  noCache,
28547
28461
  ...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {}
28548
28462
  });
28549
- const child = spawn4(process.execPath, [findCliPath(), ...args]);
28463
+ const child = spawn4("node", [findCliPath(), ...args]);
28550
28464
  autoFilterChildRef.current = child;
28551
28465
  let stderr = "";
28552
28466
  child.stderr.on("data", (d) => {
@@ -28647,7 +28561,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
28647
28561
  const args = buildGenerateArgs(extractSessionId, tokensPath);
28648
28562
  let progressCursor = null;
28649
28563
  const { child, donePromise } = spawnGenerateChild({
28650
- command: process.execPath,
28564
+ command: "node",
28651
28565
  args,
28652
28566
  onStderr: (chunk) => {
28653
28567
  const nextProgress = parseGenerateStderrChunk(chunk, progressCursor);
@@ -28702,7 +28616,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
28702
28616
  const args = buildGenerateArgs(extractSessionId, tokensPath, generatePromptPath);
28703
28617
  let progressCursor = state.generateProgress;
28704
28618
  const { donePromise } = spawnGenerateChild({
28705
- command: process.execPath,
28619
+ command: "node",
28706
28620
  args,
28707
28621
  onStderr: (chunk) => {
28708
28622
  const nextProgress = parseGenerateStderrChunk(chunk, progressCursor);
@@ -28804,7 +28718,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
28804
28718
  };
28805
28719
  const advanceAfterCredentialsValidated = async () => {
28806
28720
  if (!state.credentialsSkipped && state.spaceId && state.environmentId && state.cmaToken && state.projectPath) {
28807
- const outDir = join26(resolve25(state.projectPath), ".contentful");
28721
+ const outDir = join25(resolve25(state.projectPath), ".contentful");
28808
28722
  await mkdir7(outDir, { recursive: true });
28809
28723
  const result = await fetchAndPersistExistingContentfulEntities({
28810
28724
  spaceId: state.spaceId,
@@ -29176,7 +29090,7 @@ If using a custom --host, make sure the space exists on that host.`
29176
29090
  };
29177
29091
  const runPrintFiles = async (extractSessionId, outDir, opts = {}) => {
29178
29092
  update({ step: "printing" });
29179
- const componentsPath = join26(outDir, "components.json");
29093
+ const componentsPath = join25(outDir, "components.json");
29180
29094
  const printArgs = ["print", "components", "--out", componentsPath];
29181
29095
  if (extractSessionId) printArgs.push("--session", extractSessionId);
29182
29096
  if (opts.allowEmpty) printArgs.push("--allow-empty");
@@ -29192,7 +29106,7 @@ If using a custom --host, make sure the space exists on that host.`
29192
29106
  let emittedTokensPath;
29193
29107
  let emittedTokenCount;
29194
29108
  if (opts.tokenSessionId) {
29195
- const tokensOut = join26(outDir, "tokens.json");
29109
+ const tokensOut = join25(outDir, "tokens.json");
29196
29110
  const tokenArgs = ["print", "tokens", "--out", tokensOut, "--session", opts.tokenSessionId];
29197
29111
  const tr = await runCli2(tokenArgs);
29198
29112
  if (tr.exitCode !== 0) {
@@ -29279,7 +29193,7 @@ If using a custom --host, make sure the space exists on that host.`
29279
29193
  );
29280
29194
  }
29281
29195
  try {
29282
- const componentsBuf = await readFile23(join26(path, "components.json")).catch(() => null);
29196
+ const componentsBuf = await readFile23(join25(path, "components.json")).catch(() => null);
29283
29197
  const tokensBuf = recordedTokensPath ? await readFile23(recordedTokensPath).catch(() => null) : null;
29284
29198
  savedFingerprint = buildSavedFingerprint({
29285
29199
  componentsJson: componentsBuf,
@@ -29321,7 +29235,7 @@ If using a custom --host, make sure the space exists on that host.`
29321
29235
  if (state.step === "generating-tokens") {
29322
29236
  if (tokenReuseChecked.current) return;
29323
29237
  tokenReuseChecked.current = true;
29324
- const existingTokensPath = join26(state.outDir, "tokens.json");
29238
+ const existingTokensPath = join25(state.outDir, "tokens.json");
29325
29239
  (async () => {
29326
29240
  try {
29327
29241
  await access8(existingTokensPath);
@@ -29397,7 +29311,7 @@ If using a custom --host, make sure the space exists on that host.`
29397
29311
  {
29398
29312
  onContinue: (path) => {
29399
29313
  const projectPath = normalizePath(path);
29400
- const outDir = join26(projectPath, ".contentful");
29314
+ const outDir = join25(projectPath, ".contentful");
29401
29315
  update({ step: "token-input", projectPath, outDir });
29402
29316
  },
29403
29317
  onQuit: () => process.exit(0)
@@ -30021,7 +29935,7 @@ var init_WizardApp = __esm({
30021
29935
  init_wizard_state_transitions();
30022
29936
  init_cycle_auto_reject();
30023
29937
  init_cli_path();
30024
- WIZARD_LOG = join26(tmpdir(), "experiences-import-wizard.log");
29938
+ WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
30025
29939
  }
30026
29940
  });
30027
29941
 
@@ -30033,7 +29947,7 @@ __export(staleness_exports, {
30033
29947
  shortStalenessSummary: () => shortStalenessSummary
30034
29948
  });
30035
29949
  import { readFile as readFile24, stat as stat7 } from "node:fs/promises";
30036
- import { join as join27 } from "node:path";
29950
+ import { join as join26 } from "node:path";
30037
29951
  async function checkRunStaleness(run) {
30038
29952
  if (!run.sourceFingerprint) return { ...UNKNOWN };
30039
29953
  const result = {
@@ -30075,7 +29989,7 @@ async function checkRunStaleness(run) {
30075
29989
  }
30076
29990
  if (run.savedFingerprint) {
30077
29991
  if (run.savedFingerprint.componentsJsonHash !== null) {
30078
- const compPath = join27(run.savePath, "components.json");
29992
+ const compPath = join26(run.savePath, "components.json");
30079
29993
  try {
30080
29994
  const buf = await readFile24(compPath);
30081
29995
  if (sha256Hex(buf) !== run.savedFingerprint.componentsJsonHash) {
@@ -30088,7 +30002,7 @@ async function checkRunStaleness(run) {
30088
30002
  }
30089
30003
  }
30090
30004
  if (run.savedFingerprint.tokensJsonHash !== null) {
30091
- const tokensPath = run.tokensPath ?? join27(run.savePath, "tokens.json");
30005
+ const tokensPath = run.tokensPath ?? join26(run.savePath, "tokens.json");
30092
30006
  try {
30093
30007
  const buf = await readFile24(tokensPath);
30094
30008
  if (sha256Hex(buf) !== run.savedFingerprint.tokensJsonHash) {
@@ -30196,8 +30110,9 @@ var init_push_creds_prompt = __esm({
30196
30110
  });
30197
30111
 
30198
30112
  // packages/experience-design-system-cli/src/program.ts
30113
+ import { spawn as spawn6 } from "node:child_process";
30199
30114
  import { fileURLToPath as fileURLToPath5 } from "node:url";
30200
- import { dirname as dirname15, join as join30, resolve as resolve28 } from "node:path";
30115
+ import { dirname as dirname15, join as join29, resolve as resolve28 } from "node:path";
30201
30116
  import { readFileSync as readFileSync10 } from "node:fs";
30202
30117
  import { Command } from "commander";
30203
30118
 
@@ -30205,7 +30120,7 @@ import { Command } from "commander";
30205
30120
  import { createElement as createElement3 } from "react";
30206
30121
  import { render as render3 } from "ink";
30207
30122
  import { mkdir as mkdir3, readdir as readdir2, readFile as readFile16, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
30208
- import { isAbsolute as isAbsolute5, join as join17, relative as relative3, resolve as resolve16 } from "node:path";
30123
+ import { isAbsolute as isAbsolute4, join as join16, relative as relative3, resolve as resolve16 } from "node:path";
30209
30124
 
30210
30125
  // packages/experience-design-system-cli/src/lib/agent-model-options.ts
30211
30126
  init_src();
@@ -30553,7 +30468,7 @@ var OutputFormatter = class {
30553
30468
  // packages/experience-design-system-cli/src/analyze/select-agent/context-builder.ts
30554
30469
  init_src2();
30555
30470
  import { readFile as readFile13 } from "node:fs/promises";
30556
- import { dirname as dirname11, isAbsolute as isAbsolute3, join as join15, relative as relative2, resolve as resolve12, sep } from "node:path";
30471
+ import { dirname as dirname11, isAbsolute as isAbsolute2, join as join14, relative as relative2, resolve as resolve12, sep } from "node:path";
30557
30472
  var SCANNED_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".astro", ".js", ".jsx", ".svelte", ".ts", ".tsx", ".vue"]);
30558
30473
  var IMPORT_PATTERN2 = /import\s+(?:type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/g;
30559
30474
  var EXPORT_NAMED_PATTERN = /export\s+(?:const|function|class|type|interface|enum)\s+([A-Za-z0-9_]+)/g;
@@ -30571,7 +30486,7 @@ function truncateText(text, maxChars) {
30571
30486
  }
30572
30487
  function isWithinRoot(path, root) {
30573
30488
  const relativePath = relative2(root, path);
30574
- return relativePath !== ".." && !relativePath.startsWith(`..${sep}`) && !isAbsolute3(relativePath);
30489
+ return relativePath !== ".." && !relativePath.startsWith(`..${sep}`) && !isAbsolute2(relativePath);
30575
30490
  }
30576
30491
  function toPosixPath(path) {
30577
30492
  return sep === "/" ? path : path.split(sep).join("/");
@@ -30584,7 +30499,7 @@ function resolveLocalImportPath(source, componentDirectory, root, filePaths) {
30584
30499
  const candidates = [
30585
30500
  basePath,
30586
30501
  ...[...SCANNED_FILE_EXTENSIONS].map((extension) => `${basePath}${extension}`),
30587
- ...[...SCANNED_FILE_EXTENSIONS].map((extension) => join15(basePath, `index${extension}`))
30502
+ ...[...SCANNED_FILE_EXTENSIONS].map((extension) => join14(basePath, `index${extension}`))
30588
30503
  ];
30589
30504
  for (const candidate of candidates) {
30590
30505
  if (filePaths.has(candidate) && isWithinRoot(candidate, root)) {
@@ -30685,7 +30600,7 @@ async function buildRepoContextIndex(root, filePaths) {
30685
30600
  };
30686
30601
  }
30687
30602
  function buildSelectionContext(index, component) {
30688
- const absolutePath = isAbsolute3(component.source) ? component.source : resolve12(index.root, component.source);
30603
+ const absolutePath = isAbsolute2(component.source) ? component.source : resolve12(index.root, component.source);
30689
30604
  if (!isWithinRoot(absolutePath, index.root)) return void 0;
30690
30605
  const componentFile = index.files.find((file) => file.absolutePath === absolutePath);
30691
30606
  if (!componentFile) return void 0;
@@ -30796,7 +30711,7 @@ function runShowRationale(opts) {
30796
30711
 
30797
30712
  // packages/experience-design-system-cli/src/analyze/select-agent/command.ts
30798
30713
  init_debug_logger();
30799
- import { isAbsolute as isAbsolute4, resolve as resolve13 } from "node:path";
30714
+ import { isAbsolute as isAbsolute3, resolve as resolve13 } from "node:path";
30800
30715
 
30801
30716
  // packages/experience-design-system-cli/src/lib/agent-output.ts
30802
30717
  async function invokeAgentWithOutput(invoker3, options, verbose) {
@@ -31181,7 +31096,7 @@ function registerAnalyzeSelectAgentCommand(program) {
31181
31096
  process.stderr.write(c.yellow(formatExclusionWarning(invalidComponents)));
31182
31097
  }
31183
31098
  if (selectionRoot && scannedFiles.length > 0) {
31184
- scannedFiles = scannedFiles.map((f) => isAbsolute4(f) ? f : resolve13(selectionRoot, f));
31099
+ scannedFiles = scannedFiles.map((f) => isAbsolute3(f) ? f : resolve13(selectionRoot, f));
31185
31100
  }
31186
31101
  if (selectionRoot && scannedFiles.length === 0 && rawComponents.length > 0) {
31187
31102
  process.stderr.write(
@@ -31534,14 +31449,14 @@ function applyMapping(components, edges) {
31534
31449
 
31535
31450
  // packages/experience-design-system-cli/src/analyze/composition/agent-parser/load-prompt.ts
31536
31451
  import { existsSync as existsSync7, readFileSync as readFileSync8 } from "node:fs";
31537
- import { dirname as dirname12, join as join16, resolve as resolve14 } from "node:path";
31452
+ import { dirname as dirname12, join as join15, resolve as resolve14 } from "node:path";
31538
31453
  import { fileURLToPath as fileURLToPath3 } from "node:url";
31539
31454
  function resolvePromptPath(fileName) {
31540
31455
  const thisDir = dirname12(fileURLToPath3(import.meta.url));
31541
31456
  let dir = thisDir;
31542
31457
  for (; ; ) {
31543
- const candidate = join16(dir, "prompts");
31544
- if (existsSync7(candidate)) return join16(candidate, fileName);
31458
+ const candidate = join15(dir, "prompts");
31459
+ if (existsSync7(candidate)) return join15(candidate, fileName);
31545
31460
  const parent = resolve14(dir, "..");
31546
31461
  if (parent === dir) {
31547
31462
  throw new Error(
@@ -32262,7 +32177,7 @@ function pluralize(count, singular, plural = `${singular}s`) {
32262
32177
  return `${count} ${count === 1 ? singular : plural}`;
32263
32178
  }
32264
32179
  function resolveFromProjectRoot(projectRoot, inputPath) {
32265
- return isAbsolute5(inputPath) ? inputPath : resolve16(projectRoot, inputPath);
32180
+ return isAbsolute4(inputPath) ? inputPath : resolve16(projectRoot, inputPath);
32266
32181
  }
32267
32182
  function wrapperConfidenceToIssueCount(confidence) {
32268
32183
  if (confidence >= 4) return 2;
@@ -32278,7 +32193,7 @@ async function collectSourceFiles(directory, onProgress) {
32278
32193
  const entries = await readdir2(currentDirectory, { withFileTypes: true });
32279
32194
  const subdirs = [];
32280
32195
  for (const entry of entries) {
32281
- const fullPath = join17(currentDirectory, entry.name);
32196
+ const fullPath = join16(currentDirectory, entry.name);
32282
32197
  if (entry.isDirectory()) {
32283
32198
  if (!IGNORED_DIRECTORY_NAMES.has(entry.name)) {
32284
32199
  subdirs.push(fullPath);
@@ -32392,7 +32307,7 @@ function registerAnalyzeCommand(program) {
32392
32307
  }
32393
32308
  }
32394
32309
  const projectRoot = resolve16(opts.project);
32395
- const outDir = join17(projectRoot, ".contentful");
32310
+ const outDir = join16(projectRoot, ".contentful");
32396
32311
  let sourceDirectory;
32397
32312
  if (opts.dir !== void 0) {
32398
32313
  sourceDirectory = resolveFromProjectRoot(projectRoot, opts.dir);
@@ -32745,7 +32660,7 @@ init_src();
32745
32660
  import { createElement as createElement4 } from "react";
32746
32661
  import { render as render4 } from "ink";
32747
32662
  import { readFile as readFile18, readdir as readdir3, stat as stat3 } from "node:fs/promises";
32748
- import { basename as basename5, join as join18, resolve as resolve18 } from "node:path";
32663
+ import { join as join17, resolve as resolve18 } from "node:path";
32749
32664
  init_debug_logger();
32750
32665
 
32751
32666
  // packages/experience-design-system-cli/src/generate/tui/GenerateView.tsx
@@ -32885,8 +32800,10 @@ init_credentials_store();
32885
32800
  init_analytics();
32886
32801
 
32887
32802
  // packages/experience-design-system-cli/src/lib/cli-errors.ts
32888
- init_src();
32889
32803
  init_analytics();
32804
+ import { execFile } from "node:child_process";
32805
+ import { promisify } from "node:util";
32806
+ var execFileAsync = promisify(execFile);
32890
32807
  function die2(message) {
32891
32808
  process.stderr.write(`${message}
32892
32809
  `);
@@ -32894,18 +32811,12 @@ function die2(message) {
32894
32811
  throw new Error("exit");
32895
32812
  }
32896
32813
  async function assertBinaryInPath(binary) {
32897
- return binaryExists(binary);
32898
- }
32899
- function assertAgentCanReceivePrompt(agent) {
32900
- if (process.platform !== "win32" || agentSupportsStdinPrompt(agent)) return;
32901
- die2(
32902
- `Error: --agent ${agent} does not work on Windows.
32903
- Its CLI only accepts the prompt as a command-line argument, and Windows limits a command
32904
- line to 8191 characters \u2014 shorter than the prompts this command sends.
32905
-
32906
- Every other agent reads the prompt from standard input, so they are unaffected.
32907
- Use --agent claude, codex, opencode, or cursor.`
32908
- );
32814
+ try {
32815
+ await execFileAsync("which", [binary]);
32816
+ return true;
32817
+ } catch {
32818
+ return false;
32819
+ }
32909
32820
  }
32910
32821
 
32911
32822
  // packages/experience-design-system-cli/src/generate/command.ts
@@ -32938,7 +32849,7 @@ async function readFileInline(path) {
32938
32849
  return;
32939
32850
  }
32940
32851
  for (const entry of entries.sort()) {
32941
- const full = join18(dir, entry);
32852
+ const full = join17(dir, entry);
32942
32853
  let es;
32943
32854
  try {
32944
32855
  es = await stat3(full);
@@ -33290,7 +33201,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
33290
33201
  mode: "autonomous",
33291
33202
  rawComponentsInline: sampleInline ?? rawTokensInline,
33292
33203
  rawTokensInline: skill === "tokens" ? rawTokensInline : void 0,
33293
- rawTokensFilename: opts.rawTokens ? basename5(resolve18(opts.rawTokens)) : void 0,
33204
+ rawTokensFilename: opts.rawTokens ? resolve18(opts.rawTokens).split("/").pop() : void 0,
33294
33205
  tokensInline,
33295
33206
  tokenMapInline,
33296
33207
  outDir: process.cwd(),
@@ -33311,7 +33222,6 @@ async function runGenerateSkill(skill, opts, verbose = false) {
33311
33222
  });
33312
33223
  await exitWithAnalytics(1);
33313
33224
  }
33314
- assertAgentCanReceivePrompt(agent);
33315
33225
  if (skill === "components" && allComponents && sessionId2) {
33316
33226
  const db = openPipelineDb();
33317
33227
  let componentResults;
@@ -33434,7 +33344,7 @@ session=${sessionId2 ?? ""}
33434
33344
  skill,
33435
33345
  mode: "autonomous",
33436
33346
  rawTokensInline,
33437
- rawTokensFilename: opts.rawTokens ? basename5(resolve18(opts.rawTokens)) : void 0,
33347
+ rawTokensFilename: opts.rawTokens ? resolve18(opts.rawTokens).split("/").pop() : void 0,
33438
33348
  tokensInline,
33439
33349
  tokenMapInline,
33440
33350
  outDir: process.cwd()
@@ -33626,7 +33536,7 @@ init_session_id();
33626
33536
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
33627
33537
  import { readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync, statSync as statSync4 } from "node:fs";
33628
33538
  import { existsSync as existsSync8 } from "node:fs";
33629
- import { join as join19, resolve as resolve19 } from "node:path";
33539
+ import { join as join18, resolve as resolve19 } from "node:path";
33630
33540
  import { homedir as homedir5 } from "node:os";
33631
33541
  var MIGRATION_NAME = "v1_import_and_reviews";
33632
33542
  function getReviewsDir() {
@@ -33670,13 +33580,13 @@ function migrateReviewSessions(db, _now) {
33670
33580
  }
33671
33581
  for (const entry of entries) {
33672
33582
  if (entry.endsWith(".migrated")) continue;
33673
- const sessionDir = join19(reviewsDir, entry);
33583
+ const sessionDir = join18(reviewsDir, entry);
33674
33584
  try {
33675
33585
  if (!statSync4(sessionDir).isDirectory()) continue;
33676
33586
  } catch {
33677
33587
  continue;
33678
33588
  }
33679
- const stateFile = join19(sessionDir, "current-review-state.json");
33589
+ const stateFile = join18(sessionDir, "current-review-state.json");
33680
33590
  let snapshot;
33681
33591
  try {
33682
33592
  snapshot = JSON.parse(readFileSync9(stateFile, "utf8"));
@@ -33998,7 +33908,7 @@ init_db();
33998
33908
  import { createElement as createElement5 } from "react";
33999
33909
  import { render as render5 } from "ink";
34000
33910
  import { access as access6, mkdir as mkdir4, stat as stat4, writeFile as writeFile4 } from "node:fs/promises";
34001
- import { basename as basename6, resolve as resolve20 } from "node:path";
33911
+ import { basename as basename5, resolve as resolve20 } from "node:path";
34002
33912
 
34003
33913
  // packages/experience-design-system-cli/src/print/validate/validators/cdf-validator.ts
34004
33914
  import { validateCDF as validateCDF2 } from "@contentful/experience-design-system-types";
@@ -34375,7 +34285,7 @@ function registerPrintCommand(program) {
34375
34285
  await writeFile4(outPath, `${JSON.stringify(cdfObj, null, 2)}
34376
34286
  `);
34377
34287
  process.stdout.write(
34378
- `wrote ${basename6(outPath)} (${components.length} component${components.length === 1 ? "" : "s"})
34288
+ `wrote ${basename5(outPath)} (${components.length} component${components.length === 1 ? "" : "s"})
34379
34289
  `
34380
34290
  );
34381
34291
  });
@@ -34399,7 +34309,7 @@ function registerPrintCommand(program) {
34399
34309
  await writeFile4(outPath, `${JSON.stringify(tree, null, 2)}
34400
34310
  `);
34401
34311
  process.stdout.write(
34402
- `wrote ${basename6(outPath)} (${result.tokens.length} token${result.tokens.length === 1 ? "" : "s"})
34312
+ `wrote ${basename5(outPath)} (${result.tokens.length} token${result.tokens.length === 1 ? "" : "s"})
34403
34313
  `
34404
34314
  );
34405
34315
  });
@@ -34841,7 +34751,6 @@ Install it, choose another agent with --agent, or use --print-prompt to run the
34841
34751
  ${resolveSkillPath("map-tokens")}`
34842
34752
  );
34843
34753
  }
34844
- assertAgentCanReceivePrompt(agent);
34845
34754
  const stepId = createStep(db, sessionId2, "map tokens", { agent, model: model ?? "" });
34846
34755
  const prompt2 = await buildPrompt({
34847
34756
  skill: "map-tokens",
@@ -34889,7 +34798,7 @@ function registerMapTokensCommand(program) {
34889
34798
  // packages/experience-design-system-cli/src/import/command.ts
34890
34799
  init_src();
34891
34800
  init_path_utils();
34892
- import { resolve as resolve27, join as join28 } from "node:path";
34801
+ import { resolve as resolve27, join as join27 } from "node:path";
34893
34802
 
34894
34803
  // packages/experience-design-system-cli/src/import/orchestrator.ts
34895
34804
  init_db();
@@ -34901,8 +34810,8 @@ init_contentful_urls();
34901
34810
  init_debug_logger();
34902
34811
  init_analytics();
34903
34812
  import { mkdir as mkdir5 } from "node:fs/promises";
34904
- import { join as join21, resolve as resolve23 } from "node:path";
34905
- import { execFile } from "node:child_process";
34813
+ import { join as join20, resolve as resolve23 } from "node:path";
34814
+ import { execFile as execFile2 } from "node:child_process";
34906
34815
 
34907
34816
  // packages/experience-design-system-cli/src/analytics/env.ts
34908
34817
  init_debug_logger();
@@ -34925,7 +34834,7 @@ async function runStep(args, cliPath, analyticsSessionId, env = {}, streamStderr
34925
34834
  const startedAt = Date.now();
34926
34835
  debug.event("import", "subprocess.spawn", { cliPath, args });
34927
34836
  return new Promise((res) => {
34928
- const child = execFile(process.execPath, [cliPath, ...args], {
34837
+ const child = execFile2("node", [cliPath, ...args], {
34929
34838
  env: pipelineSubprocessEnv({ ...process.env, ...env }, analyticsSessionId)
34930
34839
  });
34931
34840
  let stdout = "";
@@ -35006,7 +34915,7 @@ function buildPushStepResult(args) {
35006
34915
  async function runPipeline(opts, progressWriter, cliPathOverride) {
35007
34916
  const projectRoot = resolve23(opts.project);
35008
34917
  const outDir = resolve23(opts.out);
35009
- const componentsPath = join21(outDir, "components.json");
34918
+ const componentsPath = join20(outDir, "components.json");
35010
34919
  const cliPath = cliPathOverride ?? findCliPath();
35011
34920
  const db = openPipelineDb();
35012
34921
  const { sessionId: sessionId2 } = getOrCreateSession(db, void 0, void 0, {
@@ -35628,7 +35537,7 @@ import { resolve as resolve26 } from "node:path";
35628
35537
 
35629
35538
  // packages/experience-design-system-cli/src/runs/push-helpers.ts
35630
35539
  init_cli_path();
35631
- import { execFile as execFile2 } from "node:child_process";
35540
+ import { execFile as execFile3 } from "node:child_process";
35632
35541
  import { existsSync as existsSync9 } from "node:fs";
35633
35542
  function runCli(args) {
35634
35543
  const cliPath = findCliPath();
@@ -35640,7 +35549,7 @@ function runCli(args) {
35640
35549
  });
35641
35550
  }
35642
35551
  return new Promise((res) => {
35643
- execFile2(process.execPath, [cliPath, ...args], (err, stdout, stderr) => {
35552
+ execFile3("node", [cliPath, ...args], (err, stdout, stderr) => {
35644
35553
  res({
35645
35554
  exitCode: err && "code" in err && typeof err.code === "number" ? err.code : err ? 1 : 0,
35646
35555
  stdout,
@@ -36334,7 +36243,7 @@ function registerImportCommand(program) {
36334
36243
  return;
36335
36244
  }
36336
36245
  const projectRoot = normalizePath(opts.project);
36337
- const outDir = opts.out ? resolve27(opts.out) : join28(projectRoot, ".contentful");
36246
+ const outDir = opts.out ? resolve27(opts.out) : join27(projectRoot, ".contentful");
36338
36247
  const headlessCreds = await readExperiencesCredentials();
36339
36248
  const headlessAgent = resolveAgent(opts.agent, headlessCreds.agent);
36340
36249
  const headlessModel = resolveModel(opts.model, headlessCreds.agentModel);
@@ -36390,11 +36299,13 @@ function registerImportCommand(program) {
36390
36299
 
36391
36300
  // packages/experience-design-system-cli/src/setup/command.ts
36392
36301
  init_credentials_store();
36302
+ import { execFile as execFile5, spawn as spawn5 } from "node:child_process";
36393
36303
  import { appendFile as appendFile2, readFile as readFile26, access as access9 } from "node:fs/promises";
36394
- import { join as join29 } from "node:path";
36304
+ import { join as join28 } from "node:path";
36395
36305
  import { homedir as homedir9 } from "node:os";
36396
36306
  import { fileURLToPath as fileURLToPath4 } from "node:url";
36397
36307
  import { createInterface } from "node:readline";
36308
+ import { promisify as promisify2 } from "node:util";
36398
36309
 
36399
36310
  // packages/experience-design-system-cli/src/setup/prompt-helpers.ts
36400
36311
  async function promptBooleanPreference(ask, current, defaultValue, question) {
@@ -36425,7 +36336,7 @@ async function promptAnalyticsPreference(ask, current) {
36425
36336
  // packages/experience-design-system-cli/src/setup/command.ts
36426
36337
  init_host_utils();
36427
36338
  init_cli_path();
36428
- init_src();
36339
+ var execFileAsync2 = promisify2(execFile5);
36429
36340
  var REQUIRED_NODE_MAJOR = 24;
36430
36341
  function ok(msg) {
36431
36342
  process.stdout.write(` \x1B[32m\u2713\x1B[0m ${msg}
@@ -36512,12 +36423,17 @@ async function confirm(question, defaultYes = true) {
36512
36423
  if (!answer) return defaultYes;
36513
36424
  return answer.toLowerCase().startsWith("y");
36514
36425
  }
36515
- async function binaryExists2(name) {
36516
- return findBinary(name) !== null;
36426
+ async function binaryExists(name) {
36427
+ try {
36428
+ await execFileAsync2("which", [name]);
36429
+ return true;
36430
+ } catch {
36431
+ return false;
36432
+ }
36517
36433
  }
36518
36434
  function runSpawn(cmd, args, opts = {}) {
36519
36435
  return new Promise((resolve29) => {
36520
- const child = spawnBinary(cmd, args, {
36436
+ const child = spawn5(cmd, args, {
36521
36437
  cwd: opts.cwd,
36522
36438
  env: opts.env ?? process.env,
36523
36439
  stdio: ["ignore", "pipe", "pipe"]
@@ -36531,10 +36447,10 @@ function runSpawn(cmd, args, opts = {}) {
36531
36447
  resolve29({ exitCode: 1, stdout: "", stderr: err.message });
36532
36448
  }
36533
36449
  });
36534
- child.stdout?.on("data", (d) => {
36450
+ child.stdout.on("data", (d) => {
36535
36451
  stdout += String(d);
36536
36452
  });
36537
- child.stderr?.on("data", (d) => {
36453
+ child.stderr.on("data", (d) => {
36538
36454
  stderr += String(d);
36539
36455
  });
36540
36456
  child.on("exit", (code) => {
@@ -36549,17 +36465,17 @@ async function detectShellProfile() {
36549
36465
  const shell = process.env["SHELL"] ?? "";
36550
36466
  const home = homedir9();
36551
36467
  if (shell.includes("zsh")) {
36552
- return join29(home, ".zshrc");
36468
+ return join28(home, ".zshrc");
36553
36469
  }
36554
36470
  if (shell.includes("bash")) {
36555
- const bashProfile = join29(home, ".bash_profile");
36471
+ const bashProfile = join28(home, ".bash_profile");
36556
36472
  const exists = await access9(bashProfile).then(() => true).catch(() => false);
36557
- return exists ? bashProfile : join29(home, ".bashrc");
36473
+ return exists ? bashProfile : join28(home, ".bashrc");
36558
36474
  }
36559
36475
  if (shell.includes("fish")) {
36560
- return join29(home, ".config", "fish", "config.fish");
36476
+ return join28(home, ".config", "fish", "config.fish");
36561
36477
  }
36562
- return join29(home, ".profile");
36478
+ return join28(home, ".profile");
36563
36479
  }
36564
36480
  async function profileContains(profilePath, str) {
36565
36481
  try {
@@ -36584,8 +36500,8 @@ async function setupNode() {
36584
36500
  }
36585
36501
  fail(`Node.js v${current} \u2014 need v${REQUIRED_NODE_MAJOR}+`);
36586
36502
  info("");
36587
- const hasNvm = await binaryExists2("nvm") || await access9(join29(homedir9(), ".nvm", "nvm.sh")).then(() => true).catch(() => false);
36588
- const hasFnm = await binaryExists2("fnm");
36503
+ const hasNvm = await binaryExists("nvm") || await access9(join28(homedir9(), ".nvm", "nvm.sh")).then(() => true).catch(() => false);
36504
+ const hasFnm = await binaryExists("fnm");
36589
36505
  if (hasNvm) {
36590
36506
  info(`nvm detected. Will run: nvm install ${REQUIRED_NODE_MAJOR} && nvm use ${REQUIRED_NODE_MAJOR}`);
36591
36507
  const go = await confirm(`Install and switch to Node ${REQUIRED_NODE_MAJOR} via nvm?`);
@@ -36593,7 +36509,7 @@ async function setupNode() {
36593
36509
  warn(`Skipped. Re-run experiences setup after switching to Node ${REQUIRED_NODE_MAJOR}.`);
36594
36510
  return false;
36595
36511
  }
36596
- const nvmScript = join29(homedir9(), ".nvm", "nvm.sh");
36512
+ const nvmScript = join28(homedir9(), ".nvm", "nvm.sh");
36597
36513
  const result = await runSpawn("bash", [
36598
36514
  "-c",
36599
36515
  `source "${nvmScript}" && nvm install ${REQUIRED_NODE_MAJOR} && nvm alias default ${REQUIRED_NODE_MAJOR}`
@@ -36655,14 +36571,14 @@ async function setupNode() {
36655
36571
  }
36656
36572
  async function setupPnpm() {
36657
36573
  section("Step 2: pnpm", "[required]");
36658
- if (await binaryExists2("pnpm")) {
36574
+ if (await binaryExists("pnpm")) {
36659
36575
  const v = await runSpawn("pnpm", ["--version"]);
36660
36576
  ok(`pnpm v${v.stdout.trim()} \u2014 already installed`);
36661
36577
  return true;
36662
36578
  }
36663
36579
  fail("pnpm not found");
36664
36580
  info("");
36665
- const hasCorecpack = await binaryExists2("corepack");
36581
+ const hasCorecpack = await binaryExists("corepack");
36666
36582
  if (hasCorecpack) {
36667
36583
  info("Will run: corepack enable && corepack prepare pnpm@latest --activate");
36668
36584
  const go2 = await confirm("Install pnpm via corepack?");
@@ -36750,8 +36666,7 @@ async function setupAgent() {
36750
36666
  section("Step 4: Coding agent (claude, codex, opencode, or copilot)", "[required]");
36751
36667
  info("experiences import uses a coding agent to generate component definitions.");
36752
36668
  info("");
36753
- const candidates = AGENT_DEFS.filter((a) => agentSupportsStdinPrompt(a.binary) || process.platform !== "win32");
36754
- const found = (await Promise.all(candidates.map(async (a) => await binaryExists2(a.binary) ? a : null))).filter(
36669
+ const found = (await Promise.all(AGENT_DEFS.map(async (a) => await binaryExists(a.binary) ? a : null))).filter(
36755
36670
  (a) => a !== null
36756
36671
  );
36757
36672
  if (found.length === 1) {
@@ -36793,7 +36708,7 @@ async function setupAgent() {
36793
36708
  info(r.stderr.trim().split("\n").slice(0, 5).join("\n"));
36794
36709
  return { agent: void 0, agentModel: void 0 };
36795
36710
  }
36796
- if (!await binaryExists2("claude")) {
36711
+ if (!await binaryExists("claude")) {
36797
36712
  fail("claude binary not found on PATH after install \u2014 check your npm global bin directory");
36798
36713
  return { agent: void 0, agentModel: void 0 };
36799
36714
  }
@@ -36809,7 +36724,7 @@ async function setupAgent() {
36809
36724
  fail("Install failed");
36810
36725
  return { agent: void 0, agentModel: void 0 };
36811
36726
  }
36812
- if (!await binaryExists2("codex")) {
36727
+ if (!await binaryExists("codex")) {
36813
36728
  fail("codex binary not found on PATH after install \u2014 check your npm global bin directory");
36814
36729
  return { agent: void 0, agentModel: void 0 };
36815
36730
  }
@@ -36823,7 +36738,7 @@ async function setupAgent() {
36823
36738
  fail("Install failed");
36824
36739
  return { agent: void 0, agentModel: void 0 };
36825
36740
  }
36826
- if (!await binaryExists2("opencode")) {
36741
+ if (!await binaryExists("opencode")) {
36827
36742
  fail("opencode binary not found on PATH after install \u2014 check your npm global bin directory");
36828
36743
  return { agent: void 0, agentModel: void 0 };
36829
36744
  }
@@ -37018,11 +36933,11 @@ async function checkNode() {
37018
36933
  fail(`Node.js v${current} \u2014 need v${REQUIRED_NODE_MAJOR}+`);
37019
36934
  info("");
37020
36935
  info("How to fix:");
37021
- if (await binaryExists2("nvm")) {
36936
+ if (await binaryExists("nvm")) {
37022
36937
  info(` nvm install ${REQUIRED_NODE_MAJOR}`);
37023
36938
  info(` nvm use ${REQUIRED_NODE_MAJOR}`);
37024
36939
  info(` nvm alias default ${REQUIRED_NODE_MAJOR} # make it permanent`);
37025
- } else if (await binaryExists2("fnm")) {
36940
+ } else if (await binaryExists("fnm")) {
37026
36941
  info(` fnm install ${REQUIRED_NODE_MAJOR}`);
37027
36942
  info(` fnm use ${REQUIRED_NODE_MAJOR}`);
37028
36943
  } else {
@@ -37035,7 +36950,7 @@ async function checkNode() {
37035
36950
  }
37036
36951
  async function checkPnpm(pkgRoot) {
37037
36952
  section("Checking pnpm");
37038
- if (!await binaryExists2("pnpm")) {
36953
+ if (!await binaryExists("pnpm")) {
37039
36954
  fail("pnpm not found");
37040
36955
  info("How to fix:");
37041
36956
  info(" npm install -g pnpm");
@@ -37061,13 +36976,13 @@ async function checkPnpm(pkgRoot) {
37061
36976
  }
37062
36977
  async function checkDependencies(pkgRoot) {
37063
36978
  section("Checking dependencies (pnpm install)");
37064
- const nodeModulesExists = await access9(join29(pkgRoot, "node_modules")).then(() => true).catch(() => false);
36979
+ const nodeModulesExists = await access9(join28(pkgRoot, "node_modules")).then(() => true).catch(() => false);
37065
36980
  if (!nodeModulesExists) {
37066
36981
  info("node_modules not found \u2014 running pnpm install...");
37067
36982
  } else {
37068
36983
  info("Running pnpm install to ensure dependencies are up to date...");
37069
36984
  }
37070
- const repoRoot = join29(pkgRoot, "..", "..");
36985
+ const repoRoot = join28(pkgRoot, "..", "..");
37071
36986
  const result = await runSpawn("pnpm", ["install", "--frozen-lockfile"], { cwd: repoRoot });
37072
36987
  if (result.exitCode !== 0) {
37073
36988
  fail("pnpm install failed");
@@ -37086,7 +37001,7 @@ async function checkDependencies(pkgRoot) {
37086
37001
  async function checkBuild(pkgRoot) {
37087
37002
  section("Building CLI");
37088
37003
  info("Running pnpm build...");
37089
- const repoRoot = join29(pkgRoot, "..", "..");
37004
+ const repoRoot = join28(pkgRoot, "..", "..");
37090
37005
  const result = await runSpawn("pnpm", ["--filter", "@contentful/experience-design-system-cli", "run", "build"], {
37091
37006
  cwd: repoRoot
37092
37007
  });
@@ -37106,12 +37021,12 @@ async function checkBuild(pkgRoot) {
37106
37021
  }
37107
37022
  async function checkAgent() {
37108
37023
  section("Checking coding agent");
37109
- const agents = AGENT_DEFS.filter((a) => agentSupportsStdinPrompt(a.binary) || process.platform !== "win32");
37024
+ const agents = AGENT_DEFS;
37110
37025
  const creds = await readExperiencesCredentials();
37111
37026
  const savedAgent = creds.agent;
37112
37027
  const savedModel = creds.agentModel;
37113
37028
  if (savedAgent) {
37114
- const found = await binaryExists2(savedAgent);
37029
+ const found = await binaryExists(savedAgent);
37115
37030
  if (found) {
37116
37031
  const modelStr = savedModel ? ` \u2014 model: ${savedModel}` : "";
37117
37032
  ok(`${savedAgent}${modelStr} (saved preference)`);
@@ -37123,7 +37038,7 @@ async function checkAgent() {
37123
37038
  }
37124
37039
  }
37125
37040
  for (const agent of agents) {
37126
- if (await binaryExists2(agent.binary)) {
37041
+ if (await binaryExists(agent.binary)) {
37127
37042
  ok(`${agent.name} (${agent.binary}) found`);
37128
37043
  info("Tip: run experiences setup to save a default agent and model.");
37129
37044
  return true;
@@ -37202,7 +37117,7 @@ function registerSetupCommand(program) {
37202
37117
  process.stdout.write("\n\x1B[1mexperiences setup\x1B[0m \u2014 interactive setup wizard\n");
37203
37118
  process.stdout.write("Sets up everything you need to run \x1B[1mexperiences import\x1B[0m.\n");
37204
37119
  const pkgRoot = findPkgRoot();
37205
- const repoRoot = join29(pkgRoot, "..", "..");
37120
+ const repoRoot = join28(pkgRoot, "..", "..");
37206
37121
  const profilePath = await detectShellProfile();
37207
37122
  const results = [];
37208
37123
  const nodeOk = await setupNode();
@@ -37442,8 +37357,7 @@ async function beginCommand(command, opts) {
37442
37357
  init_analytics();
37443
37358
  init_credentials_store();
37444
37359
  init_cli_path();
37445
- init_src();
37446
- var pkg3 = JSON.parse(readFileSync10(join30(findPkgRoot(), "package.json"), "utf8"));
37360
+ var pkg3 = JSON.parse(readFileSync10(join29(findPkgRoot(), "package.json"), "utf8"));
37447
37361
  async function runBuild(opts) {
37448
37362
  return new Promise((resolvePromise) => {
37449
37363
  const child = opts.spawnFn();
@@ -37483,8 +37397,7 @@ function registerBuildCommand(program) {
37483
37397
  const pkgRoot = resolve28(dirname15(fileURLToPath5(import.meta.url)), "..", "..");
37484
37398
  process.stderr.write("\u2699 Building from source...\n");
37485
37399
  const { exitCode } = await runBuild({
37486
- // spawnBinary: pnpm is a `.cmd` shim on Windows.
37487
- spawnFn: () => spawnBinary("pnpm", ["build"], { cwd: pkgRoot, stdio: "inherit" }),
37400
+ spawnFn: () => spawn6("pnpm", ["build"], { cwd: pkgRoot, stdio: "inherit" }),
37488
37401
  stderrWrite: (s) => process.stderr.write(s)
37489
37402
  });
37490
37403
  process.exit(exitCode);