@contentful/experience-design-system-cli 2.37.1-dev-build-932fd115.0 → 2.37.1-dev-build-91b5f8aa.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/index.js CHANGED
@@ -2896,15 +2896,15 @@ import { statSync as statSync2 } from "node:fs";
2896
2896
  import path4 from "node:path";
2897
2897
  function collectFiles(root, options = {}) {
2898
2898
  const resolved = path4.resolve(root);
2899
- let stat;
2899
+ let stat2;
2900
2900
  try {
2901
- stat = statSync2(resolved);
2901
+ stat2 = statSync2(resolved);
2902
2902
  } catch (err) {
2903
2903
  return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
2904
2904
  }
2905
- if (stat.isFile())
2905
+ if (stat2.isFile())
2906
2906
  return { ok: false, failure: "is-file", rootPath: resolved };
2907
- if (!stat.isDirectory())
2907
+ if (!stat2.isDirectory())
2908
2908
  return { ok: false, failure: "not-directory", rootPath: resolved };
2909
2909
  const result = {
2910
2910
  filePaths: [],
@@ -5060,6 +5060,234 @@ var init_screen4 = __esm({
5060
5060
  }
5061
5061
  });
5062
5062
 
5063
+ // packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts
5064
+ var init_logic5 = __esm({
5065
+ "packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts"() {
5066
+ "use strict";
5067
+ }
5068
+ });
5069
+
5070
+ // packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
5071
+ import { useInput as useInput7 } from "ink";
5072
+ var init_controls5 = __esm({
5073
+ "packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts"() {
5074
+ "use strict";
5075
+ init_logic5();
5076
+ }
5077
+ });
5078
+
5079
+ // packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
5080
+ import { Box as Box7, Text as Text8 } from "ink";
5081
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
5082
+ var init_error_step = __esm({
5083
+ "packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx"() {
5084
+ "use strict";
5085
+ init_home_theme();
5086
+ init_controls5();
5087
+ init_logic5();
5088
+ }
5089
+ });
5090
+
5091
+ // packages/experience-design-system-cli/src/tui/import/shared/gate-step/logic.ts
5092
+ function gateAction(input, key, canSkip) {
5093
+ if (key.return) return "continue";
5094
+ if (input === "a" && canSkip) return "skip";
5095
+ if (key.escape) return "quit";
5096
+ return null;
5097
+ }
5098
+ function gateControls(continueLabel, skipLabel, canSkip) {
5099
+ return [
5100
+ { keys: "Enter", label: continueLabel },
5101
+ ...canSkip ? [{ keys: "a", label: skipLabel }] : [],
5102
+ { keys: "Esc", label: "Quit" }
5103
+ ];
5104
+ }
5105
+ var init_logic6 = __esm({
5106
+ "packages/experience-design-system-cli/src/tui/import/shared/gate-step/logic.ts"() {
5107
+ "use strict";
5108
+ }
5109
+ });
5110
+
5111
+ // packages/experience-design-system-cli/src/tui/import/shared/gate-step/controls.ts
5112
+ import { useInput as useInput8 } from "ink";
5113
+ function useGateControls(handlers) {
5114
+ useInput8((input, key) => {
5115
+ const action = gateAction(input, key, handlers.canSkip);
5116
+ if (action === "continue") handlers.onContinue();
5117
+ else if (action === "skip") handlers.onSkip();
5118
+ else if (action === "quit") handlers.onQuit();
5119
+ });
5120
+ }
5121
+ var init_controls6 = __esm({
5122
+ "packages/experience-design-system-cli/src/tui/import/shared/gate-step/controls.ts"() {
5123
+ "use strict";
5124
+ init_logic6();
5125
+ }
5126
+ });
5127
+
5128
+ // packages/experience-design-system-cli/src/tui/import/shared/gate-step/gate-step.tsx
5129
+ import { Box as Box8, Text as Text9 } from "ink";
5130
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
5131
+ function GateStep({
5132
+ message,
5133
+ onContinue,
5134
+ onQuit,
5135
+ summary,
5136
+ context,
5137
+ continueLabel = "Continue",
5138
+ skipLabel = "Approve all and skip",
5139
+ onSkip,
5140
+ intent = "success"
5141
+ }) {
5142
+ useGateControls({ canSkip: onSkip !== void 0, onContinue, onSkip: onSkip ?? (() => {
5143
+ }), onQuit });
5144
+ const color = intent === "error" ? PALETTE.error : PALETTE.success;
5145
+ const icon = intent === "error" ? "\u2717" : "\u2713";
5146
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
5147
+ /* @__PURE__ */ jsxs8(Text9, { color, children: [
5148
+ icon,
5149
+ " ",
5150
+ message
5151
+ ] }),
5152
+ summary && /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: summary }),
5153
+ context && /* @__PURE__ */ jsx9(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { children: context }) }),
5154
+ /* @__PURE__ */ jsx9(Box8, { marginTop: 1, gap: 3, children: gateControls(continueLabel, skipLabel, onSkip !== void 0).map((control) => /* @__PURE__ */ jsxs8(Text9, { dimColor: true, children: [
5155
+ "[",
5156
+ control.keys,
5157
+ "] ",
5158
+ control.label
5159
+ ] }, control.keys)) })
5160
+ ] });
5161
+ }
5162
+ var init_gate_step = __esm({
5163
+ "packages/experience-design-system-cli/src/tui/import/shared/gate-step/gate-step.tsx"() {
5164
+ "use strict";
5165
+ init_home_theme();
5166
+ init_controls6();
5167
+ init_logic6();
5168
+ }
5169
+ });
5170
+
5171
+ // packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts
5172
+ var init_logic7 = __esm({
5173
+ "packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts"() {
5174
+ "use strict";
5175
+ }
5176
+ });
5177
+
5178
+ // packages/experience-design-system-cli/src/tui/import/shared/running-step/theme.ts
5179
+ import { defaultTheme, extendTheme } from "@inkjs/ui";
5180
+ var PROGRESS_THEME;
5181
+ var init_theme = __esm({
5182
+ "packages/experience-design-system-cli/src/tui/import/shared/running-step/theme.ts"() {
5183
+ "use strict";
5184
+ PROGRESS_THEME = extendTheme(defaultTheme, {
5185
+ components: {
5186
+ ProgressBar: {
5187
+ styles: {
5188
+ completed: () => ({ color: "blue" })
5189
+ }
5190
+ }
5191
+ }
5192
+ });
5193
+ }
5194
+ });
5195
+
5196
+ // packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
5197
+ import { useEffect as useEffect4, useState as useState7 } from "react";
5198
+ var init_use_elapsed = __esm({
5199
+ "packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts"() {
5200
+ "use strict";
5201
+ init_logic7();
5202
+ }
5203
+ });
5204
+
5205
+ // packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx
5206
+ import { Box as Box9, Text as Text10 } from "ink";
5207
+ import { ProgressBar, Spinner, ThemeProvider } from "@inkjs/ui";
5208
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
5209
+ var RULE2;
5210
+ var init_running_step = __esm({
5211
+ "packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx"() {
5212
+ "use strict";
5213
+ init_home_theme();
5214
+ init_logic7();
5215
+ init_theme();
5216
+ init_use_elapsed();
5217
+ RULE2 = "\u2500".repeat(40);
5218
+ }
5219
+ });
5220
+
5221
+ // packages/experience-design-system-cli/src/tui/import/shared/index.ts
5222
+ var init_shared2 = __esm({
5223
+ "packages/experience-design-system-cli/src/tui/import/shared/index.ts"() {
5224
+ "use strict";
5225
+ init_error_step();
5226
+ init_gate_step();
5227
+ init_running_step();
5228
+ }
5229
+ });
5230
+
5231
+ // packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
5232
+ import { access, stat } from "node:fs/promises";
5233
+ import { join as join5 } from "node:path";
5234
+ async function inspectTokens({ rawTokensPath, outDir, cache }) {
5235
+ if (!cache) return { kind: "none" };
5236
+ const tokensPath = join5(outDir, "tokens.json");
5237
+ try {
5238
+ await access(tokensPath);
5239
+ } catch {
5240
+ return { kind: "none" };
5241
+ }
5242
+ const [generated, source] = await Promise.all([stat(tokensPath), stat(rawTokensPath).catch(() => null)]);
5243
+ return { kind: "cached", tokensPath, sourceChanged: source ? source.mtimeMs > generated.mtimeMs : false };
5244
+ }
5245
+ function gateText({ tokensPath, sourceChanged }) {
5246
+ const summary = sourceChanged ? `Source file has been modified since tokens were last generated.
5247
+
5248
+ Tokens Path: ${tokensPath}` : `Source file has not changed since tokens were last generated.
5249
+
5250
+ Tokens Path: ${tokensPath}`;
5251
+ return sourceChanged ? { summary, context: "The source tokens file changed \u2014 regenerating is recommended." } : { summary };
5252
+ }
5253
+ var init_logic8 = __esm({
5254
+ "packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts"() {
5255
+ "use strict";
5256
+ }
5257
+ });
5258
+
5259
+ // packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/screen.tsx
5260
+ import { jsx as jsx11 } from "react/jsx-runtime";
5261
+ function TokenReuseScreen({
5262
+ tokensPath,
5263
+ sourceChanged,
5264
+ onReuse,
5265
+ onRegenerate,
5266
+ onQuit
5267
+ }) {
5268
+ const { summary, context } = gateText({ tokensPath, sourceChanged });
5269
+ return /* @__PURE__ */ jsx11(
5270
+ GateStep,
5271
+ {
5272
+ message: "Existing tokens.json found",
5273
+ summary,
5274
+ context,
5275
+ continueLabel: "Reuse existing tokens",
5276
+ skipLabel: "Regenerate tokens",
5277
+ onContinue: onReuse,
5278
+ onSkip: onRegenerate,
5279
+ onQuit
5280
+ }
5281
+ );
5282
+ }
5283
+ var init_screen5 = __esm({
5284
+ "packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/screen.tsx"() {
5285
+ "use strict";
5286
+ init_shared2();
5287
+ init_logic8();
5288
+ }
5289
+ });
5290
+
5063
5291
  // packages/experience-design-system-cli/src/tui/import/steps/index.ts
