@contentful/experience-design-system-cli 2.34.1-dev-build-928f202.0 → 2.34.1-dev-build-1576344.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.34.1-dev-build-928f202.0",
3
+ "version": "2.34.1-dev-build-1576344.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/dist/src/index.js CHANGED
@@ -22,6 +22,7 @@ var init_agent_names = __esm({
22
22
  });
23
23
 
24
24
  // packages/experience-design-system-generation/dist/src/lib/binary-launch.js
25
+ import { spawn } from "node:child_process";
25
26
  import { accessSync, constants } from "node:fs";
26
27
  import { delimiter, isAbsolute, join } from "node:path";
27
28
  function executableExtensions(platform) {
@@ -78,6 +79,13 @@ function resolveSpawn(binary, args, platform = process.platform) {
78
79
  return null;
79
80
  return spawnSpec(resolved, args, platform);
80
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
+ }
81
89
  var init_binary_launch = __esm({
82
90
  "packages/experience-design-system-generation/dist/src/lib/binary-launch.js"() {
83
91
  "use strict";
@@ -85,7 +93,6 @@ var init_binary_launch = __esm({
85
93
  });
86
94
 
87
95
  // packages/experience-design-system-generation/dist/src/agent-runner.js
88
- import { spawn } from "node:child_process";
89
96
  function findJsonObjectEnd(line) {
90
97
  let depth = 0;
91
98
  let inString = false;
@@ -412,10 +419,8 @@ async function runAgent(options) {
412
419
  });
413
420
  return new Promise((resolve29) => {
414
421
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
415
- const launch = resolveSpawn(binary, args) ?? { command: binary, args };
416
- const child = spawn(launch.command, launch.args, {
422
+ const child = spawnBinary(binary, args, {
417
423
  stdio: ["pipe", "pipe", "pipe"],
418
- ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {},
419
424
  ...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
420
425
  });
421
426
  if (useStdin2 && child.stdin) {
@@ -473,10 +478,8 @@ async function checkAgentAuth(agent) {
473
478
  if (agent !== "claude")
474
479
  return "ok";
475
480
  return new Promise((resolve29) => {
476
- const launch = spawnSpec(resolvedBinary, ["auth", "status", "--json"]);
477
- const child = spawn(launch.command, launch.args, {
478
- stdio: ["ignore", "pipe", "pipe"],
479
- ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
481
+ const child = spawnBinary(resolvedBinary, ["auth", "status", "--json"], {
482
+ stdio: ["ignore", "pipe", "pipe"]
480
483
  });
481
484
  let stdout = "";
482
485
  let done = false;
@@ -986,10 +989,9 @@ __export(src_exports, {
986
989
  resolveAgentModel: () => resolveAgentModel,
987
990
  resolveBinary: () => resolveBinary,
988
991
  resolveSkillPath: () => resolveSkillPath,
989
- resolveSpawn: () => resolveSpawn,
990
992
  runAgent: () => runAgent,
991
993
  shouldUseStdinPrompt: () => shouldUseStdinPrompt,
992
- spawnSpec: () => spawnSpec
994
+ spawnBinary: () => spawnBinary
993
995
  });
994
996
  var init_src = __esm({
995
997
  "packages/experience-design-system-generation/dist/src/index.js"() {
@@ -30194,7 +30196,6 @@ var init_push_creds_prompt = __esm({
30194
30196
  });
30195
30197
 
30196
30198
  // packages/experience-design-system-cli/src/program.ts
30197
- import { spawn as spawn6 } from "node:child_process";
30198
30199
  import { fileURLToPath as fileURLToPath5 } from "node:url";
30199
30200
  import { dirname as dirname15, join as join30, resolve as resolve28 } from "node:path";
30200
30201
  import { readFileSync as readFileSync10 } from "node:fs";
@@ -32895,6 +32896,17 @@ function die2(message) {
32895
32896
  async function assertBinaryInPath(binary) {
32896
32897
  return binaryExists(binary);
32897
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
+ );
32909
+ }
32898
32910
 
32899
32911
  // packages/experience-design-system-cli/src/generate/command.ts
32900
32912
  init_path_exists();
@@ -33299,14 +33311,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
33299
33311
  });
33300
33312
  await exitWithAnalytics(1);
33301
33313
  }
33302
- if (process.platform === "win32" && !agentSupportsStdinPrompt(agent)) {
33303
- die2(
33304
- `Error: the '${agent}' agent is not supported on Windows.
33305
- Its CLI requires the prompt as a command-line argument, and these prompts exceed the
33306
- Windows command-line limit of 8191 characters.
33307
- Use --agent claude or --agent codex instead.`
33308
- );
33309
- }
33314
+ assertAgentCanReceivePrompt(agent);
33310
33315
  if (skill === "components" && allComponents && sessionId2) {
33311
33316
  const db = openPipelineDb();
33312
33317
  let componentResults;
@@ -34836,14 +34841,7 @@ Install it, choose another agent with --agent, or use --print-prompt to run the
34836
34841
  ${resolveSkillPath("map-tokens")}`
34837
34842
  );
34838
34843
  }
34839
- if (process.platform === "win32" && !agentSupportsStdinPrompt(agent)) {
34840
- die2(
34841
- `Error: the '${agent}' agent is not supported on Windows.
34842
- Its CLI requires the prompt as a command-line argument, and these prompts exceed the
34843
- Windows command-line limit of 8191 characters.
34844
- Use --agent claude or --agent codex instead.`
34845
- );
34846
- }
34844
+ assertAgentCanReceivePrompt(agent);
34847
34845
  const stepId = createStep(db, sessionId2, "map tokens", { agent, model: model ?? "" });
34848
34846
  const prompt2 = await buildPrompt({
34849
34847
  skill: "map-tokens",
@@ -36392,7 +36390,6 @@ function registerImportCommand(program) {
36392
36390
 
36393
36391
  // packages/experience-design-system-cli/src/setup/command.ts
36394
36392
  init_credentials_store();
36395
- import { spawn as spawn5 } from "node:child_process";
36396
36393
  import { appendFile as appendFile2, readFile as readFile26, access as access9 } from "node:fs/promises";
36397
36394
  import { join as join29 } from "node:path";
36398
36395
  import { homedir as homedir9 } from "node:os";
@@ -36520,12 +36517,10 @@ async function binaryExists2(name) {
36520
36517
  }
36521
36518
  function runSpawn(cmd, args, opts = {}) {
36522
36519
  return new Promise((resolve29) => {
36523
- const launch = resolveSpawn(cmd, args) ?? { command: cmd, args };
36524
- const child = spawn5(launch.command, launch.args, {
36520
+ const child = spawnBinary(cmd, args, {
36525
36521
  cwd: opts.cwd,
36526
36522
  env: opts.env ?? process.env,
36527
- stdio: ["ignore", "pipe", "pipe"],
36528
- ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
36523
+ stdio: ["ignore", "pipe", "pipe"]
36529
36524
  });
36530
36525
  let settled = false;
36531
36526
  let stdout = "";
@@ -36536,10 +36531,10 @@ function runSpawn(cmd, args, opts = {}) {
36536
36531
  resolve29({ exitCode: 1, stdout: "", stderr: err.message });
36537
36532
  }
36538
36533
  });
36539
- child.stdout.on("data", (d) => {
36534
+ child.stdout?.on("data", (d) => {
36540
36535
  stdout += String(d);
36541
36536
  });
36542
- child.stderr.on("data", (d) => {
36537
+ child.stderr?.on("data", (d) => {
36543
36538
  stderr += String(d);
36544
36539
  });
36545
36540
  child.on("exit", (code) => {
@@ -36755,7 +36750,8 @@ async function setupAgent() {
36755
36750
  section("Step 4: Coding agent (claude, codex, opencode, or copilot)", "[required]");
36756
36751
  info("experiences import uses a coding agent to generate component definitions.");
36757
36752
  info("");
36758
- const found = (await Promise.all(AGENT_DEFS.map(async (a) => await binaryExists2(a.binary) ? a : null))).filter(
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(
36759
36755
  (a) => a !== null
36760
36756
  );
36761
36757
  if (found.length === 1) {
@@ -37110,7 +37106,7 @@ async function checkBuild(pkgRoot) {
37110
37106
  }
37111
37107
  async function checkAgent() {
37112
37108
  section("Checking coding agent");
37113
- const agents = AGENT_DEFS;
37109
+ const agents = AGENT_DEFS.filter((a) => agentSupportsStdinPrompt(a.binary) || process.platform !== "win32");
37114
37110
  const creds = await readExperiencesCredentials();
37115
37111
  const savedAgent = creds.agent;
37116
37112
  const savedModel = creds.agentModel;
@@ -37486,13 +37482,9 @@ function registerBuildCommand(program) {
37486
37482
  program.command("build").description("Rebuild from source and re-link exo/experiences binaries to this build").action(async () => {
37487
37483
  const pkgRoot = resolve28(dirname15(fileURLToPath5(import.meta.url)), "..", "..");
37488
37484
  process.stderr.write("\u2699 Building from source...\n");
37489
- const launch = resolveSpawn("pnpm", ["build"]) ?? { command: "pnpm", args: ["build"] };
37490
37485
  const { exitCode } = await runBuild({
37491
- spawnFn: () => spawn6(launch.command, launch.args, {
37492
- cwd: pkgRoot,
37493
- stdio: "inherit",
37494
- ...launch.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
37495
- }),
37486
+ // spawnBinary: pnpm is a `.cmd` shim on Windows.
37487
+ spawnFn: () => spawnBinary("pnpm", ["build"], { cwd: pkgRoot, stdio: "inherit" }),
37496
37488
  stderrWrite: (s) => process.stderr.write(s)
37497
37489
  });
37498
37490
  process.exit(exitCode);
@@ -1,2 +1,12 @@
1
+ import { type AgentName } from '@contentful/experience-design-system-generation';
1
2
  export declare function die(message: string): never;
2
3
  export declare function assertBinaryInPath(binary: string): Promise<boolean>;
4
+ /**
5
+ * Exit early when the chosen agent can't receive a prompt on this platform.
6
+ *
7
+ * Windows limits a command line to 8191 characters and every skill prompt is
8
+ * larger, so an agent that can only take the prompt as an argument has no way to
9
+ * receive one. Every agent but copilot reads the prompt on stdin instead, where
10
+ * no limit applies.
11
+ */
12
+ export declare function assertAgentCanReceivePrompt(agent: AgentName): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.34.1-dev-build-928f202.0",
3
+ "version": "2.34.1-dev-build-1576344.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,8 +39,8 @@
39
39
  "svelte": "^5.56.4",
40
40
  "ts-morph": "^27.0.2",
41
41
  "typescript": "^5.9.3",
42
- "@contentful/experience-design-system-types": "2.34.1-dev-build-928f202.0",
43
- "@contentful/experience-design-system-cli-v2": "2.34.1-dev-build-928f202.0"
42
+ "@contentful/experience-design-system-cli-v2": "2.34.1-dev-build-1576344.0",
43
+ "@contentful/experience-design-system-types": "2.34.1-dev-build-1576344.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@tsconfig/node24": "^24.0.4",
@@ -52,9 +52,9 @@
52
52
  "ink-testing-library": "^4.0.0",
53
53
  "typescript-eslint": "^8.67.0",
54
54
  "vitest": "^4.0.16",
55
- "@contentful/experience-design-system-client": "2.34.1-dev-build-928f202.0",
56
- "@contentful/experience-design-system-generation": "2.34.1-dev-build-928f202.0",
57
- "@contentful/experience-design-system-extraction": "2.34.1-dev-build-928f202.0"
55
+ "@contentful/experience-design-system-extraction": "2.34.1-dev-build-1576344.0",
56
+ "@contentful/experience-design-system-client": "2.34.1-dev-build-1576344.0",
57
+ "@contentful/experience-design-system-generation": "2.34.1-dev-build-1576344.0"
58
58
  },
59
59
  "repository": {
60
60
  "type": "git",