@contentful/experience-design-system-cli 2.41.1-dev-build-bf9d918c.0 → 2.41.1-dev-build-c9e39919.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18053,10 +18053,10 @@ var init_read_candidate_files = __esm({
18053
18053
  async function selectCompositionPromptFiles(components, sourceFiles) {
18054
18054
  const allFiles = await readCandidateFiles(components, sourceFiles);
18055
18055
  const selectedCandidates = selectCandidateFiles(allFiles).map((c2) => ({ path: c2.path, content: c2.content }));
18056
- const capped2 = capCandidatesToPromptBudget(selectedCandidates);
18057
- const promptFiles = capped2.kept;
18056
+ const capped3 = capCandidatesToPromptBudget(selectedCandidates);
18057
+ const promptFiles = capped3.kept;
18058
18058
  const runtimeFiles = allFiles.map((c2) => ({ path: c2.path, content: c2.content }));
18059
- const droppedWarning = capped2.dropped.length > 0 ? `composition \u2014 ${capped2.dropped.length} candidate file(s) omitted from the agent prompt to fit the context budget; resolution runs on the ${promptFiles.length} highest-value files.` : void 0;
18059
+ const droppedWarning = capped3.dropped.length > 0 ? `composition \u2014 ${capped3.dropped.length} candidate file(s) omitted from the agent prompt to fit the context budget; resolution runs on the ${promptFiles.length} highest-value files.` : void 0;
18060
18060
  return { promptFiles, runtimeFiles, droppedWarning };
18061
18061
  }
18062
18062
  var init_select_composition_prompt_files = __esm({
@@ -29658,7 +29658,13 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29658
29658
  }, [components, extractSessionId, selectedIdx]);
29659
29659
  return { reviewMetadata, componentRationale };
29660
29660
  }
29661
- function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29661
+ function useReviewHistory({
29662
+ loading,
29663
+ components,
29664
+ createSnapshot,
29665
+ applySnapshot,
29666
+ onAction
29667
+ }) {
29662
29668
  const historyRef = useRef13(null);
29663
29669
  const historySeededRef = useRef13(false);
29664
29670
  useEffect19(() => {
@@ -29669,14 +29675,19 @@ function useReviewHistory({ loading, components, createSnapshot, applySnapshot }
29669
29675
  const pushHistorySnapshot = (entries, label) => {
29670
29676
  if (!historyRef.current) return;
29671
29677
  historyRef.current.push(createSnapshot(entries), label);
29678
+ onAction?.(label);
29672
29679
  };
29673
29680
  const handleUndo = () => {
29674
29681
  const snapshot = historyRef.current?.undo();
29675
- if (snapshot) applySnapshot(snapshot);
29682
+ if (!snapshot) return;
29683
+ applySnapshot(snapshot);
29684
+ onAction?.("undo");
29676
29685
  };
29677
29686
  const handleRedo = () => {
29678
29687
  const snapshot = historyRef.current?.redo();
29679
- if (snapshot) applySnapshot(snapshot);
29688
+ if (!snapshot) return;
29689
+ applySnapshot(snapshot);
29690
+ onAction?.("redo");
29680
29691
  };
29681
29692
  const resetHistory = (snapshot) => {
29682
29693
  historyRef.current?.reset(snapshot);
@@ -30423,6 +30434,127 @@ var init_use_review_preview = __esm({
30423
30434
  }
30424
30435
  });
30425
30436
 
30437
+ // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
30438
+ function reviewInputs(components) {
30439
+ return { components: components.length, by_status: countStatuses(components) };
30440
+ }
30441
+ function openReviewTrail(components, now) {
30442
+ return {
30443
+ startedAt: now,
30444
+ start: new Map(components.map((component) => [component.key, component.status])),
30445
+ actions: [],
30446
+ kinds: {}
30447
+ };
30448
+ }
30449
+ function recordReviewAction(trail, label) {
30450
+ const kind = label.split(":")[0] ?? label;
30451
+ trail.kinds[kind] = (trail.kinds[kind] ?? 0) + 1;
30452
+ if (trail.actions.length < MAX_ACTIONS) trail.actions.push(label);
30453
+ }
30454
+ function render(trail, components, now, outcome) {
30455
+ const acceptedByUser = [];
30456
+ const rejectedByUser = [];
30457
+ for (const { key, status } of components) {
30458
+ const was = trail.start.get(key);
30459
+ if (was === status) continue;
30460
+ if (status === "accepted") acceptedByUser.push(key);
30461
+ if (status === "rejected") rejectedByUser.push(key);
30462
+ }
30463
+ const total = Object.values(trail.kinds).reduce((sum, count) => sum + count, 0);
30464
+ return {
30465
+ outcome,
30466
+ seconds: Math.round((now - trail.startedAt) / 100) / 10,
30467
+ edits: { total, by_kind: trail.kinds, in_order: trail.actions },
30468
+ now: countStatuses(components),
30469
+ accepted_by_user: capped2(acceptedByUser),
30470
+ rejected_by_user: capped2(rejectedByUser)
30471
+ };
30472
+ }
30473
+ function reviewProgress(trail, components, now) {
30474
+ return render(trail, components, now, "interrupted");
30475
+ }
30476
+ function reviewFinish(trail, components, now, final) {
30477
+ const outcome = final ? `finalized: ${final.accepted} accepted, ${final.rejected} rejected, ${final.unresolved} unresolved` : "left the review without finishing";
30478
+ return {
30479
+ outputs: render(trail, components, now, outcome),
30480
+ status: "success",
30481
+ exitMethod: final ? "saved" : "discarded"
30482
+ };
30483
+ }
30484
+ var REVIEW_RUN, MAX_ACTIONS, MAX_NAMES2, countStatuses, capped2;
30485
+ var init_review_log = __esm({
30486
+ "packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts"() {
30487
+ "use strict";
30488
+ REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
30489
+ MAX_ACTIONS = 30;
30490
+ MAX_NAMES2 = 20;
30491
+ countStatuses = (components) => {
30492
+ const counts = {};
30493
+ for (const { status } of components) counts[status] = (counts[status] ?? 0) + 1;
30494
+ return counts;
30495
+ };
30496
+ capped2 = (keys) => ({
30497
+ count: keys.length,
30498
+ keys: keys.slice(0, MAX_NAMES2)
30499
+ });
30500
+ }
30501
+ });
30502
+
30503
+ // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
30504
+ import { useEffect as useEffect23, useRef as useRef16 } from "react";
30505
+ function useReviewLog({
30506
+ loading,
30507
+ loadError,
30508
+ components
30509
+ }) {
30510
+ const trail = useRef16(void 0);
30511
+ const started = useRef16(false);
30512
+ const latest = useRef16(components);
30513
+ latest.current = components;
30514
+ useEffect23(() => {
30515
+ if (loading || started.current) return;
30516
+ started.current = true;
30517
+ startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
30518
+ if (loadError) {
30519
+ void finishDebugRun({
30520
+ outputs: { outcome: "could not load the components", error: loadError },
30521
+ status: "error",
30522
+ exitMethod: "discarded"
30523
+ });
30524
+ return;
30525
+ }
30526
+ trail.current = openReviewTrail(components, Date.now());
30527
+ setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
30528
+ }, [loading, loadError, components]);
30529
+ useEffect23(
30530
+ () => () => {
30531
+ const open = trail.current;
30532
+ trail.current = void 0;
30533
+ if (open) void finishDebugRun(reviewFinish(open, latest.current, Date.now(), void 0));
30534
+ },
30535
+ []
30536
+ );
30537
+ return {
30538
+ record: (label) => {
30539
+ if (!trail.current) return;
30540
+ recordReviewAction(trail.current, label);
30541
+ setDebugRunProgress(reviewProgress(trail.current, latest.current, Date.now()));
30542
+ },
30543
+ finish: (counts) => {
30544
+ const open = trail.current;
30545
+ trail.current = void 0;
30546
+ if (open) void finishDebugRun(reviewFinish(open, latest.current, Date.now(), counts));
30547
+ }
30548
+ };
30549
+ }
30550
+ var init_use_review_log = __esm({
30551
+ "packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts"() {
30552
+ "use strict";
30553
+ init_debug_store();
30554
+ init_review_log();
30555
+ }
30556
+ });
30557
+
30426
30558
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/LivePreviewSummary.tsx
30427
30559
  import { Box as Box37, Text as Text39 } from "ink";
30428
30560
  import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
@@ -30462,7 +30594,7 @@ var init_LivePreviewSummary = __esm({
30462
30594
  });
30463
30595
 
30464
30596
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30465
- import { useCallback as useCallback5, useEffect as useEffect23, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30597
+ import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
30466
30598
  import figures8 from "figures";
30467
30599
  import { Box as Box38, Text as Text40 } from "ink";
30468
30600
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30659,6 +30791,7 @@ function GenerateReviewStepView({
30659
30791
  tokensPath,
30660
30792
  onExtraLoaded: setLoadedSlotCycles
30661
30793
  });
30794
+ const reviewLog = useReviewLog({ loading, loadError, components });
30662
30795
  const [nav, setNav] = useState26({
30663
30796
  cursorRowIdx: 0,
30664
30797
  sidebarScrollOffset: 0
@@ -30676,7 +30809,7 @@ function GenerateReviewStepView({
30676
30809
  setFinalizeError
30677
30810
  } = reviewSurface;
30678
30811
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30679
- const removedBannerDefaultedRef = useRef16(false);
30812
+ const removedBannerDefaultedRef = useRef17(false);
30680
30813
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30681
30814
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30682
30815
  const cyclePanel = useOverlayPanel({
@@ -30696,7 +30829,7 @@ function GenerateReviewStepView({
30696
30829
  const [breakCursor, setBreakCursor] = useState26(0);
30697
30830
  const [breakConfirm, setBreakConfirm] = useState26(false);
30698
30831
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30699
- const seededGroupsRef = useRef16(false);
30832
+ const seededGroupsRef = useRef17(false);
30700
30833
  const {
30701
30834
  searchOpen,
30702
30835
  setSearchOpen,
@@ -30720,7 +30853,7 @@ function GenerateReviewStepView({
30720
30853
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30721
30854
  const [autoRejected, setAutoRejected] = useState26([]);
30722
30855
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30723
- const autoRejectFiredRef = useRef16(false);
30856
+ const autoRejectFiredRef = useRef17(false);
30724
30857
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30725
30858
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30726
30859
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30752,7 +30885,10 @@ function GenerateReviewStepView({
30752
30885
  cmaToken,
30753
30886
  host,
30754
30887
  components,
30755
- onFinalize
30888
+ onFinalize: (accepted, rejected, unresolved) => {
30889
+ reviewLog.finish({ accepted, rejected, unresolved });
30890
+ onFinalize(accepted, rejected, unresolved);
30891
+ }
30756
30892
  });
30757
30893
  const recomputeCycles = (currentComponents) => {
30758
30894
  try {
@@ -30783,7 +30919,7 @@ function GenerateReviewStepView({
30783
30919
  [components]
30784
30920
  );
30785
30921
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30786
- useEffect23(() => {
30922
+ useEffect24(() => {
30787
30923
  if (seededGroupsRef.current) return;
30788
30924
  if (closures.size === 0 && slotCycles.length === 0) return;
30789
30925
  seededGroupsRef.current = true;
@@ -30810,7 +30946,7 @@ function GenerateReviewStepView({
30810
30946
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30811
30947
  }));
30812
30948
  }, [slotCycles, cycleView]);
30813
- useEffect23(() => {
30949
+ useEffect24(() => {
30814
30950
  const decision = computeAutoRejectDecision({
30815
30951
  loading,
30816
30952
  autoRejectFired: autoRejectFiredRef.current,
@@ -30851,10 +30987,11 @@ function GenerateReviewStepView({
30851
30987
  autoRejected,
30852
30988
  undoSnapshot
30853
30989
  }),
30854
- applySnapshot: applyHistorySnapshot
30990
+ applySnapshot: applyHistorySnapshot,
30991
+ onAction: reviewLog.record
30855
30992
  });
30856
- const autoRejectPushedRef = useRef16(false);
30857
- useEffect23(() => {
30993
+ const autoRejectPushedRef = useRef17(false);
30994
+ useEffect24(() => {
30858
30995
  if (loading) return;
30859
30996
  if (!historySeededRef.current) return;
30860
30997
  if (!autoRejectFiredRef.current) return;
@@ -30938,7 +31075,7 @@ function GenerateReviewStepView({
30938
31075
  const panelHeight = leftPanelHeight + 2;
30939
31076
  const panelContentHeight = Math.max(1, panelHeight - 3);
30940
31077
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30941
- useEffect23(() => {
31078
+ useEffect24(() => {
30942
31079
  if (selectableRowPositions.length === 0) return;
30943
31080
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30944
31081
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31767,6 +31904,7 @@ var init_generate_review_step = __esm({
31767
31904
  init_ReviewDialogs();
31768
31905
  init_review_input();
31769
31906
  init_use_review_preview();
31907
+ init_use_review_log();
31770
31908
  init_LivePreviewSummary();
31771
31909
  HELP_SECTIONS2 = [
31772
31910
  {
@@ -32020,10 +32158,10 @@ var init_path_utils = __esm({
32020
32158
  });
32021
32159
 
32022
32160
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
32023
- import { useEffect as useEffect24, useState as useState27 } from "react";
32161
+ import { useEffect as useEffect25, useState as useState27 } from "react";
32024
32162
  function useBlinkingCursor() {
32025
32163
  const [visible, setVisible] = useState27(true);
32026
- useEffect24(() => {
32164
+ useEffect25(() => {
32027
32165
  const interval = setInterval(() => setVisible((current) => !current), 500);
32028
32166
  return () => clearInterval(interval);
32029
32167
  }, []);
@@ -32160,12 +32298,12 @@ var init_produced = __esm({
32160
32298
  });
32161
32299
 
32162
32300
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
32163
- import { useEffect as useEffect25, useState as useState29 } from "react";
32301
+ import { useEffect as useEffect26, useState as useState29 } from "react";
32164
32302
  import { Spinner as Spinner2 } from "@inkjs/ui";
32165
32303
  import { jsx as jsx53 } from "react/jsx-runtime";
32166
32304
  function useTimedSpinner() {
32167
32305
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
32168
- useEffect25(() => {
32306
+ useEffect26(() => {
32169
32307
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
32170
32308
  return () => {
32171
32309
  clearInterval(timer);
@@ -32434,7 +32572,7 @@ var init_preview_confirmation_input = __esm({
32434
32572
  });
32435
32573
 
32436
32574
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32437
- import { useEffect as useEffect26, useState as useState30, useMemo as useMemo7 } from "react";
32575
+ import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
32438
32576
  import { Box as Box44, Text as Text46 } from "ink";
32439
32577
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32440
32578
  function buildPreviewSummaryLines(preview) {
@@ -32644,7 +32782,7 @@ function WizardPreviewStep({
32644
32782
  const activeLines = diffExpanded ? diffLines : summaryLines;
32645
32783
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32646
32784
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32647
- useEffect26(() => {
32785
+ useEffect27(() => {
32648
32786
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32649
32787
  }, [maxScroll]);
32650
32788
  useImmediateInput((input, key) => {
@@ -32817,7 +32955,7 @@ function arrive(trail, state2) {
32817
32955
  return next;
32818
32956
  }
32819
32957
  function openTrail(state2, now) {
32820
- return arrive({ startedAt: now, stageStartedAt: now, at: state2.step, stages: [], edits: 0 }, state2);
32958
+ return arrive({ startedAt: now, stageStartedAt: now, at: state2.step, stages: [] }, state2);
32821
32959
  }
32822
32960
  function advance(trail, from, to, now) {
32823
32961
  const next = { ...trail, stages: [...trail.stages], stageStartedAt: now };
@@ -32831,16 +32969,14 @@ function advance(trail, from, to, now) {
32831
32969
  next.pushFailed = pushHasFailures(to.pushResult);
32832
32970
  }
32833
32971
  if (from.step === "printing" && !failed) next.saved = { path: to.componentsPath, run_id: to.lastRunId };
32834
- if (from.step === "preview-gate" && to.step === "final-review") next.edits += 1;
32835
32972
  return arrive(next, to);
32836
32973
  }
32837
- function render(trail, now, outcome) {
32974
+ function render2(trail, now, outcome) {
32838
32975
  return {
32839
32976
  outcome,
32840
32977
  total_seconds: seconds(now - trail.startedAt),
32841
32978
  stages: trail.stages,
32842
32979
  ...trail.preview ? { preview: trail.preview } : {},
32843
- ...trail.edits > 0 ? { edited_definitions_after_preview: trail.edits } : {},
32844
32980
  ...trail.push ? { push: trail.push } : {},
32845
32981
  ...trail.saved ? { saved: trail.saved } : {},
32846
32982
  ...trail.failure ? { error: trail.failure } : {},
@@ -32848,13 +32984,20 @@ function render(trail, now, outcome) {
32848
32984
  };
32849
32985
  }
32850
32986
  function flowProgress(trail, now) {
32851
- return render(trail, now, `interrupted at ${LABELS[trail.at]}`);
32987
+ return render2(trail, now, `interrupted at ${LABELS[trail.at]}`);
32852
32988
  }
32853
32989
  function flowFinish(trail, final, now) {
32854
32990
  if (!final) {
32855
32991
  const midWork = WORK.includes(trail.at);
32856
32992
  const outcome2 = `left the import ${midWork ? "while" : "at"} ${LABELS[trail.at]}${midWork ? " was running" : ""}`;
32857
- return { outputs: render(trail, now, outcome2), status: midWork ? "error" : "success", exitMethod: "discarded" };
32993
+ return { outputs: render2(trail, now, outcome2), status: midWork ? "error" : "success", exitMethod: "discarded" };
32994
+ }
32995
+ if (final.step === "final-review") {
32996
+ return {
32997
+ outputs: render2(trail, now, "went back to edit the definitions"),
32998
+ status: "success",
32999
+ exitMethod: "discarded"
33000
+ };
32858
33001
  }
32859
33002
  let outcome;
32860
33003
  let failed = true;
@@ -32869,7 +33012,7 @@ function flowFinish(trail, final, now) {
32869
33012
  outcome = final.credentialsSkipped ? "saved without pushing (credentials skipped)" : "published";
32870
33013
  }
32871
33014
  return {
32872
- outputs: render(trail, now, outcome),
33015
+ outputs: render2(trail, now, outcome),
32873
33016
  status: failed ? "error" : "success",
32874
33017
  exitMethod: failed ? "discarded" : "saved"
32875
33018
  };
@@ -32893,7 +33036,7 @@ var init_flow_log = __esm({
32893
33036
  "preview-validation-error": "Preview validation"
32894
33037
  };
32895
33038
  WORK = ["printing", "previewing", "pushing"];
32896
- FINISHED = ["done", "error", "preview-validation-error"];
33039
+ FINISHED = ["done", "error", "preview-validation-error", "final-review"];
32897
33040
  MAX_LOGGED = 10;
32898
33041
  MAX_OUTCOME = 200;
32899
33042
  scrub = (text, state2) => scrubError(text, [state2.cmaToken]);
@@ -32904,11 +33047,11 @@ var init_flow_log = __esm({
32904
33047
  });
32905
33048
 
32906
33049
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
32907
- import { useEffect as useEffect27, useRef as useRef17 } from "react";
33050
+ import { useEffect as useEffect28, useRef as useRef18 } from "react";
32908
33051
  function useFlowLog(state2) {
32909
- const trail = useRef17(void 0);
32910
- const previous = useRef17(void 0);
32911
- useEffect27(() => {
33052
+ const trail = useRef18(void 0);
33053
+ const previous = useRef18(void 0);
33054
+ useEffect28(() => {
32912
33055
  const before = previous.current;
32913
33056
  previous.current = state2;
32914
33057
  const moved = before !== void 0 && before.step !== state2.step;
@@ -32931,7 +33074,7 @@ function useFlowLog(state2) {
32931
33074
  trail.current = open;
32932
33075
  setDebugRunProgress(flowProgress(open, now));
32933
33076
  }, [state2]);
32934
- useEffect27(
33077
+ useEffect28(
32935
33078
  () => () => {
32936
33079
  const open = trail.current;
32937
33080
  trail.current = void 0;
@@ -33888,9 +34031,9 @@ var init_controller = __esm({
33888
34031
  });
33889
34032
 
33890
34033
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33891
- import { useEffect as useEffect28, useRef as useRef18, useSyncExternalStore } from "react";
34034
+ import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
33892
34035
  function useFlow(start, options = {}) {
33893
- const controller = useRef18();
34036
+ const controller = useRef19();
33894
34037
  if (start && !controller.current) {
33895
34038
  try {
33896
34039
  startWizardLog();
@@ -33907,7 +34050,7 @@ function useFlow(start, options = {}) {
33907
34050
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33908
34051
  () => current?.getState()
33909
34052
  );
33910
- useEffect28(() => {
34053
+ useEffect29(() => {
33911
34054
  if (!start) controller.current = void 0;
33912
34055
  }, [start]);
33913
34056
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33986,7 +34129,7 @@ var init_help_info = __esm({
33986
34129
  });
33987
34130
 
33988
34131
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33989
- import { useEffect as useEffect29, useState as useState31 } from "react";
34132
+ import { useEffect as useEffect30, useState as useState31 } from "react";
33990
34133
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33991
34134
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33992
34135
  function Section({ title, rows }) {
@@ -34000,7 +34143,7 @@ function Section({ title, rows }) {
34000
34143
  }
34001
34144
  function HelpScreen({ onDone }) {
34002
34145
  const [info, setInfo] = useState31();
34003
- useEffect29(() => {
34146
+ useEffect30(() => {
34004
34147
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
34005
34148
  void readHelpInfo().then(setInfo);
34006
34149
  }, []);
@@ -34382,7 +34525,7 @@ var init_AgentStatusBadge = __esm({
34382
34525
  });
34383
34526
 
34384
34527
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
34385
- import { useEffect as useEffect30, useState as useState33 } from "react";
34528
+ import { useEffect as useEffect31, useState as useState33 } from "react";
34386
34529
  import { Box as Box48, Text as Text50 } from "ink";
34387
34530
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
34388
34531
  function StatusHeading() {
@@ -34403,7 +34546,7 @@ function AgentDetail({
34403
34546
  const [testing, setTesting] = useState33(false);
34404
34547
  const [notice, setNotice] = useState33(null);
34405
34548
  const [checks, setChecks] = useState33(void 0);
34406
- useEffect30(() => {
34549
+ useEffect31(() => {
34407
34550
  let active = true;
34408
34551
  setChecks(void 0);
34409
34552
  const timer = setTimeout(() => {
@@ -34495,7 +34638,7 @@ var init_AgentDetail = __esm({
34495
34638
  });
34496
34639
 
34497
34640
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
34498
- import { useEffect as useEffect31, useRef as useRef19, useState as useState34 } from "react";
34641
+ import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
34499
34642
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
34500
34643
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
34501
34644
  function AgentsScreen({ onDone }) {
@@ -34506,7 +34649,7 @@ function AgentsScreen({ onDone }) {
34506
34649
  const [saving, setSaving] = useState34(false);
34507
34650
  const [loadError, setLoadError] = useState34(null);
34508
34651
  const [checks, setChecks] = useState34({});
34509
- const visit = useRef19({
34652
+ const visit = useRef20({
34510
34653
  trail: createTrail(),
34511
34654
  before: void 0,
34512
34655
  environment: void 0,
@@ -34519,7 +34662,7 @@ function AgentsScreen({ onDone }) {
34519
34662
  );
34520
34663
  }
34521
34664
  };
34522
- useEffect31(() => {
34665
+ useEffect32(() => {
34523
34666
  readAgentConfig().then((loaded) => {
34524
34667
  setConfig(loaded);
34525
34668
  inspectAll(loaded);
@@ -34745,7 +34888,7 @@ var init_project_store = __esm({
34745
34888
  });
34746
34889
 
34747
34890
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34748
- import { useEffect as useEffect32, useRef as useRef20, useState as useState35 } from "react";
34891
+ import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
34749
34892
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34750
34893
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34751
34894
  function debugFields(config) {
@@ -34764,14 +34907,14 @@ function ProjectScreen({ onDone }) {
34764
34907
  const [saving, setSaving] = useState35(false);
34765
34908
  const [notice, setNotice] = useState35(null);
34766
34909
  const [loadError, setLoadError] = useState35(null);
34767
- const visit = useRef20({
34910
+ const visit = useRef21({
34768
34911
  trail: createTrail(),
34769
34912
  before: void 0,
34770
34913
  persisted: void 0,
34771
34914
  error: ""
34772
34915
  }).current;
34773
34916
  const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34774
- useEffect32(() => {
34917
+ useEffect33(() => {
34775
34918
  readCredentials().then((cfg) => {
34776
34919
  setConfig(cfg);
34777
34920
  visit.before = snapshotOf(cfg);
@@ -34958,13 +35101,13 @@ var init_ConfigurationScreen = __esm({
34958
35101
  });
34959
35102
 
34960
35103
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34961
- import { useEffect as useEffect33, useState as useState37 } from "react";
35104
+ import { useEffect as useEffect34, useState as useState37 } from "react";
34962
35105
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34963
35106
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34964
35107
  function OptInAnalyticsScreen({ onDone }) {
34965
35108
  const [loading, setLoading] = useState37(true);
34966
35109
  const [enabled, setEnabled] = useState37(true);
34967
- useEffect33(() => {
35110
+ useEffect34(() => {
34968
35111
  readAnalyticsSetting().then((setting) => {
34969
35112
  setEnabled(setting.enabled);
34970
35113
  setLoading(false);
@@ -35027,7 +35170,7 @@ var init_screen12 = __esm({
35027
35170
  });
35028
35171
 
35029
35172
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
35030
- import { useEffect as useEffect34, useRef as useRef21, useState as useState38 } from "react";
35173
+ import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
35031
35174
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
35032
35175
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
35033
35176
  function DebugModeScreen({ onDone }) {
@@ -35037,8 +35180,8 @@ function DebugModeScreen({ onDone }) {
35037
35180
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
35038
35181
  );
35039
35182
  const [notice, setNotice] = useState38(null);
35040
- const visit = useRef21({ trail: createTrail(), before: void 0, error: "" }).current;
35041
- useEffect34(() => {
35183
+ const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
35184
+ useEffect35(() => {
35042
35185
  readDebugModeSetting().then((loaded) => {
35043
35186
  setSetting(loaded);
35044
35187
  setPending(loaded.retentionDays);
@@ -35179,7 +35322,7 @@ var app_exports = {};
35179
35322
  __export(app_exports, {
35180
35323
  runApp: () => runApp
35181
35324
  });
35182
- import { useEffect as useEffect35, useState as useState39 } from "react";
35325
+ import { useEffect as useEffect36, useState as useState39 } from "react";
35183
35326
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
35184
35327
  function App({ importOptions, inkClear }) {
35185
35328
  const [screen, setScreen] = useState39("start");
@@ -35213,7 +35356,7 @@ function App({ importOptions, inkClear }) {
35213
35356
  const [flowStart, setFlowStart] = useState39();
35214
35357
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
35215
35358
  const [importDefaults, setImportDefaults] = useState39();
35216
- useEffect35(() => {
35359
+ useEffect36(() => {
35217
35360
  if (screen !== "import") {
35218
35361
  setImportDefaults(void 0);
35219
35362
  return;
@@ -35286,7 +35429,7 @@ function App({ importOptions, inkClear }) {
35286
35429
  }
35287
35430
  });
35288
35431
  };
35289
- useEffect35(() => {
35432
+ useEffect36(() => {
35290
35433
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
35291
35434
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
35292
35435
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -35308,12 +35451,12 @@ function App({ importOptions, inkClear }) {
35308
35451
  }
35309
35452
  });
35310
35453
  }, [tokensOnly, tokensOnlyRun]);
35311
- useEffect35(() => {
35454
+ useEffect36(() => {
35312
35455
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
35313
35456
  setExtractionRun(void 0);
35314
35457
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
35315
35458
  }, [extraction, extractionRun]);
35316
- useEffect35(() => {
35459
+ useEffect36(() => {
35317
35460
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
35318
35461
  const { extraction: produced, input, generatePromptPath } = scopeRun;
35319
35462
  setGenerationInput({
@@ -35331,7 +35474,7 @@ function App({ importOptions, inkClear }) {
35331
35474
  ...generatePromptPath ? { generatePromptPath } : {}
35332
35475
  });
35333
35476
  }, [scopeFlow, scopeRun, generationInput]);
35334
- useEffect35(() => {
35477
+ useEffect36(() => {
35335
35478
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
35336
35479
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
35337
35480
  inkClear();
@@ -35638,9 +35781,9 @@ var pkg = JSON.parse(
35638
35781
  function createProgram() {
35639
35782
  const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
35640
35783
  registerImportCommand(program, async (options) => {
35641
- const { render: render2 } = await import("ink");
35784
+ const { render: render3 } = await import("ink");
35642
35785
  const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
35643
- await runApp2(render2, options);
35786
+ await runApp2(render3, options);
35644
35787
  });
35645
35788
  program.hook("preAction", async (_thisCommand, actionCommand) => {
35646
35789
  const chain = [];
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.41.1-dev-build-bf9d918c.0",
3
+ "version": "2.41.1-dev-build-c9e39919.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,31 @@
1
+ import type { CdfReviewEntry, ReviewComponentStatus } from './types.js';
2
+ export declare const REVIEW_RUN: {
3
+ readonly flow: "import/review";
4
+ readonly step: "09-review";
5
+ readonly menuOption: "Review";
6
+ };
7
+ export type ReviewTrail = {
8
+ startedAt: number;
9
+ /** How each component arrived, by key. */
10
+ start: Map<string, ReviewComponentStatus>;
11
+ /** The edits in order, as the history labels them (for example `edit-save` or `token-review:size`). */
12
+ actions: string[];
13
+ /** The same edits counted by kind, so a long session still reads at a glance. */
14
+ kinds: Record<string, number>;
15
+ };
16
+ /** What the review starts with: how many components, and how the AI and the checks left them. */
17
+ export declare function reviewInputs(components: CdfReviewEntry[]): Record<string, unknown>;
18
+ export declare function openReviewTrail(components: CdfReviewEntry[], now: number): ReviewTrail;
19
+ export declare function recordReviewAction(trail: ReviewTrail, label: string): void;
20
+ /** What a crash or Ctrl+C writes if it cuts the review short. */
21
+ export declare function reviewProgress(trail: ReviewTrail, components: CdfReviewEntry[], now: number): Record<string, unknown>;
22
+ /** How the review ended. `final` is the count the user confirmed, or undefined when the review was left without finishing. */
23
+ export declare function reviewFinish(trail: ReviewTrail, components: CdfReviewEntry[], now: number, final: {
24
+ accepted: number;
25
+ rejected: number;
26
+ unresolved: number;
27
+ } | undefined): {
28
+ outputs: Record<string, unknown>;
29
+ status: 'success';
30
+ exitMethod: 'saved' | 'discarded';
31
+ };