@contentful/experience-design-system-cli 2.37.1-dev-build-1e90e088.0 → 2.37.1-dev-build-f57f8147.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/app.js CHANGED
@@ -837,7 +837,7 @@ async function runAgent(options) {
837
837
  promptLen: prompt.length,
838
838
  promptHead: prompt.slice(0, 500)
839
839
  });
840
- return new Promise((resolve26) => {
840
+ return new Promise((resolve27) => {
841
841
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
842
842
  const child = spawn(binary, args, {
843
843
  stdio: ["pipe", "pipe", "pipe"],
@@ -886,7 +886,7 @@ async function runAgent(options) {
886
886
  stderrLen: stderr.length,
887
887
  stderrTail: stderr.slice(-1e3)
888
888
  });
889
- resolve26(result);
889
+ resolve27(result);
890
890
  });
891
891
  });
892
892
  }
@@ -908,7 +908,7 @@ async function checkAgentAuth(agent) {
908
908
  return "not-found";
909
909
  if (agent !== "claude")
910
910
  return "ok";
911
- return new Promise((resolve26) => {
911
+ return new Promise((resolve27) => {
912
912
  const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
913
913
  let stdout = "";
914
914
  let done = false;
@@ -917,7 +917,7 @@ async function checkAgentAuth(agent) {
917
917
  return;
918
918
  done = true;
919
919
  child.kill("SIGTERM");
920
- resolve26("unauthenticated");
920
+ resolve27("unauthenticated");
921
921
  }, 5e3);
922
922
  child.stdout?.on("data", (chunk) => {
923
923
  stdout += chunk.toString();
@@ -928,14 +928,14 @@ async function checkAgentAuth(agent) {
928
928
  done = true;
929
929
  clearTimeout(timer);
930
930
  if (code !== 0) {
931
- resolve26("unauthenticated");
931
+ resolve27("unauthenticated");
932
932
  return;
933
933
  }
934
934
  try {
935
935
  const status = JSON.parse(stdout);
936
- resolve26(status.loggedIn ? "ok" : "unauthenticated");
936
+ resolve27(status.loggedIn ? "ok" : "unauthenticated");
937
937
  } catch {
938
- resolve26("unauthenticated");
938
+ resolve27("unauthenticated");
939
939
  }
940
940
  });
941
941
  });
@@ -945,9 +945,9 @@ async function binaryIsOnPath(binary) {
945
945
  const fs = await import("node:fs/promises");
946
946
  return fs.access(binary).then(() => true, () => false);
947
947
  }
948
- return new Promise((resolve26) => {
948
+ return new Promise((resolve27) => {
949
949
  const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
950
- child.on("close", (code) => resolve26(code === 0));
950
+ child.on("close", (code) => resolve27(code === 0));
951
951
  });
952
952
  }
953
953
  var init_check_agent_auth = __esm({
@@ -2141,11 +2141,12 @@ __export(debug_store_exports, {
2141
2141
  currentSessionDir: () => currentSessionDir,
2142
2142
  finishDebugRun: () => finishDebugRun,
2143
2143
  startDebugRun: () => startDebugRun,
2144
- startDebugSessionIn: () => startDebugSessionIn
2144
+ startDebugSessionIn: () => startDebugSessionIn,
2145
+ startImportRun: () => startImportRun
2145
2146
  });
2146
- import { mkdir as mkdir8, writeFile as writeFile7 } from "node:fs/promises";
2147
- import { existsSync as existsSync9, readdirSync as readdirSync3 } from "node:fs";
2148
- import { join as join20, resolve as resolve23 } from "node:path";
2147
+ import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
2148
+ import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
2149
+ import { join as join24, resolve as resolve26 } from "node:path";
2149
2150
  function generateRunId() {
2150
2151
  const now = /* @__PURE__ */ new Date();
2151
2152
  const pad = (n) => String(n).padStart(2, "0");
@@ -2161,14 +2162,14 @@ function slugify(value) {
2161
2162
  async function readBaseDir() {
2162
2163
  try {
2163
2164
  const dir = (await readSettings2())["contentfulBaseDir"];
2164
- return typeof dir === "string" && dir !== "" ? resolve23(dir) : void 0;
2165
+ return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
2165
2166
  } catch {
2166
2167
  return void 0;
2167
2168
  }
2168
2169
  }
2169
2170
  function nextSessionId(contentfulDir) {
2170
2171
  const today = datePrefix();
2171
- const existing = existsSync9(contentfulDir) ? readdirSync3(contentfulDir) : [];
2172
+ const existing = existsSync9(contentfulDir) ? readdirSync4(contentfulDir) : [];
2172
2173
  const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
2173
2174
  const maxSeq = existing.reduce((max, entry) => {
2174
2175
  const match2 = seqPattern.exec(entry);
@@ -2177,12 +2178,12 @@ function nextSessionId(contentfulDir) {
2177
2178
  return `${today}-session-${maxSeq + 1}`;
2178
2179
  }
2179
2180
  function startSession(base, { replace }) {
2180
- const contentfulDir = join20(base, ".contentful");
2181
- if (replace || !sessionDir) sessionDir = join20(contentfulDir, nextSessionId(contentfulDir));
2181
+ const contentfulDir = join24(base, ".contentful");
2182
+ if (replace || !sessionDir) sessionDir = join24(contentfulDir, nextSessionId(contentfulDir));
2182
2183
  return sessionDir;
2183
2184
  }
2184
2185
  function currentDebugSessionDir() {
2185
- return sessionDir && join20(sessionDir, "debug");
2186
+ return sessionDir && join24(sessionDir, "debug");
2186
2187
  }
2187
2188
  function currentSessionDir() {
2188
2189
  return sessionDir;
@@ -2190,10 +2191,25 @@ function currentSessionDir() {
2190
2191
  async function startDebugSessionIn(base, { replace = false } = {}) {
2191
2192
  try {
2192
2193
  if (!await isDebugModeEnabled()) return;
2193
- await mkdir8(join20(startSession(resolve23(base), { replace }), "debug"), { recursive: true });
2194
+ await mkdir9(join24(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
2194
2195
  } catch {
2195
2196
  }
2196
2197
  }
2198
+ function nextImportRunDir(session) {
2199
+ const existing = existsSync9(session) ? readdirSync4(session) : [];
2200
+ const maxRun = existing.reduce((max, entry) => {
2201
+ const match2 = /^dsi-import-(\d+)$/.exec(entry);
2202
+ return match2 ? Math.max(max, Number(match2[1])) : max;
2203
+ }, 0);
2204
+ return join24(session, `dsi-import-${maxRun + 1}`);
2205
+ }
2206
+ async function startImportRun(projectPath) {
2207
+ await startDebugSessionIn(projectPath);
2208
+ if (!sessionDir) return join24(resolve26(projectPath), ".contentful");
2209
+ const dir = nextImportRunDir(sessionDir);
2210
+ await mkdir9(dir, { recursive: true });
2211
+ return dir;
2212
+ }
2197
2213
  async function isDebugModeEnabled() {
2198
2214
  try {
2199
2215
  return (await readDebugModeSetting()).enabled;
@@ -2236,15 +2252,15 @@ async function finishDebugRun({
2236
2252
  const root = currentDebugSessionDir();
2237
2253
  if (!root) return;
2238
2254
  const flowSegments = run.flow.split("/");
2239
- const dir = join20(root, ...flowSegments);
2240
- await mkdir8(dir, { recursive: true });
2255
+ const dir = join24(root, ...flowSegments);
2256
+ await mkdir9(dir, { recursive: true });
2241
2257
  const filename = nextAttemptFilename(dir, run.menuOption);
2242
- await writeFile7(join20(dir, filename), content, { mode: 384 });
2258
+ await writeFile8(join24(dir, filename), content, { mode: 384 });
2243
2259
  }
2244
2260
  function nextAttemptFilename(dir, menuOption) {
2245
2261
  const today = datePrefix();
2246
2262
  const optionSlug = slugify(menuOption);
2247
- const existing = existsSync9(dir) ? readdirSync3(dir) : [];
2263
+ const existing = existsSync9(dir) ? readdirSync4(dir) : [];
2248
2264
  const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
2249
2265
  const maxAttempt = existing.reduce((max, entry) => {
2250
2266
  const match2 = attemptPattern.exec(entry);
@@ -2292,7 +2308,7 @@ var init_debug_store = __esm({
2292
2308
  init_debug_mode_store();
2293
2309
  void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
2294
2310
  if (!enabled || !base) return void 0;
2295
- return mkdir8(join20(startSession(base, { replace: false }), "debug"), { recursive: true });
2311
+ return mkdir9(join24(startSession(base, { replace: false }), "debug"), { recursive: true });
2296
2312
  });
2297
2313
  process.once("uncaughtException", (err) => {
2298
2314
  void handleCrash().finally(() => {
@@ -13754,7 +13770,7 @@ function errorMessage(error) {
13754
13770
  return error instanceof Error && error.message ? error.message : String(error);
13755
13771
  }
13756
13772
  function defaultSleep(delayMs) {
13757
- return new Promise((resolve26) => setTimeout(resolve26, delayMs));
13773
+ return new Promise((resolve27) => setTimeout(resolve27, delayMs));
13758
13774
  }
13759
13775
 
13760
13776
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
@@ -13995,7 +14011,7 @@ var ApiClient = class {
13995
14011
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
13996
14012
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
13997
14013
  const jitter = Math.random() * baseDelay * 0.15;
13998
- await new Promise((resolve26) => setTimeout(resolve26, baseDelay + jitter));
14014
+ await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
13999
14015
  }
14000
14016
  }
14001
14017
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -16108,7 +16124,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
16108
16124
  const message = error instanceof Error ? error.message : String(error);
16109
16125
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
16110
16126
  throw error;
16111
- await new Promise((resolve26) => setTimeout(resolve26, Math.min(250 * attempt, 2e3)));
16127
+ await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
16112
16128
  }
16113
16129
  }
16114
16130
  }
@@ -17280,11 +17296,34 @@ function RunningStep({
17280
17296
  }
17281
17297
 
17282
17298
  // packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
17283
- import { access as access5, stat as stat4 } from "node:fs/promises";
17299
+ import { access as access5, readdir as readdir2, stat as stat4 } from "node:fs/promises";
17284
17300
  import { join as join16 } from "node:path";
17285
- async function inspectTokens({ rawTokensPath, outDir, cache }) {
17301
+ async function findLatestTokens(contentfulDir) {
17302
+ const candidates = [join16(contentfulDir, "tokens.json")];
17303
+ try {
17304
+ for (const session of await readdir2(contentfulDir, { withFileTypes: true })) {
17305
+ if (!session.isDirectory()) continue;
17306
+ for (const run of await readdir2(join16(contentfulDir, session.name), { withFileTypes: true }).catch(() => [])) {
17307
+ if (run.isDirectory() && /^dsi-import-\d+$/.test(run.name)) {
17308
+ candidates.push(join16(contentfulDir, session.name, run.name, "tokens.json"));
17309
+ }
17310
+ }
17311
+ }
17312
+ } catch {
17313
+ }
17314
+ const found = [];
17315
+ for (const path5 of candidates) {
17316
+ try {
17317
+ found.push({ path: path5, mtimeMs: (await stat4(path5)).mtimeMs });
17318
+ } catch {
17319
+ }
17320
+ }
17321
+ return found.sort((a, b) => b.mtimeMs - a.mtimeMs)[0]?.path ?? null;
17322
+ }
17323
+ async function inspectTokens({ rawTokensPath, contentfulDir, cache }) {
17286
17324
  if (!cache) return { kind: "none" };
17287
- const tokensPath = join16(outDir, "tokens.json");
17325
+ const tokensPath = await findLatestTokens(contentfulDir);
17326
+ if (!tokensPath) return { kind: "none" };
17288
17327
  try {
17289
17328
  await access5(tokensPath);
17290
17329
  } catch {
@@ -17563,7 +17602,7 @@ var realDeps = {
17563
17602
  var fail = (step, message) => ({ ok: false, step, message });
17564
17603
  var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
17565
17604
  async function runExtraction(input, onProgress, deps = realDeps) {
17566
- const outDir = join19(resolve22(input.projectPath), ".contentful");
17605
+ const outDir = input.outDir ?? join19(resolve22(input.projectPath), ".contentful");
17567
17606
  let progress = initialProgress({
17568
17607
  hasCredentials: input.credentials !== null,
17569
17608
  hasRawTokens: input.rawTokensPath !== "",
@@ -17712,7 +17751,6 @@ function useExtraction(input) {
17712
17751
  reuseTokens: input.tokenStrategy === "reuse"
17713
17752
  })
17714
17753
  });
17715
- void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then((store) => store.startDebugSessionIn(input.projectPath));
17716
17754
  void runExtraction(input, (progress) => {
17717
17755
  if (current.current === input) setState({ status: "running", progress });
17718
17756
  }).then((result) => {
@@ -20599,7 +20637,7 @@ function GenerationScreen({
20599
20637
  import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
20600
20638
 
20601
20639
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
20602
- import { resolve as resolve24 } from "node:path";
20640
+ import { resolve as resolve23 } from "node:path";
20603
20641
 
20604
20642
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
20605
20643
  async function prepareMapTokens(input, generatedSessionId) {
@@ -20734,7 +20772,7 @@ async function buildMapTokensOptions(input) {
20734
20772
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
20735
20773
  if (mapOverride?.kind === "path") {
20736
20774
  await resolvePromptOverride(mapOverride);
20737
- prompt.skillPathOverride = resolve24(mapOverride.value);
20775
+ prompt.skillPathOverride = resolve23(mapOverride.value);
20738
20776
  }
20739
20777
  if (input.existingEntitiesPath) {
20740
20778
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -20782,7 +20820,7 @@ function useGeneration(input) {
20782
20820
  }
20783
20821
 
20784
20822
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
20785
- import { join as join21 } from "node:path";
20823
+ import { join as join20 } from "node:path";
20786
20824
  function buildFlowStart(input) {
20787
20825
  const { extraction, handoff, saved, generatePromptPath } = input;
20788
20826
  const credentials = extraction.credentials ?? {
@@ -20795,7 +20833,7 @@ function buildFlowStart(input) {
20795
20833
  handoff,
20796
20834
  agent: extraction.agent,
20797
20835
  projectPath: extraction.projectPath,
20798
- outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
20836
+ outDir: extraction.projectPath ? join20(extraction.projectPath, ".contentful") : "",
20799
20837
  rawTokensPath: extraction.rawTokensPath,
20800
20838
  credentials: {
20801
20839
  spaceId: credentials.spaceId,
@@ -26538,11 +26576,11 @@ function DoneStep({
26538
26576
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
26539
26577
  import { useState as useState24 } from "react";
26540
26578
  import { Box as Box37, Text as Text40 } from "ink";
26541
- import { readdirSync as readdirSync4 } from "node:fs";
26542
- import { dirname as dirname15, basename as basename6, join as join22 } from "node:path";
26579
+ import { readdirSync as readdirSync3 } from "node:fs";
26580
+ import { dirname as dirname15, basename as basename6, join as join21 } from "node:path";
26543
26581
 
26544
26582
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
26545
- import { resolve as resolve25 } from "node:path";
26583
+ import { resolve as resolve24 } from "node:path";
26546
26584
  import { homedir as homedir4 } from "node:os";
26547
26585
  function expandTilde(input) {
26548
26586
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -26556,7 +26594,7 @@ function normalizePath(input) {
26556
26594
  p = p.slice(1, -1);
26557
26595
  }
26558
26596
  p = expandTilde(p);
26559
- return resolve25(p);
26597
+ return resolve24(p);
26560
26598
  }
26561
26599
 
26562
26600
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
@@ -26579,19 +26617,19 @@ function autocomplete(partial) {
26579
26617
  const base = basename6(normalized);
26580
26618
  let entries;
26581
26619
  try {
26582
- entries = readdirSync4(dir);
26620
+ entries = readdirSync3(dir);
26583
26621
  } catch {
26584
26622
  return null;
26585
26623
  }
26586
26624
  const matches = entries.filter((e) => e.startsWith(base));
26587
26625
  if (matches.length === 0) return null;
26588
- if (matches.length === 1) return join22(dir, matches[0]);
26626
+ if (matches.length === 1) return join21(dir, matches[0]);
26589
26627
  let prefix = matches[0];
26590
26628
  for (const m of matches) {
26591
26629
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
26592
26630
  if (!prefix) break;
26593
26631
  }
26594
- return prefix.length > base.length ? join22(dir, prefix) : null;
26632
+ return prefix.length > base.length ? join21(dir, prefix) : null;
26595
26633
  }
26596
26634
  function PathPrompt({
26597
26635
  defaultPath,
@@ -27350,9 +27388,9 @@ import { useEffect as useEffect21, useRef as useRef13, useSyncExternalStore } fr
27350
27388
 
27351
27389
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
27352
27390
  import { appendFileSync, writeFileSync } from "node:fs";
27353
- import { mkdir as mkdir9 } from "node:fs/promises";
27391
+ import { mkdir as mkdir8 } from "node:fs/promises";
27354
27392
  import { tmpdir } from "node:os";
27355
- import { join as join24 } from "node:path";
27393
+ import { join as join23, resolve as resolve25 } from "node:path";
27356
27394
 
27357
27395
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
27358
27396
  function shouldBypassPreview(state) {
@@ -27696,8 +27734,8 @@ function pushFailure(e, deps) {
27696
27734
  }
27697
27735
 
27698
27736
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
27699
- import { writeFile as writeFile8 } from "node:fs/promises";
27700
- import { join as join23 } from "node:path";
27737
+ import { writeFile as writeFile7 } from "node:fs/promises";
27738
+ import { join as join22 } from "node:path";
27701
27739
 
27702
27740
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
27703
27741
  function nextStateAfterPrint(opts) {
@@ -27720,15 +27758,15 @@ function buildSavedCDF(components, tokens, opts = {}) {
27720
27758
  var realSaveDeps = () => ({
27721
27759
  openDb: openPipelineDb,
27722
27760
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
27723
- writeFile: (path5, contents) => writeFile8(path5, contents),
27761
+ writeFile: (path5, contents) => writeFile7(path5, contents),
27724
27762
  appendRun,
27725
27763
  buildSourceFingerprint,
27726
- sleep: (ms) => new Promise((resolve26) => setTimeout(resolve26, ms)),
27764
+ sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
27727
27765
  warn: (message) => process.stderr.write(message)
27728
27766
  });
27729
27767
  async function runPrintFiles(input, deps, onPatch) {
27730
27768
  onPatch({ step: "printing" });
27731
- const componentsPath = join23(input.outDir, "components.json");
27769
+ const componentsPath = join22(input.outDir, "components.json");
27732
27770
  try {
27733
27771
  const db = deps.openDb();
27734
27772
  let components = [];
@@ -27809,7 +27847,7 @@ var EMPTY_PUSH_RESULT = {
27809
27847
  };
27810
27848
 
27811
27849
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
27812
- var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
27850
+ var WIZARD_LOG = join23(tmpdir(), "experiences-import-wizard.log");
27813
27851
  function appendWizardLog(entry) {
27814
27852
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
27815
27853
  }
@@ -27817,9 +27855,6 @@ function startWizardLog() {
27817
27855
  writeFileSync(WIZARD_LOG, `--- experiences import session ${(/* @__PURE__ */ new Date()).toISOString()} ---
27818
27856
  `);
27819
27857
  }
27820
- async function realSessionDir() {
27821
- return (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).currentSessionDir();
27822
- }
27823
27858
  function realFlowDeps() {
27824
27859
  const log = (entry) => appendWizardLog(entry);
27825
27860
  return {
@@ -27835,14 +27870,13 @@ function realFlowDeps() {
27835
27870
  }
27836
27871
  },
27837
27872
  mkdir: async (path5) => {
27838
- await mkdir9(path5, { recursive: true });
27873
+ await mkdir8(path5, { recursive: true });
27839
27874
  },
27840
27875
  detectSaveConflict,
27841
27876
  buildTimestampedSubdir,
27842
27877
  rejectComponentsByName,
27843
27878
  log,
27844
- stderr: (text) => process.stderr.write(text),
27845
- sessionDir: realSessionDir
27879
+ stderr: (text) => process.stderr.write(text)
27846
27880
  };
27847
27881
  }
27848
27882
  function initialFlowState(start) {
@@ -27983,9 +28017,6 @@ function createFlowController(start, deps) {
27983
28017
  const startSave = (opts, patch = {}) => {
27984
28018
  pendingSave = opts;
27985
28019
  update({ ...patch, step: "path-prompt" });
27986
- void deps.sessionDir?.().then((session) => {
27987
- if (session && state.step === "path-prompt") update({ outDir: join24(session, "dsi-import") });
27988
- });
27989
28020
  };
27990
28021
  const proceedToWrite = async (path5) => {
27991
28022
  update({ outDir: path5 });
@@ -28058,7 +28089,7 @@ function createFlowController(start, deps) {
28058
28089
  },
28059
28090
  async submitPath(submitted) {
28060
28091
  await deps.mkdir(submitted);
28061
- if (await deps.detectSaveConflict(submitted)) {
28092
+ if (resolve25(submitted) !== resolve25(state.outDir) && await deps.detectSaveConflict(submitted)) {
28062
28093
  const subdir = deps.buildTimestampedSubdir(submitted);
28063
28094
  await deps.mkdir(subdir);
28064
28095
  await proceedToWrite(subdir);
@@ -28300,8 +28331,12 @@ var FIELD_LABELS = {
28300
28331
  host: "API Host",
28301
28332
  defaultComponentDir: "Default component directory",
28302
28333
  defaultTokenFile: "Default token file",
28303
- contentfulBaseDir: "Root Project Directory (where .contentful goes)"
28334
+ contentfulBaseDir: "Root Project Directory"
28304
28335
  };
28336
+ var FIELD_HINTS = {
28337
+ contentfulBaseDir: "(where .contentful goes)"
28338
+ };
28339
+ var LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
28305
28340
  function ConfigurationScreen({ onDone }) {
28306
28341
  const [stage, setStage] = useState29("loading");
28307
28342
  const [config, setConfig] = useState29(null);
@@ -28403,10 +28438,7 @@ function ConfigurationScreen({ onDone }) {
28403
28438
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
28404
28439
  return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
28405
28440
  /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
28406
- /* @__PURE__ */ jsxs45(Text46, { bold: isActive, children: [
28407
- FIELD_LABELS[field],
28408
- ":"
28409
- ] }),
28441
+ /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
28410
28442
  isActive && editing ? /* @__PURE__ */ jsx55(
28411
28443
  TextInput4,
28412
28444
  {
@@ -28415,7 +28447,8 @@ function ConfigurationScreen({ onDone }) {
28415
28447
  onSubmit: () => setEditing(false),
28416
28448
  mask: field === "cmaToken" ? "\u2022" : void 0
28417
28449
  }
28418
- ) : /* @__PURE__ */ jsx55(Text46, { children: display || /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" }) })
28450
+ ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
28451
+ FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
28419
28452
  ] }, field);
28420
28453
  }) }),
28421
28454
  notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
@@ -28705,7 +28738,7 @@ function App({ importOptions, inkClear }) {
28705
28738
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
28706
28739
  const state = await inspectTokens({
28707
28740
  rawTokensPath: tokens,
28708
- outDir: join25(resolveUserPath(projectPath2), ".contentful"),
28741
+ contentfulDir: join25(resolveUserPath(projectPath2), ".contentful"),
28709
28742
  cache: importOptions.cache
28710
28743
  });
28711
28744
  if (state.kind === "cached") {
@@ -28726,6 +28759,7 @@ function App({ importOptions, inkClear }) {
28726
28759
  const settings = await readSettings2();
28727
28760
  const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
28728
28761
  const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
28762
+ const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
28729
28763
  setExtractionRun({
28730
28764
  ...generatePromptPath ? { generatePromptPath } : {},
28731
28765
  // the later steps get the same agent, so they use what the stage used
@@ -28734,6 +28768,7 @@ function App({ importOptions, inkClear }) {
28734
28768
  tokenStrategy,
28735
28769
  input: {
28736
28770
  projectPath: resolveUserPath(launch.projectPath ?? ""),
28771
+ outDir,
28737
28772
  filePaths: launch.filePaths ?? [],
28738
28773
  rawTokensPath: launch.tokens ?? "",
28739
28774
  tokenStrategy,