@contentful/experience-design-system-cli 2.37.1-dev-build-91ca3bb8.0 → 2.37.1-dev-build-a7704a7f.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.
Files changed (183) hide show
  1. package/dist/app.js +248 -999
  2. package/dist/index.js +319 -1217
  3. package/dist/package.json +1 -1
  4. package/dist/src/tui/settings/contentful-configuration/ContentfulConfigScreen.d.ts +0 -1
  5. package/package.json +3 -3
  6. package/dist/src/commands/forwarded.d.ts +0 -2
  7. package/dist/src/legacy/forwarded-import-args.d.ts +0 -1
  8. package/dist/src/legacy/legacy-cli-path.d.ts +0 -1
  9. package/dist/src/legacy/run-legacy.d.ts +0 -1
  10. package/dist/src/tui/help/file-locations.d.ts +0 -23
  11. package/dist/src/tui/settings/agents/AgentDetail.d.ts +0 -13
  12. package/dist/src/tui/settings/agents/AgentScreens.d.ts +0 -11
  13. package/dist/src/tui/settings/agents/AgentStatusBadge.d.ts +0 -10
  14. package/dist/src/tui/settings/agents/agent-status.d.ts +0 -80
  15. package/dist/src/tui/settings/agents/agent-store.d.ts +0 -17
  16. package/dist/src/tui/settings/agents/apply-binary-overrides.d.ts +0 -13
  17. package/dist/src/tui/settings/contentful-configuration/ProjectConfigScreen.d.ts +0 -5
  18. package/dist/src/tui/settings/shared/FieldForm.d.ts +0 -35
  19. package/legacy/bin/cli.js +0 -58
  20. package/legacy/dist/package.json +0 -76
  21. package/legacy/dist/src/analytics/exit.d.ts +0 -4
  22. package/legacy/dist/src/analytics/index.d.ts +0 -3
  23. package/legacy/dist/src/analyze/composite-closure.d.ts +0 -26
  24. package/legacy/dist/src/analyze/composition/apply-mapping.d.ts +0 -22
  25. package/legacy/dist/src/analyze/composition/candidate-files.d.ts +0 -34
  26. package/legacy/dist/src/analyze/composition/composition-cache-key.d.ts +0 -18
  27. package/legacy/dist/src/analyze/composition/interchange-schema.d.ts +0 -17
  28. package/legacy/dist/src/analyze/composition/manifest-doc-evidence.d.ts +0 -49
  29. package/legacy/dist/src/analyze/composition/merge-edges.d.ts +0 -19
  30. package/legacy/dist/src/analyze/composition/parse-map-edges.d.ts +0 -16
  31. package/legacy/dist/src/analyze/composition/prompt-loader.d.ts +0 -3
  32. package/legacy/dist/src/analyze/composition/resolve-mapping-cli.d.ts +0 -10
  33. package/legacy/dist/src/analyze/composition/resolve-mapping.d.ts +0 -59
  34. package/legacy/dist/src/analyze/cycle-detection.d.ts +0 -27
  35. package/legacy/dist/src/analyze/extract-command.d.ts +0 -7
  36. package/legacy/dist/src/analyze/fuzzy-search.d.ts +0 -3
  37. package/legacy/dist/src/analyze/issue-inheritance.d.ts +0 -8
  38. package/legacy/dist/src/analyze/lineage.d.ts +0 -29
  39. package/legacy/dist/src/analyze/search-neighborhood.d.ts +0 -3
  40. package/legacy/dist/src/analyze/select/command.d.ts +0 -27
  41. package/legacy/dist/src/analyze/select/parser.d.ts +0 -6
  42. package/legacy/dist/src/analyze/select/persistence.d.ts +0 -22
  43. package/legacy/dist/src/analyze/select/preview-annotations.d.ts +0 -26
  44. package/legacy/dist/src/analyze/select/tui/LegacySelectApp.d.ts +0 -8
  45. package/legacy/dist/src/analyze/select/tui/components/ComponentDetail.d.ts +0 -19
  46. package/legacy/dist/src/analyze/select/tui/components/ComponentRationalePanel.d.ts +0 -10
  47. package/legacy/dist/src/analyze/select/tui/components/FieldEditor.d.ts +0 -67
  48. package/legacy/dist/src/analyze/select/tui/components/FinalizeDialog.d.ts +0 -22
  49. package/legacy/dist/src/analyze/select/tui/components/GotoBanner.d.ts +0 -31
  50. package/legacy/dist/src/analyze/select/tui/components/GroupedSidebar.d.ts +0 -94
  51. package/legacy/dist/src/analyze/select/tui/components/HelpOverlay.d.ts +0 -21
  52. package/legacy/dist/src/analyze/select/tui/components/HighlightedLine.d.ts +0 -9
  53. package/legacy/dist/src/analyze/select/tui/components/JsonEditor.d.ts +0 -10
  54. package/legacy/dist/src/analyze/select/tui/components/JsonPanel.d.ts +0 -11
  55. package/legacy/dist/src/analyze/select/tui/components/PreviewSummaryBar.d.ts +0 -8
  56. package/legacy/dist/src/analyze/select/tui/components/QuitDialog.d.ts +0 -8
  57. package/legacy/dist/src/analyze/select/tui/components/RationaleLine.d.ts +0 -21
  58. package/legacy/dist/src/analyze/select/tui/components/RationalePanel.d.ts +0 -15
  59. package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +0 -14
  60. package/legacy/dist/src/analyze/select/tui/components/Sidebar.d.ts +0 -29
  61. package/legacy/dist/src/analyze/select/tui/components/SourcePanel.d.ts +0 -11
  62. package/legacy/dist/src/analyze/select/tui/components/StatusBar.d.ts +0 -11
  63. package/legacy/dist/src/analyze/select/tui/components/TokenReviewPanel.d.ts +0 -30
  64. package/legacy/dist/src/analyze/select/tui/components/TopBar.d.ts +0 -10
  65. package/legacy/dist/src/analyze/select/tui/components/removed-components-text.d.ts +0 -7
  66. package/legacy/dist/src/analyze/select/tui/components/wrap-text.d.ts +0 -1
  67. package/legacy/dist/src/analyze/select/tui/hooks/list-scroll-input.d.ts +0 -13
  68. package/legacy/dist/src/analyze/select/tui/hooks/scroll-offset.d.ts +0 -30
  69. package/legacy/dist/src/analyze/select/tui/hooks/useImmediateInput.d.ts +0 -19
  70. package/legacy/dist/src/analyze/select/tui/hooks/useKeymap.d.ts +0 -24
  71. package/legacy/dist/src/analyze/select/tui/hooks/useSession.d.ts +0 -19
  72. package/legacy/dist/src/analyze/select/tui/hooks/useUndo.d.ts +0 -8
  73. package/legacy/dist/src/analyze/select/tui/theme.d.ts +0 -18
  74. package/legacy/dist/src/analyze/select/types.d.ts +0 -54
  75. package/legacy/dist/src/analyze/selection-cascade.d.ts +0 -3
  76. package/legacy/dist/src/analyze/slot-graph.d.ts +0 -11
  77. package/legacy/dist/src/apply/api-client.d.ts +0 -64
  78. package/legacy/dist/src/apply/command.d.ts +0 -43
  79. package/legacy/dist/src/apply/preview-utils.d.ts +0 -12
  80. package/legacy/dist/src/apply/tokens.d.ts +0 -1
  81. package/legacy/dist/src/apply/tui/ServerApplyView.d.ts +0 -34
  82. package/legacy/dist/src/apply/tui/ServerPreviewView.d.ts +0 -9
  83. package/legacy/dist/src/credentials-store.d.ts +0 -18
  84. package/legacy/dist/src/doctor/checks.d.ts +0 -5
  85. package/legacy/dist/src/doctor/command.d.ts +0 -2
  86. package/legacy/dist/src/doctor/report.d.ts +0 -7
  87. package/legacy/dist/src/generate/command.d.ts +0 -2
  88. package/legacy/dist/src/generate/tui/GenerateView.d.ts +0 -12
  89. package/legacy/dist/src/helpers/build-contentful-management-client.d.ts +0 -7
  90. package/legacy/dist/src/helpers/fetch-and-persist-existing-contentful-entities.d.ts +0 -29
  91. package/legacy/dist/src/helpers/fetch-existing-contentful-entities.d.ts +0 -11
  92. package/legacy/dist/src/helpers/find-nearly-matching-component.d.ts +0 -7
  93. package/legacy/dist/src/helpers/read-existing-contentful-entities-from-session.d.ts +0 -7
  94. package/legacy/dist/src/helpers/summarize-existing-contentful-entities.d.ts +0 -50
  95. package/legacy/dist/src/host-utils.d.ts +0 -3
  96. package/legacy/dist/src/index.d.ts +0 -1
  97. package/legacy/dist/src/index.js +0 -25166
  98. package/legacy/dist/src/lib/agent-definitions.d.ts +0 -14
  99. package/legacy/dist/src/lib/agent-model-options.d.ts +0 -15
  100. package/legacy/dist/src/lib/agent-output.d.ts +0 -5
  101. package/legacy/dist/src/lib/cli-errors.d.ts +0 -2
  102. package/legacy/dist/src/lib/cli-path.d.ts +0 -4
  103. package/legacy/dist/src/lib/command-options.d.ts +0 -3
  104. package/legacy/dist/src/lib/component-patch.d.ts +0 -12
  105. package/legacy/dist/src/lib/contentful-urls.d.ts +0 -15
  106. package/legacy/dist/src/lib/debug-logger.d.ts +0 -39
  107. package/legacy/dist/src/lib/debug-preamble.d.ts +0 -7
  108. package/legacy/dist/src/lib/error-parser.d.ts +0 -40
  109. package/legacy/dist/src/lib/path-exists.d.ts +0 -1
  110. package/legacy/dist/src/lib/prompt-overrides.d.ts +0 -38
  111. package/legacy/dist/src/lib/terminal-capabilities.d.ts +0 -29
  112. package/legacy/dist/src/lib/user-agent.d.ts +0 -7
  113. package/legacy/dist/src/map-tokens/apply.d.ts +0 -12
  114. package/legacy/dist/src/map-tokens/command.d.ts +0 -2
  115. package/legacy/dist/src/map-tokens/resolve-defaults.d.ts +0 -32
  116. package/legacy/dist/src/map-tokens/tui/MapTokensView.d.ts +0 -13
  117. package/legacy/dist/src/output/format.d.ts +0 -23
  118. package/legacy/dist/src/print/command.d.ts +0 -11
  119. package/legacy/dist/src/print/validate/tui/ValidateView.d.ts +0 -15
  120. package/legacy/dist/src/print/validate/validators/cdf-validator.d.ts +0 -2
  121. package/legacy/dist/src/print/validate/validators/dtcg-validator.d.ts +0 -2
  122. package/legacy/dist/src/print/validate/validators/format-errors.d.ts +0 -12
  123. package/legacy/dist/src/print/validate/validators/read-json-file.d.ts +0 -10
  124. package/legacy/dist/src/program.d.ts +0 -25
  125. package/legacy/dist/src/runs/fingerprint.d.ts +0 -36
  126. package/legacy/dist/src/runs/save-path-resolver.d.ts +0 -11
  127. package/legacy/dist/src/runs/store.d.ts +0 -65
  128. package/legacy/dist/src/session/cache-keys.d.ts +0 -22
  129. package/legacy/dist/src/session/core/cdf/cdf-mappers.d.ts +0 -3
  130. package/legacy/dist/src/session/core/components/derive-component-id.d.ts +0 -1
  131. package/legacy/dist/src/session/core/components/hash-component-shape.d.ts +0 -5
  132. package/legacy/dist/src/session/core/shared/index-rows-by-key.d.ts +0 -1
  133. package/legacy/dist/src/session/core/tokens/build-dtcg-groups.d.ts +0 -12
  134. package/legacy/dist/src/session/core/tokens/build-dtcg-tokens.d.ts +0 -3
  135. package/legacy/dist/src/session/core/tokens/hash-token-content.d.ts +0 -1
  136. package/legacy/dist/src/session/db.d.ts +0 -200
  137. package/legacy/dist/src/session/migration.d.ts +0 -2
  138. package/legacy/dist/src/session/repositories/sessions/read.d.ts +0 -11
  139. package/legacy/dist/src/session/repositories/sessions/write.d.ts +0 -3
  140. package/legacy/dist/src/session/repositories/shared/with-transaction.d.ts +0 -2
  141. package/legacy/dist/src/session/repositories/steps/read.d.ts +0 -2
  142. package/legacy/dist/src/session/repositories/steps/write.d.ts +0 -5
  143. package/legacy/dist/src/session/repositories/tokens/read.d.ts +0 -15
  144. package/legacy/dist/src/session/repositories/tokens/write.d.ts +0 -16
  145. package/legacy/dist/src/session/resolve-session-id.d.ts +0 -1
  146. package/legacy/dist/src/session/services/session-resolver.d.ts +0 -9
  147. package/legacy/dist/src/session/services/tokens/apply-tool-calls.d.ts +0 -8
  148. package/legacy/dist/src/session/services/tokens/replace-raw-prop-token-paths.d.ts +0 -3
  149. package/legacy/dist/src/session/services/tokens/replace-raw-token-name-paths.d.ts +0 -3
  150. package/legacy/dist/src/session/services/tokens/store-dtcg-tokens.d.ts +0 -3
  151. package/legacy/dist/src/session/session-id.d.ts +0 -1
  152. package/legacy/dist/src/session/source-excerpt.d.ts +0 -26
  153. package/legacy/dist/src/setup/SetupScreen.d.ts +0 -28
  154. package/legacy/dist/src/setup/SetupStepper.d.ts +0 -7
  155. package/legacy/dist/src/setup/command.d.ts +0 -3
  156. package/legacy/dist/src/setup/lib/checks.d.ts +0 -57
  157. package/legacy/dist/src/setup/lib/shell.d.ts +0 -12
  158. package/legacy/dist/src/setup/steps/CodingAgentScreen.d.ts +0 -20
  159. package/legacy/dist/src/setup/steps/ContentfulCredentialsScreen.d.ts +0 -11
  160. package/legacy/dist/src/setup/steps/StepLayout.d.ts +0 -20
  161. package/legacy/dist/src/setup/steps/preferences/AnalyticsScreen.d.ts +0 -5
  162. package/legacy/dist/src/setup/steps/preferences/BooleanInput.d.ts +0 -21
  163. package/legacy/dist/src/setup/steps/preferences/ColorPreferenceScreen.d.ts +0 -5
  164. package/legacy/dist/src/setup/steps/preferences/CustomPromptScreen.d.ts +0 -14
  165. package/legacy/dist/src/setup/steps/preferences/DebugLogsScreen.d.ts +0 -5
  166. package/legacy/dist/src/setup/steps/preferences/PreferencesMenu.d.ts +0 -26
  167. package/legacy/dist/src/setup/steps/prerequisites/PrerequisitesScreen.d.ts +0 -16
  168. package/legacy/dist/src/setup/steps/prerequisites/build.d.ts +0 -2
  169. package/legacy/dist/src/setup/steps/prerequisites/deps.d.ts +0 -33
  170. package/legacy/dist/src/setup/steps/prerequisites/index.d.ts +0 -4
  171. package/legacy/dist/src/setup/steps/prerequisites/node.d.ts +0 -2
  172. package/legacy/dist/src/setup/steps/prerequisites/pnpm.d.ts +0 -2
  173. package/legacy/dist/src/tui/CommandCompletionView.d.ts +0 -13
  174. package/legacy/dist/src/tui/render-with-goodbye.d.ts +0 -7
  175. package/legacy/dist/src/tui/use-terminal-size.d.ts +0 -6
  176. package/legacy/dist/src/tui/windowed-panel.d.ts +0 -37
  177. package/legacy/dist/src/types.d.ts +0 -2
  178. package/legacy/package.json +0 -85
  179. package/legacy/prompts/composition-edges.md +0 -11
  180. package/legacy/skills/generate-components.md +0 -612
  181. package/legacy/skills/generate-tokens.md +0 -194
  182. package/legacy/skills/map-tokens.md +0 -102
  183. package/legacy/skills/select-components.md +0 -235
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((resolve28) => {
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
- resolve28(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((resolve28) => {
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
- resolve28("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
- resolve28("unauthenticated");
931
+ resolve27("unauthenticated");
932
932
  return;
933
933
  }
934
934
  try {
935
935
  const status = JSON.parse(stdout);
936
- resolve28(status.loggedIn ? "ok" : "unauthenticated");
936
+ resolve27(status.loggedIn ? "ok" : "unauthenticated");
937
937
  } catch {
938
- resolve28("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((resolve28) => {
948
+ return new Promise((resolve27) => {
949
949
  const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
950
- child.on("close", (code) => resolve28(code === 0));
950
+ child.on("close", (code) => resolve27(code === 0));
951
951
  });
952
952
  }
953
953
  var init_check_agent_auth = __esm({
@@ -2329,8 +2329,8 @@ var init_debug_store = __esm({
2329
2329
  });
2330
2330
 
2331
2331
  // packages/experience-design-system-cli/app.tsx
2332
- import { join as join26 } from "node:path";
2333
- import { useEffect as useEffect28, useState as useState37 } from "react";
2332
+ import { join as join25 } from "node:path";
2333
+ import { useEffect as useEffect26, useState as useState33 } from "react";
2334
2334
 
2335
2335
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2336
2336
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -8431,10 +8431,10 @@ function extractVueSlotsFromSetup(options) {
8431
8431
  if (!body)
8432
8432
  return [];
8433
8433
  const slotsByName = /* @__PURE__ */ new Map();
8434
- for (const access7 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
8435
- if (access7.getExpression().getText() !== slotsName)
8434
+ for (const access6 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
8435
+ if (access6.getExpression().getText() !== slotsName)
8436
8436
  continue;
8437
- const slotName = access7.getName();
8437
+ const slotName = access6.getName();
8438
8438
  if (!slotsByName.has(slotName)) {
8439
8439
  slotsByName.set(slotName, {
8440
8440
  name: slotName,
@@ -13824,7 +13824,7 @@ function errorMessage(error) {
13824
13824
  return error instanceof Error && error.message ? error.message : String(error);
13825
13825
  }
13826
13826
  function defaultSleep(delayMs) {
13827
- return new Promise((resolve28) => setTimeout(resolve28, delayMs));
13827
+ return new Promise((resolve27) => setTimeout(resolve27, delayMs));
13828
13828
  }
13829
13829
 
13830
13830
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
@@ -14065,7 +14065,7 @@ var ApiClient = class {
14065
14065
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
14066
14066
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
14067
14067
  const jitter = Math.random() * baseDelay * 0.15;
14068
- await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
14068
+ await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
14069
14069
  }
14070
14070
  }
14071
14071
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -14550,7 +14550,6 @@ function readTokensFromPath2(request) {
14550
14550
  init_agents();
14551
14551
  init_agent_name();
14552
14552
  init_models();
14553
- init_binaries();
14554
14553
  init_is_agent_name();
14555
14554
  init_agent_supports_bedrock();
14556
14555
  init_check_agent_auth();
@@ -16375,7 +16374,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
16375
16374
  const message = error instanceof Error ? error.message : String(error);
16376
16375
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
16377
16376
  throw error;
16378
- await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
16377
+ await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
16379
16378
  }
16380
16379
  }
16381
16380
  }
@@ -28032,7 +28031,7 @@ var realSaveDeps = () => ({
28032
28031
  writeFile: (path5, contents) => writeFile7(path5, contents),
28033
28032
  appendRun,
28034
28033
  buildSourceFingerprint,
28035
- sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
28034
+ sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
28036
28035
  warn: (message) => process.stderr.write(message)
28037
28036
  });
28038
28037
  async function runPrintFiles(input, deps, onPatch) {
@@ -28422,44 +28421,12 @@ init_config();
28422
28421
  init_debug_store();
28423
28422
  init_debug_mode_store();
28424
28423
  init_version();
28425
-
28426
- // packages/experience-design-system-cli/src/tui/help/file-locations.ts
28427
- import { join as join25, resolve as resolve27 } from "node:path";
28428
- function describeFileLocations({
28429
- contentfulBaseDir,
28430
- debugModeEnabled,
28431
- currentSessionDir: currentSessionDir2
28432
- }) {
28433
- if (!debugModeEnabled) {
28434
- return {
28435
- debugLogs: "none while Debug Mode is off",
28436
- importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
28437
- };
28438
- }
28439
- const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
28440
- const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
28441
- return {
28442
- debugLogs: join25(session, "debug"),
28443
- importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
28444
- };
28445
- }
28446
-
28447
- // packages/experience-design-system-cli/src/tui/help/help-info.ts
28448
28424
  async function readHelpInfo() {
28449
- const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
28450
- const base = settings["contentfulBaseDir"];
28451
- const locations = describeFileLocations({
28452
- contentfulBaseDir: typeof base === "string" ? base : "",
28453
- debugModeEnabled: debugMode.enabled,
28454
- currentSessionDir: currentSessionDir()
28455
- });
28425
+ const debugMode = await readDebugModeSetting();
28456
28426
  return {
28457
28427
  storage: [
28458
28428
  { label: "Config folder", value: configRoot2() },
28459
- { label: "Settings file", value: configFilePath2() },
28460
- { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
28461
- { label: "Debug logs", value: locations.debugLogs },
28462
- { label: "Import files", value: locations.importFiles }
28429
+ { label: "Settings file", value: configFilePath2() }
28463
28430
  ],
28464
28431
  troubleshooting: [
28465
28432
  { label: "CLI version", value: readPackageVersion() },
@@ -28480,7 +28447,7 @@ function Section({ title, rows }) {
28480
28447
  return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
28481
28448
  /* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
28482
28449
  rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
28483
- /* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
28450
+ /* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
28484
28451
  /* @__PURE__ */ jsx53(Text44, { children: row.value })
28485
28452
  ] }, row.label))
28486
28453
  ] });
@@ -28580,776 +28547,15 @@ function SettingsScreen({
28580
28547
  }
28581
28548
 
28582
28549
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
28583
- import { useState as useState33 } from "react";
28584
- import { Box as Box48, Text as Text51, useInput as useInput14 } from "ink";
28585
-
28586
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
28587
- import { useEffect as useEffect23, useState as useState30 } from "react";
28588
- import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
28589
- init_debug_store();
28550
+ import { useEffect as useEffect22, useState as useState29 } from "react";
28551
+ import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
28552
+ import TextInput4 from "ink-text-input";
28590
28553
 
28591
28554
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
28592
28555
  init_config();
28593
28556
  var readV1Store = readSettings2;
28594
28557
  var writeV1Store = writeSettings2;
28595
28558
 
28596
- // packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
28597
- var DEFAULT_AGENT3 = "claude";
28598
- var AGENT_LABELS = {
28599
- claude: "Claude Code",
28600
- codex: "OpenAI Codex",
28601
- opencode: "OpenCode",
28602
- cursor: "Cursor",
28603
- copilot: "GitHub Copilot"
28604
- };
28605
- var AGENT_HINTS = {
28606
- claude: "claude",
28607
- codex: "codex",
28608
- opencode: "opencode",
28609
- cursor: "cursor-agent",
28610
- copilot: "copilot"
28611
- };
28612
- var asString = (value) => typeof value === "string" ? value : "";
28613
- function emptyAgents() {
28614
- return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
28615
- }
28616
- async function readAgentConfig() {
28617
- const store = await readV1Store();
28618
- const stored = asString(store["agent"]);
28619
- const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
28620
- const agents = emptyAgents();
28621
- const saved = store["agents"];
28622
- if (saved && typeof saved === "object") {
28623
- for (const name of AGENT_NAMES) {
28624
- const entry = saved[name];
28625
- if (entry && typeof entry === "object") {
28626
- const fields = entry;
28627
- agents[name] = { model: asString(fields["model"]), binary: asString(fields["binary"]) };
28628
- }
28629
- }
28630
- }
28631
- const legacyModel = asString(store["agentModel"]);
28632
- if (legacyModel && !agents[defaultAgent].model)
28633
- agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
28634
- return { defaultAgent, agents };
28635
- }
28636
- async function writeAgentConfig(config) {
28637
- const existing = await readV1Store();
28638
- const merged = { ...existing };
28639
- const agents = {};
28640
- for (const name of AGENT_NAMES) {
28641
- const model = config.agents[name].model.trim();
28642
- const binary = config.agents[name].binary.trim();
28643
- if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
28644
- }
28645
- merged["agent"] = config.defaultAgent;
28646
- const defaultModel = agents[config.defaultAgent]?.model;
28647
- if (defaultModel) merged["agentModel"] = defaultModel;
28648
- else delete merged["agentModel"];
28649
- if (Object.keys(agents).length > 0) merged["agents"] = agents;
28650
- else delete merged["agents"];
28651
- await writeV1Store(merged);
28652
- }
28653
-
28654
- // packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
28655
- import { execFile as execFile2 } from "node:child_process";
28656
- import { access as access6, constants } from "node:fs/promises";
28657
- var VERSION_TIMEOUT_MS = 5e3;
28658
- var PROMPT_TIMEOUT_MS = 6e4;
28659
- var TEST_PROMPT = "Reply with the single word: ok";
28660
- var INSTALL_HINTS = {
28661
- claude: "npm install -g @anthropic-ai/claude-code",
28662
- codex: "npm install -g @openai/codex",
28663
- opencode: "npm install -g opencode-ai",
28664
- cursor: "install Cursor\u2019s `cursor-agent` command",
28665
- copilot: "npm install -g @github/copilot"
28666
- };
28667
- var LOGIN_HINTS = {
28668
- claude: "run `claude login`",
28669
- codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
28670
- opencode: "run `opencode auth`",
28671
- cursor: "sign in from Cursor",
28672
- copilot: "run `copilot` and sign in"
28673
- };
28674
- function effectiveBinary(name, savedBinary) {
28675
- return savedBinary.trim() || AGENT_BINARIES[name];
28676
- }
28677
- function defaultModelLabel(name) {
28678
- const model = DEFAULT_MODELS[name];
28679
- return model && model !== "Auto" ? model : "chosen by the agent";
28680
- }
28681
- var fail3 = (step, detail) => ({ step, ok: false, detail });
28682
- var pass = (step, detail) => ({ step, ok: true, detail });
28683
- function resolveOnPath(binary) {
28684
- if (binary.includes("/")) {
28685
- return access6(binary, constants.X_OK).then(
28686
- () => binary,
28687
- () => null
28688
- );
28689
- }
28690
- return new Promise((resolve28) => {
28691
- execFile2(
28692
- process.platform === "win32" ? "where" : "which",
28693
- [binary],
28694
- (error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
28695
- );
28696
- });
28697
- }
28698
- function readVersion(binary) {
28699
- return new Promise((resolve28) => {
28700
- execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
28701
- const line = stdout.split("\n")[0]?.trim() ?? "";
28702
- if (!error && line) resolve28(pass("version", line));
28703
- else resolve28(fail3("version", "runs, but did not report a version"));
28704
- });
28705
- });
28706
- }
28707
- async function inspectAgent(name, binary) {
28708
- const target = effectiveBinary(name, binary);
28709
- const found = await resolveOnPath(target);
28710
- if (!found) return [fail3("path", `\`${target}\` was not found or is not executable`)];
28711
- const checks = [pass("path", found)];
28712
- checks.push(await readVersion(found));
28713
- if (name === "claude") {
28714
- const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
28715
- checks.push(
28716
- auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
28717
- );
28718
- }
28719
- return checks;
28720
- }
28721
- async function testAgent(name, binary, model) {
28722
- const checks = await inspectAgent(name, binary);
28723
- if (!checks.every((check) => check.step === "version" || check.ok)) return checks;
28724
- const target = effectiveBinary(name, binary);
28725
- const found = await resolveOnPath(target) ?? target;
28726
- const started = Date.now();
28727
- const result = await withBinaryEnv(
28728
- name,
28729
- found,
28730
- () => createLocalCliAgentInvoker().invoke({
28731
- agent: name,
28732
- ...model.trim() ? { model: model.trim() } : {},
28733
- prompt: TEST_PROMPT,
28734
- timeoutMs: PROMPT_TIMEOUT_MS
28735
- })
28736
- );
28737
- const seconds = ((Date.now() - started) / 1e3).toFixed(1);
28738
- if (result.timedOut) {
28739
- return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
28740
- }
28741
- if (result.exitCode !== 0) {
28742
- const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
28743
- return [...checks, fail3("prompt", reason)];
28744
- }
28745
- return [...checks, pass("prompt", `answered in ${seconds}s`)];
28746
- }
28747
- function statusFromChecks(name, checks, savedBinary) {
28748
- if (checks.length === 0) return "checking";
28749
- if (checks.some((check) => check.step === "path" && !check.ok)) {
28750
- return savedBinary.trim() ? "not-found" : "not-configured";
28751
- }
28752
- const prompt = checks.find((check) => check.step === "prompt");
28753
- if (prompt) {
28754
- if (prompt.ok) return "ready";
28755
- return prompt.timedOut ? "timed-out" : "test-failed";
28756
- }
28757
- const login = checks.find((check) => check.step === "login");
28758
- if (login) return login.ok ? "ready" : "not-logged-in";
28759
- return name === "claude" ? "ready" : "unknown";
28760
- }
28761
- function setupHint(name, status) {
28762
- if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
28763
- if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
28764
- if (status === "not-logged-in") return LOGIN_HINTS[name];
28765
- if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
28766
- if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
28767
- if (status === "unknown") return "run a full test to confirm it is logged in";
28768
- return "";
28769
- }
28770
- function testOutcome(checks) {
28771
- const prompt = checks?.find((check) => check.step === "prompt");
28772
- if (!prompt) return void 0;
28773
- if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
28774
- if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
28775
- return { ok: false, text: `Test failed: ${prompt.detail}` };
28776
- }
28777
- var LIST_STATUS = {
28778
- checking: { symbol: "\u2026", text: "checking", tone: "muted" },
28779
- ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
28780
- "not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
28781
- "not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
28782
- "not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
28783
- "test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
28784
- "timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
28785
- unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
28786
- };
28787
- function modelLine(name, savedModel) {
28788
- const model = savedModel.trim();
28789
- return model ? model : `${defaultModelLabel(name)} (built-in default)`;
28790
- }
28791
- function panelRows(name, checks, settings) {
28792
- if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
28793
- const status = statusFromChecks(name, checks, settings.binary);
28794
- const path5 = checks.find((check) => check.step === "path");
28795
- if (!path5?.ok) {
28796
- const rows2 = [
28797
- {
28798
- label: "Command",
28799
- value: settings.binary.trim() ? path5?.detail ?? "not found" : "not found on your PATH",
28800
- tone: settings.binary.trim() ? "bad" : "muted"
28801
- }
28802
- ];
28803
- const hint2 = setupHint(name, status);
28804
- if (hint2) rows2.push({ label: "Setup", value: hint2, tone: "muted" });
28805
- return rows2;
28806
- }
28807
- const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
28808
- const version = checks.find((check) => check.step === "version");
28809
- if (version?.ok) rows.push({ label: "Version", value: version.detail, tone: "ok" });
28810
- rows.push({ label: "Model", value: modelLine(name, settings.model), tone: "muted" });
28811
- const hint = setupHint(name, status);
28812
- if (hint) rows.push({ label: "Setup", value: hint, tone: "muted" });
28813
- return rows;
28814
- }
28815
- function statusRows(_name, checks, savedBinary) {
28816
- if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
28817
- const find = (step) => checks.find((check) => check.step === step);
28818
- const path5 = find("path");
28819
- if (!path5?.ok) {
28820
- if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
28821
- return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
28822
- }
28823
- const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
28824
- const version = find("version");
28825
- if (version) {
28826
- rows.push({
28827
- label: "Version",
28828
- value: version.ok ? version.detail : "could not be read",
28829
- tone: version.ok ? "ok" : "muted"
28830
- });
28831
- }
28832
- const login = find("login");
28833
- const prompt = find("prompt");
28834
- if (login) {
28835
- rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
28836
- } else if (prompt) {
28837
- rows.push({
28838
- label: "Login",
28839
- value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
28840
- tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
28841
- });
28842
- } else {
28843
- rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
28844
- }
28845
- if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
28846
- return rows;
28847
- }
28848
- async function withBinaryEnv(name, binary, run) {
28849
- const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
28850
- const previous = process.env[key];
28851
- process.env[key] = binary;
28852
- try {
28853
- return await run();
28854
- } finally {
28855
- if (previous === void 0) delete process.env[key];
28856
- else process.env[key] = previous;
28857
- }
28858
- }
28859
-
28860
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
28861
- import { useEffect as useEffect22, useState as useState29 } from "react";
28862
- import { Box as Box44, Text as Text47, useInput as useInput11 } from "ink";
28863
- import TextInput4 from "ink-text-input";
28864
-
28865
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
28866
- import { Text as Text46 } from "ink";
28867
- import { jsx as jsx55 } from "react/jsx-runtime";
28868
- var TONE_COLOR = {
28869
- ok: PALETTE.success,
28870
- bad: PALETTE.error,
28871
- muted: PALETTE.muted
28872
- };
28873
- function AgentStatusBadge({
28874
- name,
28875
- checks,
28876
- binary
28877
- }) {
28878
- const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
28879
- return /* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
28880
- }
28881
-
28882
- // packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts
28883
- var shellValues = /* @__PURE__ */ new Map();
28884
- function applyBinaryOverrides(config) {
28885
- for (const name of AGENT_NAMES) {
28886
- const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
28887
- const binary = config.agents[name].binary.trim();
28888
- if (binary) {
28889
- if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
28890
- process.env[key] = binary;
28891
- } else if (shellValues.has(key)) {
28892
- const shellValue = shellValues.get(key);
28893
- if (shellValue === void 0) delete process.env[key];
28894
- else process.env[key] = shellValue;
28895
- shellValues.delete(key);
28896
- }
28897
- }
28898
- }
28899
-
28900
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
28901
- import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
28902
- var FOCUS_ORDER = ["binary", "model", "test"];
28903
- var FIELDS2 = ["binary", "model"];
28904
- var FIELD_LABEL = { binary: "Command path", model: "Model" };
28905
- var LABEL_WIDTH = "Command path".length;
28906
- var LABEL_GAP = 2;
28907
- var POINTER_WIDTH = 2;
28908
- var fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
28909
- function Row2({
28910
- pointer,
28911
- label,
28912
- labelProps,
28913
- children
28914
- }) {
28915
- return /* @__PURE__ */ jsxs45(Box44, { children: [
28916
- /* @__PURE__ */ jsx56(Box44, { width: POINTER_WIDTH, flexShrink: 0, children: pointer }),
28917
- /* @__PURE__ */ jsx56(Box44, { width: LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, ...labelProps, children: label }) }),
28918
- children
28919
- ] });
28920
- }
28921
- function Section2({
28922
- title,
28923
- note,
28924
- interactive = false,
28925
- children
28926
- }) {
28927
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
28928
- /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
28929
- /* @__PURE__ */ jsx56(Text47, { bold: true, color: interactive ? PALETTE.accent : PALETTE.muted, children: title }),
28930
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: `\xB7 ${note}` })
28931
- ] }),
28932
- children
28933
- ] });
28934
- }
28935
- function AgentDetail({
28936
- name,
28937
- config,
28938
- setConfig,
28939
- onBack
28940
- }) {
28941
- const settings = config.agents[name];
28942
- const [focusIndex, setFocusIndex] = useState29(0);
28943
- const [editing, setEditing] = useState29(false);
28944
- const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
28945
- const [saving, setSaving] = useState29(false);
28946
- const [testing, setTesting] = useState29(false);
28947
- const [notice, setNotice] = useState29(null);
28948
- const [checks, setChecks] = useState29(void 0);
28949
- useEffect22(() => {
28950
- let active = true;
28951
- setChecks(void 0);
28952
- void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
28953
- return () => {
28954
- active = false;
28955
- };
28956
- }, [name, settings.binary]);
28957
- const setField = (field, value) => {
28958
- setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
28959
- setNotice(null);
28960
- };
28961
- const save = () => {
28962
- setSaving(true);
28963
- setNotice(null);
28964
- writeAgentConfig(config).then(() => {
28965
- applyBinaryOverrides(config);
28966
- setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
28967
- }).catch(
28968
- (err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
28969
- ).finally(() => setSaving(false));
28970
- };
28971
- const runTest = () => {
28972
- setTesting(true);
28973
- setNotice(null);
28974
- testAgent(name, settings.binary, settings.model).then((result) => {
28975
- setChecks(result);
28976
- const outcome = testOutcome(result);
28977
- setNotice(
28978
- outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
28979
- );
28980
- }).catch(
28981
- (err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
28982
- ).finally(() => setTesting(false));
28983
- };
28984
- const focused = FOCUS_ORDER[focusIndex];
28985
- const focusedField = focused === "test" ? null : focused;
28986
- useInput11((input, key) => {
28987
- if (saving || testing) return;
28988
- if (editing) {
28989
- if (key.escape && focusedField) {
28990
- setField(focusedField, valueBeforeEdit);
28991
- setEditing(false);
28992
- }
28993
- return;
28994
- }
28995
- if (key.escape || input === "q") {
28996
- onBack();
28997
- return;
28998
- }
28999
- if (input === "s") {
29000
- save();
29001
- return;
29002
- }
29003
- if (key.upArrow) {
29004
- setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
29005
- return;
29006
- }
29007
- if (key.downArrow || key.tab) {
29008
- setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
29009
- return;
29010
- }
29011
- if (input === "c" && focusedField) {
29012
- setField(focusedField, "");
29013
- return;
29014
- }
29015
- if (key.return) {
29016
- if (focusedField) {
29017
- setValueBeforeEdit(settings[focusedField]);
29018
- setEditing(true);
29019
- } else {
29020
- runTest();
29021
- }
29022
- }
29023
- });
29024
- const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
29025
- const hint = setupHint(name, status);
29026
- const pointer = (isFocused) => /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
29027
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29028
- /* @__PURE__ */ jsx56(Text47, { bold: true, children: AGENT_LABELS[name] }),
29029
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
29030
- (notice || testing || saving) && /* @__PURE__ */ jsx56(Box44, { marginTop: 1, children: testing || saving ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: testing ? "\u2026 Running the test (up to 60s)" : "\u2026 Saving" }) : notice && /* @__PURE__ */ jsxs45(Text47, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
29031
- notice.kind === "success" ? "\u2713" : "\u2717",
29032
- " ",
29033
- notice.text
29034
- ] }) }),
29035
- /* @__PURE__ */ jsxs45(Section2, { title: "CONFIGURE", note: "you can change these", interactive: true, children: [
29036
- FIELDS2.map((field) => {
29037
- const isFocused = focused === field;
29038
- const value = settings[field];
29039
- const display = isFocused && editing ? /* @__PURE__ */ jsx56(TextInput4, { value, onChange: (next) => setField(field, next), onSubmit: () => setEditing(false) }) : value ? /* @__PURE__ */ jsx56(Text47, { bold: true, children: value }) : /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: fieldHint(name, field) });
29040
- return /* @__PURE__ */ jsx56(
29041
- Row2,
29042
- {
29043
- pointer: pointer(isFocused),
29044
- label: FIELD_LABEL[field],
29045
- labelProps: { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted },
29046
- children: display
29047
- },
29048
- field
29049
- );
29050
- }),
29051
- /* @__PURE__ */ jsx56(
29052
- Row2,
29053
- {
29054
- pointer: pointer(focused === "test"),
29055
- label: "Run test",
29056
- labelProps: { bold: focused === "test", color: focused === "test" ? PALETTE.accent : PALETTE.muted },
29057
- children: /* @__PURE__ */ jsx56(Text47, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
29058
- }
29059
- )
29060
- ] }),
29061
- /* @__PURE__ */ jsxs45(Section2, { title: "STATUS", note: "read only", children: [
29062
- statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx56(Row2, { pointer: null, label: row.label, children: /* @__PURE__ */ jsx56(Text47, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label)),
29063
- hint && /* @__PURE__ */ jsx56(Row2, { pointer: null, label: "Setup", children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: hint }) })
29064
- ] }),
29065
- /* @__PURE__ */ jsx56(Text47, { children: " " }),
29066
- /* @__PURE__ */ jsx56(
29067
- ControlHints,
29068
- {
29069
- hints: editing ? [
29070
- { keys: "type", label: "edit" },
29071
- { keys: "\u2190/\u2192", label: "move cursor" },
29072
- { keys: "\u23CE", label: "done" },
29073
- { keys: "Esc", label: "cancel edit" }
29074
- ] : [
29075
- { keys: "\u2191/\u2193", label: "move" },
29076
- { keys: "\u23CE", label: focusedField ? "edit" : "run test" },
29077
- ...focusedField ? [{ keys: "c", label: "clear" }] : [],
29078
- { keys: "s", label: "save" },
29079
- { keys: "Esc/q", label: "back without saving" }
29080
- ]
29081
- }
29082
- )
29083
- ] });
29084
- }
29085
-
29086
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
29087
- import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
29088
- var NAME_WIDTH = 16;
29089
- var PANEL_LABEL_WIDTH = "Command".length;
29090
- function AgentsScreen({ onDone }) {
29091
- const [config, setConfig] = useState30(null);
29092
- const [focus, setFocus] = useState30(0);
29093
- const [open, setOpen] = useState30(null);
29094
- const [notice, setNotice] = useState30(null);
29095
- const [saving, setSaving] = useState30(false);
29096
- const [checks, setChecks] = useState30({});
29097
- const inspectAll = (loaded) => {
29098
- for (const name of AGENT_NAMES) {
29099
- void inspectAgent(name, loaded.agents[name].binary).then(
29100
- (result) => setChecks((previous) => ({ ...previous, [name]: result }))
29101
- );
29102
- }
29103
- };
29104
- useEffect23(() => {
29105
- void readAgentConfig().then((loaded) => {
29106
- setConfig(loaded);
29107
- inspectAll(loaded);
29108
- startDebugRun({
29109
- flow: "settings/agents",
29110
- step: "01-agents",
29111
- menuOption: "Configuration > Agents",
29112
- inputs: { default_agent: loaded.defaultAgent }
29113
- });
29114
- });
29115
- }, []);
29116
- const makeDefault = (name) => {
29117
- if (!config || saving) return;
29118
- if (name === config.defaultAgent) {
29119
- setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
29120
- return;
29121
- }
29122
- setSaving(true);
29123
- setNotice(null);
29124
- writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
29125
- setConfig((current) => current ? { ...current, defaultAgent: name } : current);
29126
- setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
29127
- }).catch(
29128
- (err) => setNotice({
29129
- kind: "error",
29130
- text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
29131
- })
29132
- ).finally(() => setSaving(false));
29133
- };
29134
- useInput12((input, key) => {
29135
- if (!config || open || saving) return;
29136
- const focused = AGENT_NAMES[focus];
29137
- if (key.upArrow || key.downArrow || key.tab) setNotice(null);
29138
- if (key.upArrow) {
29139
- setFocus((i) => (i - 1 + AGENT_NAMES.length) % AGENT_NAMES.length);
29140
- return;
29141
- }
29142
- if (key.downArrow || key.tab) {
29143
- setFocus((i) => (i + 1) % AGENT_NAMES.length);
29144
- return;
29145
- }
29146
- if (key.return) {
29147
- makeDefault(focused);
29148
- return;
29149
- }
29150
- if (key.rightArrow) {
29151
- setNotice(null);
29152
- setOpen(focused);
29153
- return;
29154
- }
29155
- if (key.escape || input === "q") {
29156
- void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
29157
- onDone();
29158
- }
29159
- });
29160
- if (!config) {
29161
- return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29162
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
29163
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29164
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
29165
- ] });
29166
- }
29167
- if (open) {
29168
- return /* @__PURE__ */ jsx57(
29169
- AgentDetail,
29170
- {
29171
- name: open,
29172
- config,
29173
- setConfig,
29174
- onBack: () => {
29175
- setOpen(null);
29176
- void readAgentConfig().then((saved) => {
29177
- setConfig(saved);
29178
- inspectAll(saved);
29179
- });
29180
- }
29181
- }
29182
- );
29183
- }
29184
- const focusedAgent = AGENT_NAMES[focus];
29185
- return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29186
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
29187
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
29188
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29189
- /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
29190
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Default agent" }),
29191
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: AGENT_LABELS[config.defaultAgent] }),
29192
- saving && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "\u2026 saving" })
29193
- ] }),
29194
- /* @__PURE__ */ jsxs46(Box45, { marginTop: 1, gap: 1, children: [
29195
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29196
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29197
- /* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "AGENT" }) }),
29198
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "STATUS" })
29199
- ] }),
29200
- AGENT_NAMES.map((name) => {
29201
- const isFocused = focusedAgent === name;
29202
- return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
29203
- /* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
29204
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
29205
- /* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
29206
- /* @__PURE__ */ jsx57(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
29207
- ] }, name);
29208
- }),
29209
- /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
29210
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
29211
- panelRows(focusedAgent, checks[focusedAgent], config.agents[focusedAgent]).map((row) => /* @__PURE__ */ jsxs46(Box45, { gap: 1, paddingLeft: 1, children: [
29212
- /* @__PURE__ */ jsx57(Box45, { width: PANEL_LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: row.label }) }),
29213
- /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value })
29214
- ] }, row.label))
29215
- ] }),
29216
- notice && /* @__PURE__ */ jsxs46(Fragment17, { children: [
29217
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29218
- /* @__PURE__ */ jsxs46(Text48, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
29219
- notice.kind === "success" ? "\u2713" : "\u2717",
29220
- " ",
29221
- notice.text
29222
- ] })
29223
- ] }),
29224
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29225
- /* @__PURE__ */ jsx57(
29226
- ControlHints,
29227
- {
29228
- hints: [
29229
- { keys: "\u2191/\u2193", label: "move" },
29230
- { keys: "\u23CE", label: "make default" },
29231
- { keys: "\u2192", label: "settings and test" },
29232
- { keys: "Esc/q", label: "back" }
29233
- ]
29234
- }
29235
- )
29236
- ] });
29237
- }
29238
-
29239
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
29240
- import { useEffect as useEffect24, useState as useState32 } from "react";
29241
- import { Box as Box47, Text as Text50 } from "ink";
29242
- init_debug_store();
29243
-
29244
- // packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
29245
- import { useState as useState31 } from "react";
29246
- import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
29247
- import TextInput5 from "ink-text-input";
29248
- import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
29249
- function FieldForm({
29250
- title,
29251
- subtitle,
29252
- fields,
29253
- values,
29254
- onChange,
29255
- onSave,
29256
- onQuit,
29257
- notice,
29258
- busy = false,
29259
- footer
29260
- }) {
29261
- const [active, setActive] = useState31(0);
29262
- const [editing, setEditing] = useState31(false);
29263
- const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
29264
- const labelWidth = Math.max(...fields.map((field) => field.label.length));
29265
- const current = fields[active];
29266
- useInput13((input, key) => {
29267
- if (busy) return;
29268
- if (editing) {
29269
- if (key.escape) {
29270
- onChange(current.key, valueBeforeEdit);
29271
- setEditing(false);
29272
- }
29273
- return;
29274
- }
29275
- if (key.escape || input === "q") {
29276
- onQuit();
29277
- return;
29278
- }
29279
- if (input === "s") {
29280
- onSave();
29281
- return;
29282
- }
29283
- if (input === "c") {
29284
- onChange(current.key, "");
29285
- return;
29286
- }
29287
- if (key.tab || key.downArrow) {
29288
- setActive((i) => (i + 1) % fields.length);
29289
- return;
29290
- }
29291
- if (key.upArrow) {
29292
- setActive((i) => (i - 1 + fields.length) % fields.length);
29293
- return;
29294
- }
29295
- if (key.return) {
29296
- setValueBeforeEdit(values[current.key]);
29297
- setEditing(true);
29298
- }
29299
- });
29300
- return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29301
- /* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
29302
- subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
29303
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
29304
- /* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
29305
- const isActive = index === active;
29306
- const value = values[field.key];
29307
- const display = field.masked ? "\u2022".repeat(value.length) : value;
29308
- return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
29309
- /* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
29310
- /* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
29311
- isActive && editing ? /* @__PURE__ */ jsx58(
29312
- TextInput5,
29313
- {
29314
- value,
29315
- onChange: (next) => onChange(field.key, next),
29316
- onSubmit: () => setEditing(false),
29317
- mask: field.masked ? "\u2022" : void 0
29318
- }
29319
- ) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
29320
- field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
29321
- ] }, field.key);
29322
- }) }),
29323
- notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
29324
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
29325
- /* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
29326
- notice.kind === "success" ? "\u2713" : "\u2717",
29327
- " ",
29328
- notice.text
29329
- ] })
29330
- ] }),
29331
- footer,
29332
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
29333
- /* @__PURE__ */ jsx58(
29334
- ControlHints,
29335
- {
29336
- hints: editing ? [
29337
- { keys: "type", label: "edit" },
29338
- { keys: "\u2190/\u2192", label: "move cursor" },
29339
- { keys: "\u23CE", label: "done" },
29340
- { keys: "Esc", label: "cancel edit" }
29341
- ] : [
29342
- { keys: "\u2191/\u2193", label: "move" },
29343
- { keys: "\u23CE", label: "edit" },
29344
- { keys: "c", label: "clear" },
29345
- { keys: "s", label: "save" },
29346
- { keys: "Esc/q", label: "back without saving" }
29347
- ]
29348
- }
29349
- )
29350
- ] });
29351
- }
29352
-
29353
28559
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
29354
28560
  async function readCredentials() {
29355
28561
  const store = await readV1Store();
@@ -29375,16 +28581,17 @@ async function writeCredentials(config) {
29375
28581
  await writeV1Store(merged);
29376
28582
  }
29377
28583
 
29378
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
29379
- import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
29380
- var FIELDS3 = [
29381
- { key: "spaceId", label: "Space ID" },
29382
- { key: "environmentId", label: "Environment ID" },
29383
- { key: "cmaToken", label: "CMA Token", masked: true },
29384
- { key: "host", label: "API Host" },
29385
- { key: "defaultComponentDir", label: "Default component directory" },
29386
- { key: "defaultTokenFile", label: "Default token file" },
29387
- { key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
28584
+ // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
28585
+ init_debug_store();
28586
+ import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
28587
+ var FIELD_ORDER = [
28588
+ "spaceId",
28589
+ "environmentId",
28590
+ "cmaToken",
28591
+ "host",
28592
+ "defaultComponentDir",
28593
+ "defaultTokenFile",
28594
+ "contentfulBaseDir"
29388
28595
  ];
29389
28596
  function debugFields(config) {
29390
28597
  return {
@@ -29397,114 +28604,156 @@ function debugFields(config) {
29397
28604
  contentful_base_dir: config?.contentfulBaseDir ?? ""
29398
28605
  };
29399
28606
  }
29400
- var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
29401
- function ProjectConfigScreen({ onDone }) {
29402
- const [config, setConfig] = useState32(null);
29403
- const [saving, setSaving] = useState32(false);
29404
- const [notice, setNotice] = useState32(null);
29405
- const [lastSaved, setLastSaved] = useState32(null);
29406
- useEffect24(() => {
29407
- void readCredentials().then((cfg) => {
28607
+ var FIELD_LABELS = {
28608
+ spaceId: "Space ID",
28609
+ environmentId: "Environment ID",
28610
+ cmaToken: "CMA Token",
28611
+ host: "API Host",
28612
+ defaultComponentDir: "Default component directory",
28613
+ defaultTokenFile: "Default token file",
28614
+ contentfulBaseDir: "Root Project Directory"
28615
+ };
28616
+ var FIELD_HINTS = {
28617
+ contentfulBaseDir: "(where .contentful goes)"
28618
+ };
28619
+ var LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
28620
+ function ConfigurationScreen({ onDone }) {
28621
+ const [stage, setStage] = useState29("loading");
28622
+ const [config, setConfig] = useState29(null);
28623
+ const [activeField, setActiveField] = useState29("spaceId");
28624
+ const [notice, setNotice] = useState29(null);
28625
+ const [lastSaved, setLastSaved] = useState29(null);
28626
+ const [editing, setEditing] = useState29(false);
28627
+ const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
28628
+ useEffect22(() => {
28629
+ readCredentials().then((cfg) => {
29408
28630
  setConfig(cfg);
28631
+ setStage("form");
29409
28632
  startDebugRun({
29410
28633
  flow: "settings/contentful-configuration",
29411
28634
  step: "01-configuration",
29412
- menuOption: "Configuration > Project",
28635
+ menuOption: "Configuration",
29413
28636
  inputs: debugFields(cfg)
29414
28637
  });
29415
28638
  });
29416
28639
  }, []);
29417
- if (!config) {
29418
- return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29419
- /* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
29420
- /* @__PURE__ */ jsx59(Text50, { children: " " }),
29421
- /* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
29422
- ] });
28640
+ function fieldValue(field) {
28641
+ if (!config) return "";
28642
+ return config[field] || "";
28643
+ }
28644
+ function setFieldValue(field, value) {
28645
+ if (!config) return;
28646
+ setConfig({ ...config, [field]: value });
28647
+ setNotice(null);
29423
28648
  }
29424
- const save = () => {
29425
- setSaving(true);
28649
+ function handleSave() {
28650
+ if (!config) return;
28651
+ setStage("saving");
29426
28652
  setNotice(null);
29427
28653
  writeCredentials(config).then(() => {
29428
28654
  setLastSaved(config);
29429
28655
  if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
29430
- setNotice({ kind: "success", text: "Project settings saved" });
28656
+ setNotice({ kind: "success", text: "Configuration saved" });
28657
+ setStage("form");
29431
28658
  }).catch((err) => {
29432
28659
  setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
29433
- }).finally(() => setSaving(false));
29434
- };
29435
- const quit = () => {
28660
+ setStage("form");
28661
+ });
28662
+ }
28663
+ function quit() {
29436
28664
  void finishDebugRun(
29437
28665
  lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
29438
28666
  );
29439
28667
  onDone();
29440
- };
29441
- return /* @__PURE__ */ jsx59(
29442
- FieldForm,
29443
- {
29444
- title: "Project",
29445
- subtitle: "The Contentful space and where the CLI keeps its files.",
29446
- fields: FIELDS3,
29447
- values: valuesOf(config),
29448
- onChange: (key, value) => {
29449
- setConfig({ ...config, [key]: value });
29450
- setNotice(null);
29451
- },
29452
- onSave: save,
29453
- onQuit: quit,
29454
- notice,
29455
- busy: saving
28668
+ }
28669
+ useInput11((input, key) => {
28670
+ if (stage === "loading" || stage === "saving") return;
28671
+ if (editing) {
28672
+ if (key.escape) {
28673
+ setFieldValue(activeField, valueBeforeEdit);
28674
+ setEditing(false);
28675
+ }
28676
+ return;
29456
28677
  }
29457
- );
29458
- }
29459
-
29460
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
29461
- import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
29462
- var SECTIONS = [
29463
- {
29464
- id: "project",
29465
- label: "Project",
29466
- description: "Contentful space, credentials, defaults and where .contentful goes"
29467
- },
29468
- { id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
29469
- ];
29470
- function ConfigurationScreen({ onDone }) {
29471
- const [focus, setFocus] = useState33(0);
29472
- const [open, setOpen] = useState33(null);
29473
- const close = () => setOpen(null);
29474
- useInput14((input, key) => {
29475
- if (open) return;
29476
- if (key.upArrow) {
29477
- setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
28678
+ if (key.escape || input === "q") {
28679
+ quit();
29478
28680
  return;
29479
28681
  }
29480
- if (key.downArrow || key.tab) {
29481
- setFocus((i) => (i + 1) % SECTIONS.length);
28682
+ if (input === "s") {
28683
+ handleSave();
29482
28684
  return;
29483
28685
  }
29484
- if (key.return) {
29485
- setOpen(SECTIONS[focus].id);
28686
+ if (input === "c") {
28687
+ setFieldValue(activeField, "");
28688
+ return;
28689
+ }
28690
+ if (key.tab || key.downArrow) {
28691
+ const idx = FIELD_ORDER.indexOf(activeField);
28692
+ setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
29486
28693
  return;
29487
28694
  }
29488
- if (key.escape || input === "q") onDone();
28695
+ if (key.upArrow) {
28696
+ const idx = FIELD_ORDER.indexOf(activeField);
28697
+ setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
28698
+ return;
28699
+ }
28700
+ if (key.return) {
28701
+ setValueBeforeEdit(fieldValue(activeField));
28702
+ setEditing(true);
28703
+ }
29489
28704
  });
29490
- if (open === "project") return /* @__PURE__ */ jsx60(ProjectConfigScreen, { onDone: close });
29491
- if (open === "agents") return /* @__PURE__ */ jsx60(AgentsScreen, { onDone: close });
29492
- return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29493
- /* @__PURE__ */ jsx60(Text51, { bold: true, children: "Configuration" }),
29494
- /* @__PURE__ */ jsx60(Text51, { children: " " }),
29495
- SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
29496
- /* @__PURE__ */ jsx60(Text51, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
29497
- /* @__PURE__ */ jsx60(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx60(Text51, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
29498
- /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: section.description })
29499
- ] }, section.id)),
29500
- /* @__PURE__ */ jsx60(Text51, { children: " " }),
29501
- /* @__PURE__ */ jsx60(
28705
+ if (stage === "loading") {
28706
+ return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28707
+ /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
28708
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28709
+ /* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
28710
+ ] });
28711
+ }
28712
+ return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28713
+ /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
28714
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28715
+ /* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
28716
+ const isActive = activeField === field;
28717
+ const value = fieldValue(field);
28718
+ const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
28719
+ return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
28720
+ /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
28721
+ /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
28722
+ isActive && editing ? /* @__PURE__ */ jsx55(
28723
+ TextInput4,
28724
+ {
28725
+ value,
28726
+ onChange: (next) => setFieldValue(field, next),
28727
+ onSubmit: () => setEditing(false),
28728
+ mask: field === "cmaToken" ? "\u2022" : void 0
28729
+ }
28730
+ ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
28731
+ FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
28732
+ ] }, field);
28733
+ }) }),
28734
+ notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
28735
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28736
+ /* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
28737
+ notice.kind === "success" ? "\u2713" : "\u2717",
28738
+ " ",
28739
+ notice.text
28740
+ ] })
28741
+ ] }),
28742
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28743
+ /* @__PURE__ */ jsx55(
29502
28744
  ControlHints,
29503
28745
  {
29504
- hints: [
28746
+ hints: editing ? [
28747
+ { keys: "type", label: "edit" },
28748
+ { keys: "\u2190/\u2192", label: "move cursor" },
28749
+ { keys: "\u23CE", label: "done" },
28750
+ { keys: "Esc", label: "cancel edit" }
28751
+ ] : [
29505
28752
  { keys: "\u2191/\u2193", label: "move" },
29506
- { keys: "\u23CE", label: "open" },
29507
- { keys: "Esc/q", label: "back" }
28753
+ { keys: "\u23CE", label: "edit" },
28754
+ { keys: "c", label: "clear" },
28755
+ { keys: "s", label: "save" },
28756
+ { keys: "Esc/q", label: "quit without saving" }
29508
28757
  ]
29509
28758
  }
29510
28759
  )
@@ -29512,8 +28761,8 @@ function ConfigurationScreen({ onDone }) {
29512
28761
  }
29513
28762
 
29514
28763
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
29515
- import { useEffect as useEffect25, useState as useState34 } from "react";
29516
- import { Box as Box49, Text as Text52, useInput as useInput15 } from "ink";
28764
+ import { useEffect as useEffect23, useState as useState30 } from "react";
28765
+ import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
29517
28766
 
29518
28767
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
29519
28768
  async function readAnalyticsSetting() {
@@ -29532,11 +28781,11 @@ async function writeAnalyticsSetting(setting) {
29532
28781
 
29533
28782
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
29534
28783
  init_debug_store();
29535
- import { Fragment as Fragment19, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
28784
+ import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
29536
28785
  function OptInAnalyticsScreen({ onDone }) {
29537
- const [loading, setLoading] = useState34(true);
29538
- const [enabled, setEnabled] = useState34(true);
29539
- useEffect25(() => {
28786
+ const [loading, setLoading] = useState30(true);
28787
+ const [enabled, setEnabled] = useState30(true);
28788
+ useEffect23(() => {
29540
28789
  readAnalyticsSetting().then((setting) => {
29541
28790
  setEnabled(setting.enabled);
29542
28791
  setLoading(false);
@@ -29548,7 +28797,7 @@ function OptInAnalyticsScreen({ onDone }) {
29548
28797
  });
29549
28798
  });
29550
28799
  }, []);
29551
- useInput15((input, key) => {
28800
+ useInput12((input, key) => {
29552
28801
  if (loading) return;
29553
28802
  if (key.return || input === " ") {
29554
28803
  setEnabled((current) => {
@@ -29563,21 +28812,21 @@ function OptInAnalyticsScreen({ onDone }) {
29563
28812
  onDone();
29564
28813
  }
29565
28814
  });
29566
- return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29567
- /* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
29568
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
29569
- loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment19, { children: [
29570
- /* @__PURE__ */ jsxs50(Text52, { children: [
28815
+ return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28816
+ /* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
28817
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28818
+ loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
28819
+ /* @__PURE__ */ jsxs46(Text47, { children: [
29571
28820
  "Share anonymous usage data:",
29572
28821
  " ",
29573
- /* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
28822
+ /* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29574
28823
  ] }),
29575
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
29576
- /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
29577
- /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
28824
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28825
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
28826
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
29578
28827
  ] }),
29579
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
29580
- /* @__PURE__ */ jsx61(
28828
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28829
+ /* @__PURE__ */ jsx56(
29581
28830
  ControlHints,
29582
28831
  {
29583
28832
  hints: [
@@ -29590,15 +28839,15 @@ function OptInAnalyticsScreen({ onDone }) {
29590
28839
  }
29591
28840
 
29592
28841
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
29593
- import { useEffect as useEffect26, useState as useState35 } from "react";
29594
- import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
28842
+ import { useEffect as useEffect24, useState as useState31 } from "react";
28843
+ import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
29595
28844
  init_version();
29596
28845
  init_debug_store();
29597
- import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
28846
+ import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
29598
28847
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
29599
28848
  function UpgradeScreen({ onDone }) {
29600
- const [upgradeCheck, setUpgradeCheck] = useState35();
29601
- useEffect26(() => {
28849
+ const [upgradeCheck, setUpgradeCheck] = useState31();
28850
+ useEffect24(() => {
29602
28851
  startDebugRun({
29603
28852
  flow: "upgrade",
29604
28853
  step: "01-upgrade",
@@ -29607,7 +28856,7 @@ function UpgradeScreen({ onDone }) {
29607
28856
  });
29608
28857
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
29609
28858
  }, []);
29610
- useInput16((_input, key) => {
28859
+ useInput13((_input, key) => {
29611
28860
  if (key.return) {
29612
28861
  void finishDebugRun({
29613
28862
  outputs: upgradeCheck ?? {},
@@ -29618,12 +28867,12 @@ function UpgradeScreen({ onDone }) {
29618
28867
  return;
29619
28868
  }
29620
28869
  });
29621
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29622
- /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
29623
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
28870
+ return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28871
+ /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Upgrade" }),
28872
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
29624
28873
  renderBody(upgradeCheck),
29625
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29626
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
28874
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
28875
+ /* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.accent, children: [
29627
28876
  FOCUS_MARKER,
29628
28877
  " Go Back"
29629
28878
  ] })
@@ -29631,47 +28880,47 @@ function UpgradeScreen({ onDone }) {
29631
28880
  }
29632
28881
  function renderBody(upgradeCheck) {
29633
28882
  if (!upgradeCheck) {
29634
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
28883
+ return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Checking for updates\u2026" });
29635
28884
  }
29636
28885
  if (upgradeCheck.status === "error") {
29637
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
28886
+ return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
29638
28887
  }
29639
28888
  if (upgradeCheck.status === "up-to-date") {
29640
- return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
28889
+ return /* @__PURE__ */ jsxs47(Text48, { color: PALETTE.success, children: [
29641
28890
  "You're already on the latest version (v",
29642
28891
  upgradeCheck.current,
29643
28892
  ")."
29644
28893
  ] });
29645
28894
  }
29646
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
29647
- /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
29648
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
28895
+ return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", children: [
28896
+ /* @__PURE__ */ jsxs47(Text48, { color: PALETTE.muted, children: [
28897
+ /* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.success, children: [
29649
28898
  "v",
29650
28899
  upgradeCheck.latest
29651
28900
  ] }),
29652
28901
  " ",
29653
28902
  "is available (you're on ",
29654
- /* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
28903
+ /* @__PURE__ */ jsxs47(Text48, { bold: true, children: [
29655
28904
  "v",
29656
28905
  upgradeCheck.current
29657
28906
  ] }),
29658
28907
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
29659
28908
  ] }),
29660
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29661
- /* @__PURE__ */ jsx62(Box50, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx62(Text53, { bold: true, children: cmd }, cmd)) })
28909
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
28910
+ /* @__PURE__ */ jsx57(Box46, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx57(Text48, { bold: true, children: cmd }, cmd)) })
29662
28911
  ] });
29663
28912
  }
29664
28913
 
29665
28914
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
29666
- import { useEffect as useEffect27, useState as useState36 } from "react";
29667
- import { Box as Box51, Text as Text54, useInput as useInput17 } from "ink";
28915
+ import { useEffect as useEffect25, useState as useState32 } from "react";
28916
+ import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
29668
28917
  init_debug_mode_store();
29669
28918
  init_debug_store();
29670
- import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
28919
+ import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
29671
28920
  function DebugModeScreen({ onDone }) {
29672
- const [loading, setLoading] = useState36(true);
29673
- const [enabled, setEnabled] = useState36(true);
29674
- useEffect27(() => {
28921
+ const [loading, setLoading] = useState32(true);
28922
+ const [enabled, setEnabled] = useState32(true);
28923
+ useEffect25(() => {
29675
28924
  readDebugModeSetting().then((setting) => {
29676
28925
  setEnabled(setting.enabled);
29677
28926
  setLoading(false);
@@ -29683,7 +28932,7 @@ function DebugModeScreen({ onDone }) {
29683
28932
  });
29684
28933
  });
29685
28934
  }, []);
29686
- useInput17((input, key) => {
28935
+ useInput14((input, key) => {
29687
28936
  if (loading) return;
29688
28937
  if (key.return || input === " ") {
29689
28938
  setEnabled((current) => {
@@ -29698,16 +28947,16 @@ function DebugModeScreen({ onDone }) {
29698
28947
  onDone();
29699
28948
  }
29700
28949
  });
29701
- return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29702
- /* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
29703
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
29704
- loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
28950
+ return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28951
+ /* @__PURE__ */ jsx58(Text49, { bold: true, children: "Settings \u203A Debug Mode" }),
28952
+ /* @__PURE__ */ jsx58(Text49, { children: " " }),
28953
+ loading ? /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs48(Text49, { children: [
29705
28954
  "Debug logging:",
29706
28955
  " ",
29707
- /* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
28956
+ /* @__PURE__ */ jsx58(Text49, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29708
28957
  ] }),
29709
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
29710
- /* @__PURE__ */ jsx63(
28958
+ /* @__PURE__ */ jsx58(Text49, { children: " " }),
28959
+ /* @__PURE__ */ jsx58(
29711
28960
  ControlHints,
29712
28961
  {
29713
28962
  hints: [
@@ -29720,18 +28969,18 @@ function DebugModeScreen({ onDone }) {
29720
28969
  }
29721
28970
 
29722
28971
  // packages/experience-design-system-cli/app.tsx
29723
- import { Fragment as Fragment20, jsx as jsx64 } from "react/jsx-runtime";
28972
+ import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
29724
28973
  function App({ importOptions, inkClear }) {
29725
- const [screen, setScreen] = useState37("start");
29726
- const [importExitCode, setImportExitCode] = useState37();
28974
+ const [screen, setScreen] = useState33("start");
28975
+ const [importExitCode, setImportExitCode] = useState33();
29727
28976
  const showImportResult = importExitCode !== void 0;
29728
- const [projectPath, setProjectPath] = useState37();
29729
- const [tokensPath, setTokensPath] = useState37();
29730
- const [scannedFiles, setScannedFiles] = useState37();
29731
- const [pendingLaunch, setPendingLaunch] = useState37();
29732
- const [extractionRun, setExtractionRun] = useState37();
28977
+ const [projectPath, setProjectPath] = useState33();
28978
+ const [tokensPath, setTokensPath] = useState33();
28979
+ const [scannedFiles, setScannedFiles] = useState33();
28980
+ const [pendingLaunch, setPendingLaunch] = useState33();
28981
+ const [extractionRun, setExtractionRun] = useState33();
29733
28982
  const extraction = useExtraction(extractionRun?.input);
29734
- const [scopeRun, setScopeRun] = useState37();
28983
+ const [scopeRun, setScopeRun] = useState33();
29735
28984
  const scopeFlow = useScopeGateFlow(
29736
28985
  scopeRun && {
29737
28986
  sessionId: scopeRun.extraction.sessionId,
@@ -29746,12 +28995,12 @@ function App({ importOptions, inkClear }) {
29746
28995
  }
29747
28996
  }
29748
28997
  );
29749
- const [generationInput, setGenerationInput] = useState37();
28998
+ const [generationInput, setGenerationInput] = useState33();
29750
28999
  const generation = useGeneration(generationInput);
29751
- const [flowStart, setFlowStart] = useState37();
29000
+ const [flowStart, setFlowStart] = useState33();
29752
29001
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
29753
- const [importDefaults, setImportDefaults] = useState37();
29754
- useEffect28(() => {
29002
+ const [importDefaults, setImportDefaults] = useState33();
29003
+ useEffect26(() => {
29755
29004
  if (screen !== "import") {
29756
29005
  setImportDefaults(void 0);
29757
29006
  return;
@@ -29769,7 +29018,7 @@ function App({ importOptions, inkClear }) {
29769
29018
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
29770
29019
  const state2 = await inspectTokens({
29771
29020
  rawTokensPath: tokens,
29772
- contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
29021
+ contentfulDir: join25(resolveUserPath(projectPath2), ".contentful"),
29773
29022
  cache: importOptions.cache
29774
29023
  });
29775
29024
  if (state2.kind === "cached") {
@@ -29811,12 +29060,12 @@ function App({ importOptions, inkClear }) {
29811
29060
  }
29812
29061
  });
29813
29062
  };
29814
- useEffect28(() => {
29063
+ useEffect26(() => {
29815
29064
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
29816
29065
  setExtractionRun(void 0);
29817
29066
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
29818
29067
  }, [extraction, extractionRun]);
29819
- useEffect28(() => {
29068
+ useEffect26(() => {
29820
29069
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
29821
29070
  const { extraction: produced, input, generatePromptPath } = scopeRun;
29822
29071
  setGenerationInput({
@@ -29834,7 +29083,7 @@ function App({ importOptions, inkClear }) {
29834
29083
  ...generatePromptPath ? { generatePromptPath } : {}
29835
29084
  });
29836
29085
  }, [scopeFlow, scopeRun, generationInput]);
29837
- useEffect28(() => {
29086
+ useEffect26(() => {
29838
29087
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
29839
29088
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
29840
29089
  inkClear();
@@ -29877,9 +29126,9 @@ function App({ importOptions, inkClear }) {
29877
29126
  };
29878
29127
  switch (screen) {
29879
29128
  case "import":
29880
- if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29129
+ if (showImportResult) return /* @__PURE__ */ jsx59(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29881
29130
  if (flow && flowStart) {
29882
- return /* @__PURE__ */ jsx64(
29131
+ return /* @__PURE__ */ jsx59(
29883
29132
  FlowScreen,
29884
29133
  {
29885
29134
  state: flow.state,
@@ -29889,12 +29138,12 @@ function App({ importOptions, inkClear }) {
29889
29138
  }
29890
29139
  );
29891
29140
  }
29892
- if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment20, {});
29141
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx59(Fragment19, {});
29893
29142
  if (projectPath === void 0) {
29894
- return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29143
+ return /* @__PURE__ */ jsx59(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29895
29144
  }
29896
29145
  if (tokensPath === void 0) {
29897
- return /* @__PURE__ */ jsx64(
29146
+ return /* @__PURE__ */ jsx59(
29898
29147
  TokenInputScreen,
29899
29148
  {
29900
29149
  initialPath: importDefaults.tokenFile,
@@ -29904,7 +29153,7 @@ function App({ importOptions, inkClear }) {
29904
29153
  );
29905
29154
  }
29906
29155
  if (scannedFiles === void 0) {
29907
- return /* @__PURE__ */ jsx64(
29156
+ return /* @__PURE__ */ jsx59(
29908
29157
  PathValidationScreen,
29909
29158
  {
29910
29159
  projectPath,
@@ -29916,10 +29165,10 @@ function App({ importOptions, inkClear }) {
29916
29165
  }
29917
29166
  if (extractionRun) {
29918
29167
  if (extraction?.status === "done" && !extraction.result.ok) {
29919
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29168
+ return /* @__PURE__ */ jsx59(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29920
29169
  }
29921
29170
  if (extraction?.status === "running") {
29922
- return /* @__PURE__ */ jsx64(
29171
+ return /* @__PURE__ */ jsx59(
29923
29172
  ExtractionScreen,
29924
29173
  {
29925
29174
  progress: extraction.progress,
@@ -29928,14 +29177,14 @@ function App({ importOptions, inkClear }) {
29928
29177
  }
29929
29178
  );
29930
29179
  }
29931
- return /* @__PURE__ */ jsx64(Fragment20, {});
29180
+ return /* @__PURE__ */ jsx59(Fragment19, {});
29932
29181
  }
29933
29182
  if (scopeRun && scopeFlow) {
29934
29183
  if (scopeFlow.status === "failed") {
29935
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29184
+ return /* @__PURE__ */ jsx59(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29936
29185
  }
29937
29186
  if (scopeFlow.status === "deciding") {
29938
- return /* @__PURE__ */ jsx64(
29187
+ return /* @__PURE__ */ jsx59(
29939
29188
  ScopeGateScreen,
29940
29189
  {
29941
29190
  components: scopeFlow.load.components,
@@ -29945,7 +29194,7 @@ function App({ importOptions, inkClear }) {
29945
29194
  );
29946
29195
  }
29947
29196
  if (generation?.status === "done" && !generation.result.ok) {
29948
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29197
+ return /* @__PURE__ */ jsx59(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29949
29198
  }
29950
29199
  if (generation?.status === "running") {
29951
29200
  const hasRawTokens = scopeRun.input.rawTokensPath !== "";
@@ -29953,7 +29202,7 @@ function App({ importOptions, inkClear }) {
29953
29202
  hasRawTokens,
29954
29203
  mapTokensEligible: generation.progress.mapTokensEligible
29955
29204
  });
29956
- return /* @__PURE__ */ jsx64(
29205
+ return /* @__PURE__ */ jsx59(
29957
29206
  GenerationScreen,
29958
29207
  {
29959
29208
  progress: generation.progress,
@@ -29965,10 +29214,10 @@ function App({ importOptions, inkClear }) {
29965
29214
  }
29966
29215
  );
29967
29216
  }
29968
- return /* @__PURE__ */ jsx64(Fragment20, {});
29217
+ return /* @__PURE__ */ jsx59(Fragment19, {});
29969
29218
  }
29970
29219
  if (pendingLaunch?.cached) {
29971
- return /* @__PURE__ */ jsx64(
29220
+ return /* @__PURE__ */ jsx59(
29972
29221
  TokenReuseScreen,
29973
29222
  {
29974
29223
  tokensPath: pendingLaunch.cached.tokensPath,
@@ -29979,7 +29228,7 @@ function App({ importOptions, inkClear }) {
29979
29228
  }
29980
29229
  );
29981
29230
  }
29982
- return /* @__PURE__ */ jsx64(
29231
+ return /* @__PURE__ */ jsx59(
29983
29232
  CredentialsScreen,
29984
29233
  {
29985
29234
  initial: importDefaults.credentials,
@@ -29988,19 +29237,19 @@ function App({ importOptions, inkClear }) {
29988
29237
  }
29989
29238
  );
29990
29239
  case "help":
29991
- return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
29240
+ return /* @__PURE__ */ jsx59(HelpScreen, { onDone: goToStart });
29992
29241
  case "upgrade":
29993
- return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
29242
+ return /* @__PURE__ */ jsx59(UpgradeScreen, { onDone: goToStart });
29994
29243
  case "settings":
29995
- return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
29244
+ return /* @__PURE__ */ jsx59(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
29996
29245
  case "settings-configuration":
29997
- return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
29246
+ return /* @__PURE__ */ jsx59(ConfigurationScreen, { onDone: goToSettings });
29998
29247
  case "settings-opt-in-analytics":
29999
- return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
29248
+ return /* @__PURE__ */ jsx59(OptInAnalyticsScreen, { onDone: goToSettings });
30000
29249
  case "settings-debug-mode":
30001
- return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
29250
+ return /* @__PURE__ */ jsx59(DebugModeScreen, { onDone: goToSettings });
30002
29251
  case "start":
30003
- return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
29252
+ return /* @__PURE__ */ jsx59(HomeScreen, { onNavigate: setScreen });
30004
29253
  }
30005
29254
  }
30006
29255
  async function runApp(renderApp, importOptions) {
@@ -30008,7 +29257,7 @@ async function runApp(renderApp, importOptions) {
30008
29257
  instance.clear?.();
30009
29258
  process.stdout.write("\x1B[H\x1B[0J");
30010
29259
  };
30011
- const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
29260
+ const instance = renderApp(/* @__PURE__ */ jsx59(App, { importOptions, inkClear }));
30012
29261
  await instance.waitUntilExit();
30013
29262
  }
30014
29263
  export {