5064
5292
  var init_steps = __esm({
5065
5293
  "packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
@@ -5068,6 +5296,7 @@ var init_steps = __esm({
5068
5296
  init_screen2();
5069
5297
  init_screen3();
5070
5298
  init_screen4();
5299
+ init_screen5();
5071
5300
  }
5072
5301
  });
5073
5302
 
@@ -5084,13 +5313,20 @@ function buildArgs2(options) {
5084
5313
  args.push(...importOptionArgs({ agent: options.agent, prompt: options.prompt ?? [], cache: options.cache ?? true }));
5085
5314
  return args;
5086
5315
  }
5316
+ function buildEnv(options, base = process.env) {
5317
+ return {
5318
+ ...base,
5319
+ ...options.skipCredentials ? { EDS_IMPORT_SKIP_CREDENTIALS: "1" } : {},
5320
+ ...options.tokenStrategy ? { EDS_IMPORT_TOKENS: options.tokenStrategy } : {}
5321
+ };
5322
+ }
5087
5323
  async function spawnV1Import(options = {}) {
5088
5324
  const cliPath = findLegacyCliPath();
5089
5325
  const args = buildArgs2(options);
5090
5326
  return new Promise((resolvePromise) => {
5091
5327
  const child = spawn3("node", [cliPath, ...args], {
5092
5328
  stdio: "inherit",
5093
- env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
5329
+ env: buildEnv(options)
5094
5330
  });
5095
5331
  child.on("close", (code) => {
5096
5332
  resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
@@ -5135,9 +5371,9 @@ var init_terminal_input = __esm({
5135
5371
  import { randomBytes } from "node:crypto";
5136
5372
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
5137
5373
  import { homedir as homedir2 } from "node:os";
5138
- import { dirname as dirname2, join as join5 } from "node:path";
5374
+ import { dirname as dirname2, join as join6 } from "node:path";
5139
5375
  function configRoot2() {
5140
- return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
5376
+ return process.env["EDS_HOME"] || join6(homedir2(), ".contentful", "experience-design-system-cli");
5141
5377
  }
5142
5378
  async function readSettings2() {
5143
5379
  try {
@@ -5161,10 +5397,10 @@ var configFilePath2, runsFilePath2, debugSessionsDir2, oldConfigDir2;
5161
5397
  var init_config = __esm({
5162
5398
  "packages/experience-design-system-types/dist/src/config/index.js"() {
5163
5399
  "use strict";
5164
- configFilePath2 = () => join5(configRoot2(), "config.json");
5165
- runsFilePath2 = () => join5(configRoot2(), "state", "runs.json");
5166
- debugSessionsDir2 = () => join5(configRoot2(), "debug", "sessions");
5167
- oldConfigDir2 = () => join5(homedir2(), ".config", "experiences");
5400
+ configFilePath2 = () => join6(configRoot2(), "config.json");
5401
+ runsFilePath2 = () => join6(configRoot2(), "state", "runs.json");
5402
+ debugSessionsDir2 = () => join6(configRoot2(), "debug", "sessions");
5403
+ oldConfigDir2 = () => join6(homedir2(), ".config", "experiences");
5168
5404
  }
5169
5405
  });
5170
5406
 
@@ -5190,7 +5426,7 @@ var init_debug_mode_store = __esm({
5190
5426
  // packages/experience-design-system-cli/src/tui/debug-store.ts
5191
5427
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
5192
5428
  import { existsSync as existsSync4, readdirSync as readdirSync2 } from "node:fs";
5193
- import { join as join6 } from "node:path";
5429
+ import { join as join7 } from "node:path";
5194
5430
  function generateRunId() {
5195
5431
  const now = /* @__PURE__ */ new Date();
5196
5432
  const pad = (n) => String(n).padStart(2, "0");
@@ -5215,7 +5451,7 @@ function generateSessionId3() {
5215
5451
  return `${today}-session-${maxSeq + 1}`;
5216
5452
  }
5217
5453
  function sessionDebugDir() {
5218
- return join6(debugSessionsDir2(), SESSION_ID);
5454
+ return join7(debugSessionsDir2(), SESSION_ID);
5219
5455
  }
5220
5456
  function currentDebugSessionDir() {
5221
5457
  return sessionDebugDir();
@@ -5260,10 +5496,10 @@ async function finishDebugRun({
5260
5496
  const durationMs = Date.now() - run.startedAt;
5261
5497
  const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
5262
5498
  const flowSegments = run.flow.split("/");
5263
- const dir = join6(sessionDebugDir(), ...flowSegments);
5499
+ const dir = join7(sessionDebugDir(), ...flowSegments);
5264
5500
  await mkdir2(dir, { recursive: true });
5265
5501
  const filename = nextAttemptFilename(dir, run.menuOption);
5266
- await writeFile2(join6(dir, filename), content, { mode: 384 });
5502
+ await writeFile2(join7(dir, filename), content, { mode: 384 });
5267
5503
  }
5268
5504
  function nextAttemptFilename(dir, menuOption) {
5269
5505
  const today = datePrefix();
@@ -5278,13 +5514,13 @@ function nextAttemptFilename(dir, menuOption) {
5278
5514
  }
5279
5515
  function renderMarkdown(run, finish) {
5280
5516
  const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
5281
- const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
5517
+ const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
5282
5518
  const flowSlug = run.flow.split("/").join("-");
5283
5519
  return `# Debug Log
5284
5520
 
5285
5521
  - Run ID: ${run.runId}
5286
5522
  - Flow: ${flowSlug}
5287
- - Step: ${stepLabel}
5523
+ - Step: ${stepLabel2}
5288
5524
  - Menu option: ${run.menuOption}
5289
5525
  - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
5290
5526
  - CLI version: ${readPackageVersion()}
@@ -5369,21 +5605,21 @@ var init_help_info = __esm({
5369
5605
  });
5370
5606
 
5371
5607
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
5372
- import { useEffect as useEffect4, useState as useState7 } from "react";
5373
- import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
5374
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
5608
+ import { useEffect as useEffect5, useState as useState8 } from "react";
5609
+ import { Box as Box10, Text as Text11, useInput as useInput9 } from "ink";
5610
+ import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
5375
5611
  function Section({ title, rows }) {
5376
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
5377
- /* @__PURE__ */ jsx8(Text8, { bold: true, color: PALETTE.accent, children: title }),
5378
- rows.map((row) => /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
5379
- /* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: row.label }) }),
5380
- /* @__PURE__ */ jsx8(Text8, { children: row.value })
5612
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
5613
+ /* @__PURE__ */ jsx12(Text11, { bold: true, color: PALETTE.accent, children: title }),
5614
+ rows.map((row) => /* @__PURE__ */ jsxs10(Box10, { gap: 1, children: [
5615
+ /* @__PURE__ */ jsx12(Box10, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: row.label }) }),
5616
+ /* @__PURE__ */ jsx12(Text11, { children: row.value })
5381
5617
  ] }, row.label))
5382
5618
  ] });
5383
5619
  }
5384
5620
  function HelpScreen({ onDone }) {
5385
- const [info, setInfo] = useState7();
5386
- useEffect4(() => {
5621
+ const [info, setInfo] = useState8();
5622
+ useEffect5(() => {
5387
5623
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
5388
5624
  void readHelpInfo().then(setInfo);
5389
5625
  }, []);
@@ -5391,7 +5627,7 @@ function HelpScreen({ onDone }) {
5391
5627
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
5392
5628
  onDone();
5393
5629
  };
5394
- useInput7((input, key) => {
5630
+ useInput9((input, key) => {
5395
5631
  if (key.return) {
5396
5632
  leave("saved");
5397
5633
  return;
@@ -5401,14 +5637,14 @@ function HelpScreen({ onDone }) {
5401
5637
  return;
5402
5638
  }
5403
5639
  });
5404
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
5405
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Help" }),
5406
- info ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
5407
- /* @__PURE__ */ jsx8(Section, { title: "Where things are stored", rows: info.storage }),
5408
- /* @__PURE__ */ jsx8(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
5409
- /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
5410
- ] }) : /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." }),
5411
- /* @__PURE__ */ jsx8(
5640
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
5641
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: "Help" }),
5642
+ info ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
5643
+ /* @__PURE__ */ jsx12(Section, { title: "Where things are stored", rows: info.storage }),
5644
+ /* @__PURE__ */ jsx12(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
5645
+ /* @__PURE__ */ jsx12(Text11, { color: PALETTE.muted, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
5646
+ ] }) : /* @__PURE__ */ jsx12(Text11, { color: PALETTE.accent, children: "Loading..." }),
5647
+ /* @__PURE__ */ jsx12(
5412
5648
  ControlHints,
5413
5649
  {
5414
5650
  hints: [
@@ -5430,20 +5666,20 @@ var init_PageContainer2 = __esm({
5430
5666
  });
5431
5667
 
5432
5668
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
5433
- import { useState as useState8 } from "react";
5434
- import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
5435
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
5669
+ import { useState as useState9 } from "react";
5670
+ import { Box as Box11, Text as Text12, useInput as useInput10 } from "ink";
5671
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
5436
5672
  function SettingsScreen({
5437
5673
  onNavigate,
5438
5674
  onBack
5439
5675
  }) {
5440
- const [focusIdx, setFocusIdx] = useState8(0);
5676
+ const [focusIdx, setFocusIdx] = useState9(0);
5441
5677
  const items = [
5442
5678
  { label: "Configuration", screen: "settings-configuration" },
5443
5679
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
5444
5680
  { label: "Debug Mode", screen: "settings-debug-mode" }
5445
5681
  ];
5446
- useInput8((input, key) => {
5682
+ useInput10((input, key) => {
5447
5683
  if (key.upArrow) {
5448
5684
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
5449
5685
  return;
@@ -5463,15 +5699,15 @@ function SettingsScreen({
5463
5699
  onBack();
5464
5700
  }
5465
5701
  });
5466
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5467
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings" }),
5468
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
5469
- items.map((item, i) => /* @__PURE__ */ jsxs8(Text9, { color: i === focusIdx ? "cyan" : void 0, children: [
5702
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5703
+ /* @__PURE__ */ jsx13(Text12, { bold: true, children: "Settings" }),
5704
+ /* @__PURE__ */ jsx13(Text12, { children: " " }),
5705
+ items.map((item, i) => /* @__PURE__ */ jsxs11(Text12, { color: i === focusIdx ? "cyan" : void 0, children: [
5470
5706
  i === focusIdx ? "> " : " ",
5471
5707
  item.label
5472
5708
  ] }, item.label)),
5473
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
5474
- /* @__PURE__ */ jsx9(
5709
+ /* @__PURE__ */ jsx13(Text12, { children: " " }),
5710
+ /* @__PURE__ */ jsx13(
5475
5711
  ControlHints,
5476
5712
  {
5477
5713
  hints: [
@@ -5532,10 +5768,10 @@ var init_config_store = __esm({
5532
5768
  });
5533
5769
 
5534
5770
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
5535
- import { useEffect as useEffect5, useState as useState9 } from "react";
5536
- import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
5771
+ import { useEffect as useEffect6, useState as useState10 } from "react";
5772
+ import { Box as Box12, Text as Text13, useInput as useInput11 } from "ink";
5537
5773
  import TextInput4 from "ink-text-input";
5538
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
5774
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
5539
5775
  function debugFields(config) {
5540
5776
  return {
5541
5777
  space_id: config?.spaceId ?? "",
@@ -5547,14 +5783,14 @@ function debugFields(config) {
5547
5783
  };
5548
5784
  }
5549
5785
  function ConfigurationScreen({ onDone }) {
5550
- const [stage, setStage] = useState9("loading");
5551
- const [config, setConfig] = useState9(null);
5552
- const [activeField, setActiveField] = useState9("spaceId");
5553
- const [notice, setNotice] = useState9(null);
5554
- const [lastSaved, setLastSaved] = useState9(null);
5555
- const [editing, setEditing] = useState9(false);
5556
- const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
5557
- useEffect5(() => {
5786
+ const [stage, setStage] = useState10("loading");
5787
+ const [config, setConfig] = useState10(null);
5788
+ const [activeField, setActiveField] = useState10("spaceId");
5789
+ const [notice, setNotice] = useState10(null);
5790
+ const [lastSaved, setLastSaved] = useState10(null);
5791
+ const [editing, setEditing] = useState10(false);
5792
+ const [valueBeforeEdit, setValueBeforeEdit] = useState10("");
5793
+ useEffect6(() => {
5558
5794
  readCredentials().then((cfg) => {
5559
5795
  setConfig(cfg);
5560
5796
  setStage("form");
@@ -5594,7 +5830,7 @@ function ConfigurationScreen({ onDone }) {
5594
5830
  );
5595
5831
  onDone();
5596
5832
  }
5597
- useInput9((input, key) => {
5833
+ useInput11((input, key) => {
5598
5834
  if (stage === "loading" || stage === "saving") return;
5599
5835
  if (editing) {
5600
5836
  if (key.escape) {
@@ -5631,26 +5867,26 @@ function ConfigurationScreen({ onDone }) {
5631
5867
  }
5632
5868
  });
5633
5869
  if (stage === "loading") {
5634
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5635
- /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
5636
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
5637
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.accent, children: "Loading..." })
5870
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5871
+ /* @__PURE__ */ jsx14(Text13, { bold: true, children: "Configuration" }),
5872
+ /* @__PURE__ */ jsx14(Text13, { children: " " }),
5873
+ /* @__PURE__ */ jsx14(Text13, { color: PALETTE.accent, children: "Loading..." })
5638
5874
  ] });
5639
5875
  }
5640
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5641
- /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
5642
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
5643
- /* @__PURE__ */ jsx10(Box9, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
5876
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5877
+ /* @__PURE__ */ jsx14(Text13, { bold: true, children: "Configuration" }),
5878
+ /* @__PURE__ */ jsx14(Text13, { children: " " }),
5879
+ /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
5644
5880
  const isActive = activeField === field;
5645
5881
  const value = fieldValue(field);
5646
5882
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
5647
- return /* @__PURE__ */ jsxs9(Box9, { gap: 1, children: [
5648
- /* @__PURE__ */ jsx10(Text10, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
5649
- /* @__PURE__ */ jsxs9(Text10, { bold: isActive, children: [
5883
+ return /* @__PURE__ */ jsxs12(Box12, { gap: 1, children: [
5884
+ /* @__PURE__ */ jsx14(Text13, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
5885
+ /* @__PURE__ */ jsxs12(Text13, { bold: isActive, children: [
5650
5886
  FIELD_LABELS[field],
5651
5887
  ":"
5652
5888
  ] }),
5653
- isActive && editing ? /* @__PURE__ */ jsx10(
5889
+ isActive && editing ? /* @__PURE__ */ jsx14(
5654
5890
  TextInput4,
5655
5891
  {
5656
5892
  value,
@@ -5658,19 +5894,19 @@ function ConfigurationScreen({ onDone }) {
5658
5894
  onSubmit: () => setEditing(false),
5659
5895
  mask: field === "cmaToken" ? "\u2022" : void 0
5660
5896
  }
5661
- ) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "(empty)" }) })
5897
+ ) : /* @__PURE__ */ jsx14(Text13, { children: display || /* @__PURE__ */ jsx14(Text13, { color: PALETTE.muted, children: "(empty)" }) })
5662
5898
  ] }, field);
5663
5899
  }) }),
5664
- notice && /* @__PURE__ */ jsxs9(Fragment3, { children: [
5665
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
5666
- /* @__PURE__ */ jsxs9(Text10, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
5900
+ notice && /* @__PURE__ */ jsxs12(Fragment3, { children: [
5901
+ /* @__PURE__ */ jsx14(Text13, { children: " " }),
5902
+ /* @__PURE__ */ jsxs12(Text13, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
5667
5903
  notice.kind === "success" ? "\u2713" : "\u2717",
5668
5904
  " ",
5669
5905
  notice.text
5670
5906
  ] })
5671
5907
  ] }),
5672
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
5673
- /* @__PURE__ */ jsx10(
5908
+ /* @__PURE__ */ jsx14(Text13, { children: " " }),
5909
+ /* @__PURE__ */ jsx14(
5674
5910
  ControlHints,
5675
5911
  {
5676
5912
  hints: editing ? [
@@ -5738,13 +5974,13 @@ var init_analytics_store = __esm({
5738
5974
  });
5739
5975
 
5740
5976
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
5741
- import { useEffect as useEffect6, useState as useState10 } from "react";
5742
- import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
5743
- import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
5977
+ import { useEffect as useEffect7, useState as useState11 } from "react";
5978
+ import { Box as Box13, Text as Text14, useInput as useInput12 } from "ink";
5979
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
5744
5980
  function OptInAnalyticsScreen({ onDone }) {
5745
- const [loading, setLoading] = useState10(true);
5746
- const [enabled, setEnabled] = useState10(true);
5747
- useEffect6(() => {
5981
+ const [loading, setLoading] = useState11(true);
5982
+ const [enabled, setEnabled] = useState11(true);
5983
+ useEffect7(() => {
5748
5984
  readAnalyticsSetting().then((setting) => {
5749
5985
  setEnabled(setting.enabled);
5750
5986
  setLoading(false);
@@ -5756,7 +5992,7 @@ function OptInAnalyticsScreen({ onDone }) {
5756
5992
  });
5757
5993
  });
5758
5994
  }, []);
5759
- useInput10((input, key) => {
5995
+ useInput12((input, key) => {
5760
5996
  if (loading) return;
5761
5997
  if (key.return || input === " ") {
5762
5998
  setEnabled((current) => {
@@ -5771,21 +6007,21 @@ function OptInAnalyticsScreen({ onDone }) {
5771
6007
  onDone();
5772
6008
  }
5773
6009
  });
5774
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5775
- /* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
5776
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
5777
- loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
5778
- /* @__PURE__ */ jsxs10(Text11, { children: [
6010
+ return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
6011
+ /* @__PURE__ */ jsx15(Text14, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
6012
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
6013
+ loading ? /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
6014
+ /* @__PURE__ */ jsxs13(Text14, { children: [
5779
6015
  "Share anonymous usage data:",
5780
6016
  " ",
5781
- /* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
6017
+ /* @__PURE__ */ jsx15(Text14, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
5782
6018
  ] }),
5783
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
5784
- /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
5785
- /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
6019
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
6020
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
6021
+ /* @__PURE__ */ jsx15(Text14, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
5786
6022
  ] }),
5787
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
5788
- /* @__PURE__ */ jsx11(
6023
+ /* @__PURE__ */ jsx15(Text14, { children: " " }),
6024
+ /* @__PURE__ */ jsx15(
5789
6025
  ControlHints,
5790
6026
  {
5791
6027
  hints: [
@@ -5796,7 +6032,7 @@ function OptInAnalyticsScreen({ onDone }) {
5796
6032
  )
5797
6033
  ] });
5798
6034
  }
5799
- var init_screen5 = __esm({
6035
+ var init_screen6 = __esm({
5800
6036
  "packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
5801
6037
  "use strict";
5802
6038
  init_home_theme();
@@ -5807,12 +6043,12 @@ var init_screen5 = __esm({
5807
6043
  });
5808
6044
 
5809
6045
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
5810
- import { useEffect as useEffect7, useState as useState11 } from "react";
5811
- import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
5812
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
6046
+ import { useEffect as useEffect8, useState as useState12 } from "react";
6047
+ import { Box as Box14, Text as Text15, useInput as useInput13 } from "ink";
6048
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
5813
6049
  function UpgradeScreen({ onDone }) {
5814
- const [upgradeCheck, setUpgradeCheck] = useState11();
5815
- useEffect7(() => {
6050
+ const [upgradeCheck, setUpgradeCheck] = useState12();
6051
+ useEffect8(() => {
5816
6052
  startDebugRun({
5817
6053
  flow: "upgrade",
5818
6054
  step: "01-upgrade",
@@ -5821,7 +6057,7 @@ function UpgradeScreen({ onDone }) {
5821
6057
  });
5822
6058
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
5823
6059
  }, []);
5824
- useInput11((_input, key) => {
6060
+ useInput13((_input, key) => {
5825
6061
  if (key.return) {
5826
6062
  void finishDebugRun({
5827
6063
  outputs: upgradeCheck ?? {},
@@ -5832,12 +6068,12 @@ function UpgradeScreen({ onDone }) {
5832
6068
  return;
5833
6069
  }
5834
6070
  });
5835
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5836
- /* @__PURE__ */ jsx12(Text12, { bold: true, children: "Upgrade" }),
5837
- /* @__PURE__ */ jsx12(Text12, { children: " " }),
6071
+ return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
6072
+ /* @__PURE__ */ jsx16(Text15, { bold: true, children: "Upgrade" }),
6073
+ /* @__PURE__ */ jsx16(Text15, { children: " " }),
5838
6074
  renderBody(upgradeCheck),
5839
- /* @__PURE__ */ jsx12(Text12, { children: " " }),
5840
- /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.accent, children: [
6075
+ /* @__PURE__ */ jsx16(Text15, { children: " " }),
6076
+ /* @__PURE__ */ jsxs14(Text15, { bold: true, color: PALETTE.accent, children: [
5841
6077
  FOCUS_MARKER,
5842
6078
  " Go Back"
5843
6079
  ] })
@@ -5845,34 +6081,34 @@ function UpgradeScreen({ onDone }) {
5845
6081
  }
5846
6082
  function renderBody(upgradeCheck) {
5847
6083
  if (!upgradeCheck) {
5848
- return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Checking for updates\u2026" });
6084
+ return /* @__PURE__ */ jsx16(Text15, { color: PALETTE.muted, children: "Checking for updates\u2026" });
5849
6085
  }
5850
6086
  if (upgradeCheck.status === "error") {
5851
- return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
6087
+ return /* @__PURE__ */ jsx16(Text15, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
5852
6088
  }
5853
6089
  if (upgradeCheck.status === "up-to-date") {
5854
- return /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.success, children: [
6090
+ return /* @__PURE__ */ jsxs14(Text15, { color: PALETTE.success, children: [
5855
6091
  "You're already on the latest version (v",
5856
6092
  upgradeCheck.current,
5857
6093
  ")."
5858
6094
  ] });
5859
6095
  }
5860
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
5861
- /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.muted, children: [
5862
- /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.success, children: [
6096
+ return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", children: [
6097
+ /* @__PURE__ */ jsxs14(Text15, { color: PALETTE.muted, children: [
6098
+ /* @__PURE__ */ jsxs14(Text15, { bold: true, color: PALETTE.success, children: [
5863
6099
  "v",
5864
6100
  upgradeCheck.latest
5865
6101
  ] }),
5866
6102
  " ",
5867
6103
  "is available (you're on ",
5868
- /* @__PURE__ */ jsxs11(Text12, { bold: true, children: [
6104
+ /* @__PURE__ */ jsxs14(Text15, { bold: true, children: [
5869
6105
  "v",
5870
6106
  upgradeCheck.current
5871
6107
  ] }),
5872
6108
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
5873
6109
  ] }),
5874
- /* @__PURE__ */ jsx12(Text12, { children: " " }),
5875
- /* @__PURE__ */ jsx12(Box11, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx12(Text12, { bold: true, children: cmd }, cmd)) })
6110
+ /* @__PURE__ */ jsx16(Text15, { children: " " }),
6111
+ /* @__PURE__ */ jsx16(Box14, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx16(Text15, { bold: true, children: cmd }, cmd)) })
5876
6112
  ] });
5877
6113
  }
5878
6114
  var UPGRADE_COMMANDS;
@@ -5887,13 +6123,13 @@ var init_PageContainer4 = __esm({
5887
6123
  });
5888
6124
 
5889
6125
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
5890
- import { useEffect as useEffect8, useState as useState12 } from "react";
5891
- import { Box as Box12, Text as Text13, useInput as useInput12 } from "ink";
5892
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
6126
+ import { useEffect as useEffect9, useState as useState13 } from "react";
6127
+ import { Box as Box15, Text as Text16, useInput as useInput14 } from "ink";
6128
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
5893
6129
  function DebugModeScreen({ onDone }) {
5894
- const [loading, setLoading] = useState12(true);
5895
- const [enabled, setEnabled] = useState12(true);
5896
- useEffect8(() => {
6130
+ const [loading, setLoading] = useState13(true);
6131
+ const [enabled, setEnabled] = useState13(true);
6132
+ useEffect9(() => {
5897
6133
  readDebugModeSetting().then((setting) => {
5898
6134
  setEnabled(setting.enabled);
5899
6135
  setLoading(false);
@@ -5905,7 +6141,7 @@ function DebugModeScreen({ onDone }) {
5905
6141
  });
5906
6142
  });
5907
6143
  }, []);
5908
- useInput12((input, key) => {
6144
+ useInput14((input, key) => {
5909
6145
  if (loading) return;
5910
6146
  if (key.return || input === " ") {
5911
6147
  setEnabled((current) => {
@@ -5920,16 +6156,16 @@ function DebugModeScreen({ onDone }) {
5920
6156
  onDone();
5921
6157
  }
5922
6158
  });
5923
- return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
5924
- /* @__PURE__ */ jsx13(Text13, { bold: true, children: "Settings \u203A Debug Mode" }),
5925
- /* @__PURE__ */ jsx13(Text13, { children: " " }),
5926
- loading ? /* @__PURE__ */ jsx13(Text13, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs12(Text13, { children: [
6159
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
6160
+ /* @__PURE__ */ jsx17(Text16, { bold: true, children: "Settings \u203A Debug Mode" }),
6161
+ /* @__PURE__ */ jsx17(Text16, { children: " " }),
6162
+ loading ? /* @__PURE__ */ jsx17(Text16, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs15(Text16, { children: [
5927
6163
  "Debug logging:",
5928
6164
  " ",
5929
- /* @__PURE__ */ jsx13(Text13, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
6165
+ /* @__PURE__ */ jsx17(Text16, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
5930
6166
  ] }),
5931
- /* @__PURE__ */ jsx13(Text13, { children: " " }),
5932
- /* @__PURE__ */ jsx13(
6167
+ /* @__PURE__ */ jsx17(Text16, { children: " " }),
6168
+ /* @__PURE__ */ jsx17(
5933
6169
  ControlHints,
5934
6170
  {
5935
6171
  hints: [
@@ -5940,7 +6176,7 @@ function DebugModeScreen({ onDone }) {
5940
6176
  )
5941
6177
  ] });
5942
6178
  }
5943
- var init_screen6 = __esm({
6179
+ var init_screen7 = __esm({
5944
6180
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
5945
6181
  "use strict";
5946
6182
  init_home_theme();
@@ -5955,17 +6191,19 @@ var app_exports = {};
5955
6191
  __export(app_exports, {
5956
6192
  runApp: () => runApp
5957
6193
  });
5958
- import { useEffect as useEffect9, useState as useState13 } from "react";
5959
- import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
6194
+ import { join as join8 } from "node:path";
6195
+ import { useEffect as useEffect10, useState as useState14 } from "react";
6196
+ import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
5960
6197
  function App({ importOptions, onLaunchImport, importExitCode }) {
5961
6198
  const returnedFromImport = importExitCode !== void 0;
5962
- const [screen, setScreen] = useState13(returnedFromImport ? "import" : "start");
5963
- const [showImportResult, setShowImportResult] = useState13(returnedFromImport);
5964
- const [projectPath, setProjectPath] = useState13();
5965
- const [tokensPath, setTokensPath] = useState13();
5966
- const [scannedFiles, setScannedFiles] = useState13();
5967
- const [importDefaults, setImportDefaults] = useState13();
5968
- useEffect9(() => {
6199
+ const [screen, setScreen] = useState14(returnedFromImport ? "import" : "start");
6200
+ const [showImportResult, setShowImportResult] = useState14(returnedFromImport);
6201
+ const [projectPath, setProjectPath] = useState14();
6202
+ const [tokensPath, setTokensPath] = useState14();
6203
+ const [scannedFiles, setScannedFiles] = useState14();
6204
+ const [pendingLaunch, setPendingLaunch] = useState14();
6205
+ const [importDefaults, setImportDefaults] = useState14();
6206
+ useEffect10(() => {
5969
6207
  if (screen !== "import") {
5970
6208
  setImportDefaults(void 0);
5971
6209
  return;
@@ -5980,7 +6218,27 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
5980
6218
  }, [screen]);
5981
6219
  const finishCredentials = async (result, projectPath2, tokens, filePaths) => {
5982
6220
  if (!result.skipped) await writeCredentials({ ...result.credentials });
5983
- onLaunchImport?.({ projectPath: projectPath2, tokens, filePaths, skipCredentials: result.skipped, ...importOptions });
6221
+ const launch = {
6222
+ projectPath: projectPath2,
6223
+ tokens,
6224
+ filePaths,
6225
+ skipCredentials: result.skipped,
6226
+ ...importOptions
6227
+ };
6228
+ const state = await inspectTokens({
6229
+ rawTokensPath: tokens,
6230
+ outDir: join8(resolveUserPath(projectPath2), ".contentful"),
6231
+ cache: importOptions.cache
6232
+ });
6233
+ if (state.kind === "cached") {
6234
+ setPendingLaunch({ launch, cached: { tokensPath: state.tokensPath, sourceChanged: state.sourceChanged } });
6235
+ return;
6236
+ }
6237
+ onLaunchImport?.({ ...launch, tokenStrategy: "generate" });
6238
+ };
6239
+ const chooseTokenStrategy = (pending, tokenStrategy) => {
6240
+ setPendingLaunch(void 0);
6241
+ onLaunchImport?.({ ...pending.launch, tokenStrategy });
5984
6242
  };
5985
6243
  const goToStart = () => setScreen("start");
5986
6244
  const goToSettings = () => setScreen("settings");
@@ -5988,6 +6246,7 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
5988
6246
  setProjectPath(void 0);
5989
6247
  setTokensPath(void 0);
5990
6248
  setScannedFiles(void 0);
6249
+ setPendingLaunch(void 0);
5991
6250
  };
5992
6251
  const finishImportResult = () => {
5993
6252
  setShowImportResult(false);
@@ -6000,13 +6259,13 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
6000
6259
  };
6001
6260
  switch (screen) {
6002
6261
  case "import":
6003
- if (showImportResult) return /* @__PURE__ */ jsx14(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
6004
- if (importDefaults === void 0) return /* @__PURE__ */ jsx14(Fragment5, {});
6262
+ if (showImportResult) return /* @__PURE__ */ jsx18(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
6263
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx18(Fragment5, {});
6005
6264
  if (projectPath === void 0) {
6006
- return /* @__PURE__ */ jsx14(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
6265
+ return /* @__PURE__ */ jsx18(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
6007
6266
  }
6008
6267
  if (tokensPath === void 0) {
6009
- return /* @__PURE__ */ jsx14(
6268
+ return /* @__PURE__ */ jsx18(
6010
6269
  TokenInputScreen,
6011
6270
  {
6012
6271
  initialPath: importDefaults.tokenFile,
@@ -6016,7 +6275,7 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
6016
6275
  );
6017
6276
  }
6018
6277
  if (scannedFiles === void 0) {
6019
- return /* @__PURE__ */ jsx14(
6278
+ return /* @__PURE__ */ jsx18(
6020
6279
  PathValidationScreen,
6021
6280
  {
6022
6281
  projectPath,
@@ -6026,7 +6285,19 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
6026
6285
  }
6027
6286
  );
6028
6287
  }
6029
- return /* @__PURE__ */ jsx14(
6288
+ if (pendingLaunch?.cached) {
6289
+ return /* @__PURE__ */ jsx18(
6290
+ TokenReuseScreen,
6291
+ {
6292
+ tokensPath: pendingLaunch.cached.tokensPath,
6293
+ sourceChanged: pendingLaunch.cached.sourceChanged,
6294
+ onReuse: () => chooseTokenStrategy(pendingLaunch, "reuse"),
6295
+ onRegenerate: () => chooseTokenStrategy(pendingLaunch, "regenerate"),
6296
+ onQuit: leaveImport
6297
+ }
6298
+ );
6299
+ }
6300
+ return /* @__PURE__ */ jsx18(
6030
6301
  CredentialsScreen,
6031
6302
  {
6032
6303
  initial: importDefaults.credentials,
@@ -6035,25 +6306,25 @@ function App({ importOptions, onLaunchImport, importExitCode }) {
6035
6306
  }
6036
6307
  );
6037
6308
  case "help":
6038
- return /* @__PURE__ */ jsx14(HelpScreen, { onDone: goToStart });
6309
+ return /* @__PURE__ */ jsx18(HelpScreen, { onDone: goToStart });
6039
6310
  case "upgrade":
6040
- return /* @__PURE__ */ jsx14(UpgradeScreen, { onDone: goToStart });
6311
+ return /* @__PURE__ */ jsx18(UpgradeScreen, { onDone: goToStart });
6041
6312
  case "settings":
6042
- return /* @__PURE__ */ jsx14(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
6313
+ return /* @__PURE__ */ jsx18(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
6043
6314
  case "settings-configuration":
6044
- return /* @__PURE__ */ jsx14(ConfigurationScreen, { onDone: goToSettings });
6315
+ return /* @__PURE__ */ jsx18(ConfigurationScreen, { onDone: goToSettings });
6045
6316
  case "settings-opt-in-analytics":
6046
- return /* @__PURE__ */ jsx14(OptInAnalyticsScreen, { onDone: goToSettings });
6317
+ return /* @__PURE__ */ jsx18(OptInAnalyticsScreen, { onDone: goToSettings });
6047
6318
  case "settings-debug-mode":
6048
- return /* @__PURE__ */ jsx14(DebugModeScreen, { onDone: goToSettings });
6319
+ return /* @__PURE__ */ jsx18(DebugModeScreen, { onDone: goToSettings });
6049
6320
  case "start":
6050
- return /* @__PURE__ */ jsx14(HomeScreen, { onNavigate: setScreen });
6321
+ return /* @__PURE__ */ jsx18(HomeScreen, { onNavigate: setScreen });
6051
6322
  }
6052
6323
  }
6053
6324
  async function renderUntilImportRequestedOrExit(renderApp, importOptions, importExitCode) {
6054
6325
  let requestedImport;
6055
6326
  const instance = renderApp(
6056
- /* @__PURE__ */ jsx14(
6327
+ /* @__PURE__ */ jsx18(
6057
6328
  App,
6058
6329
  {
6059
6330
  importOptions,
@@ -6088,14 +6359,16 @@ var init_app = __esm({
6088
6359
  init_home();
6089
6360
  init_PageContainer();
6090
6361
  init_steps();
6362
+ init_logic8();
6363
+ init_resolve_user_path();
6091
6364
  init_spawn_v1_import();
6092
6365
  init_terminal_input();
6093
6366
  init_PageContainer2();
6094
6367
  init_PageContainer3();
6095
6368
  init_ContentfulConfigScreen();
6096
- init_screen5();
6097
- init_PageContainer4();
6098
6369
  init_screen6();
6370
+ init_PageContainer4();
6371
+ init_screen7();
6099
6372
  init_config_store();
6100
6373
  CLEAR_SCREEN = "\x1B[2J\x1B[H";
6101
6374
  }
@@ -6103,7 +6376,7 @@ var init_app = __esm({
6103
6376
 
6104
6377
  // packages/experience-design-system-cli/program.ts
6105
6378
  import { readFileSync as readFileSync4 } from "node:fs";
6106
- import { join as join7 } from "node:path";
6379
+ import { join as join9 } from "node:path";
6107
6380
  import { Command } from "commander";
6108
6381
 
6109
6382
  // packages/experience-design-system-cli/src/legacy/run-legacy.ts
@@ -6213,7 +6486,7 @@ function registerImportCommand(program, openTui) {
6213
6486
  init_package_root();
6214
6487
  var pkg = JSON.parse(
6215
6488
  readFileSync4(
6216
- join7(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
6489
+ join9(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
6217
6490
  "utf8"
6218
6491
  )
6219
6492
  );
@@ -6233,7 +6506,7 @@ init_config();
6233
6506
  init_package_root();
6234
6507
  import { existsSync as existsSync5 } from "node:fs";
6235
6508
  import { mkdir as mkdir3, readFile as readFile2, rename as rename2, rmdir, unlink } from "node:fs/promises";
6236
- import { dirname as dirname3, join as join8 } from "node:path";
6509
+ import { dirname as dirname3, join as join10 } from "node:path";
6237
6510
  var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
6238
6511
  async function readJson(path5) {
6239
6512
  try {
@@ -6244,9 +6517,9 @@ async function readJson(path5) {
6244
6517
  }
6245
6518
  async function migrateOldConfig() {
6246
6519
  try {
6247
- const oldCredentials = join8(oldConfigDir2(), "credentials.json");
6248
- const oldRuns = join8(oldConfigDir2(), "runs.json");
6249
- const oldDebugMode = join8(
6520
+ const oldCredentials = join10(oldConfigDir2(), "credentials.json");
6521
+ const oldRuns = join10(oldConfigDir2(), "runs.json");
6522
+ const oldDebugMode = join10(
6250
6523
  findPackageRoot(import.meta.url, PACKAGE_NAME4),
6251
6524
  ".contentful",
6252
6525
  "config",