@contentful/experience-design-system-cli 2.27.2-dev-build-b8a1978.0 → 2.27.3-dev-build-00bd4aa.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +1 -1
- package/dist/src/index.js +75 -176
- package/package.json +5 -5
- package/dist/src/runs/picker-labels.d.ts +0 -24
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -16207,104 +16207,25 @@ var init_path_prompt = __esm({
|
|
|
16207
16207
|
}
|
|
16208
16208
|
});
|
|
16209
16209
|
|
|
16210
|
-
// packages/experience-design-system-cli/src/runs/picker-labels.ts
|
|
16211
|
-
function pathSegments(projectPath) {
|
|
16212
|
-
const normalised = projectPath.replace(/\\/g, "/");
|
|
16213
|
-
return normalised.split("/").filter((s) => s.length > 0);
|
|
16214
|
-
}
|
|
16215
|
-
function disambiguateLabels(runs) {
|
|
16216
|
-
const entries = runs.map((r) => ({
|
|
16217
|
-
id: r.id,
|
|
16218
|
-
segments: pathSegments(r.projectPath),
|
|
16219
|
-
level: 1
|
|
16220
|
-
}));
|
|
16221
|
-
const labelAt = (e) => {
|
|
16222
|
-
if (e.segments.length === 0) return e.id;
|
|
16223
|
-
const take = Math.min(e.level, e.segments.length);
|
|
16224
|
-
return e.segments.slice(-take).join("/");
|
|
16225
|
-
};
|
|
16226
|
-
let stable = false;
|
|
16227
|
-
while (!stable) {
|
|
16228
|
-
stable = true;
|
|
16229
|
-
const groups = /* @__PURE__ */ new Map();
|
|
16230
|
-
for (const e of entries) {
|
|
16231
|
-
const key = labelAt(e);
|
|
16232
|
-
const arr = groups.get(key);
|
|
16233
|
-
if (arr) arr.push(e);
|
|
16234
|
-
else groups.set(key, [e]);
|
|
16235
|
-
}
|
|
16236
|
-
for (const group of groups.values()) {
|
|
16237
|
-
if (group.length < 2) continue;
|
|
16238
|
-
const anyExpandable = group.some((e) => e.level < e.segments.length);
|
|
16239
|
-
if (!anyExpandable) continue;
|
|
16240
|
-
for (const e of group) {
|
|
16241
|
-
if (e.level < e.segments.length) e.level += 1;
|
|
16242
|
-
}
|
|
16243
|
-
stable = false;
|
|
16244
|
-
}
|
|
16245
|
-
}
|
|
16246
|
-
const result = /* @__PURE__ */ new Map();
|
|
16247
|
-
const orderedGroups = [];
|
|
16248
|
-
const byLabel = /* @__PURE__ */ new Map();
|
|
16249
|
-
for (const e of entries) {
|
|
16250
|
-
const key = labelAt(e);
|
|
16251
|
-
const existing = byLabel.get(key);
|
|
16252
|
-
if (existing) {
|
|
16253
|
-
existing.push(e);
|
|
16254
|
-
} else {
|
|
16255
|
-
const fresh = [e];
|
|
16256
|
-
byLabel.set(key, fresh);
|
|
16257
|
-
orderedGroups.push(fresh);
|
|
16258
|
-
}
|
|
16259
|
-
}
|
|
16260
|
-
for (const group of orderedGroups) {
|
|
16261
|
-
if (group.length === 1) {
|
|
16262
|
-
const only = group[0];
|
|
16263
|
-
result.set(only.id, labelAt(only));
|
|
16264
|
-
} else {
|
|
16265
|
-
group.forEach((e, i) => {
|
|
16266
|
-
result.set(e.id, `${labelAt(e)} (#${i + 1})`);
|
|
16267
|
-
});
|
|
16268
|
-
}
|
|
16269
|
-
}
|
|
16270
|
-
return result;
|
|
16271
|
-
}
|
|
16272
|
-
function pad22(n) {
|
|
16273
|
-
return String(n).padStart(2, "0");
|
|
16274
|
-
}
|
|
16275
|
-
function formatRelativeTime(iso, now = /* @__PURE__ */ new Date()) {
|
|
16276
|
-
const then = new Date(iso);
|
|
16277
|
-
if (Number.isNaN(then.getTime())) return iso;
|
|
16278
|
-
const diffMs = now.getTime() - then.getTime();
|
|
16279
|
-
const diffSec = Math.floor(diffMs / 1e3);
|
|
16280
|
-
if (diffSec < 60) return "just now";
|
|
16281
|
-
const diffMin = Math.floor(diffSec / 60);
|
|
16282
|
-
if (diffMin < 60) return `${diffMin}m ago`;
|
|
16283
|
-
const diffHr = Math.floor(diffMin / 60);
|
|
16284
|
-
if (diffHr < 24) return `${diffHr}h ago`;
|
|
16285
|
-
const diffDay = Math.floor(diffHr / 24);
|
|
16286
|
-
if (diffDay < 7) return `${diffDay}d ago`;
|
|
16287
|
-
return `${then.getFullYear()}-${pad22(then.getMonth() + 1)}-${pad22(then.getDate())} ${pad22(then.getHours())}:${pad22(then.getMinutes())}`;
|
|
16288
|
-
}
|
|
16289
|
-
var init_picker_labels = __esm({
|
|
16290
|
-
"packages/experience-design-system-cli/src/runs/picker-labels.ts"() {
|
|
16291
|
-
"use strict";
|
|
16292
|
-
}
|
|
16293
|
-
});
|
|
16294
|
-
|
|
16295
16210
|
// packages/experience-design-system-cli/src/runs/run-picker.tsx
|
|
16296
|
-
import {
|
|
16211
|
+
import { useState as useState10 } from "react";
|
|
16297
16212
|
import { Box as Box20, Text as Text20 } from "ink";
|
|
16298
16213
|
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
16299
|
-
function
|
|
16300
|
-
|
|
16301
|
-
|
|
16302
|
-
|
|
16303
|
-
|
|
16304
|
-
const
|
|
16214
|
+
function formatCreatedAt(iso) {
|
|
16215
|
+
const d = new Date(iso);
|
|
16216
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
16217
|
+
const yyyy = d.getFullYear();
|
|
16218
|
+
const mm = String(d.getMonth() + 1).padStart(2, "0");
|
|
16219
|
+
const dd = String(d.getDate()).padStart(2, "0");
|
|
16220
|
+
const hh = String(d.getHours()).padStart(2, "0");
|
|
16221
|
+
const mi = String(d.getMinutes()).padStart(2, "0");
|
|
16222
|
+
return `${yyyy}-${mm}-${dd} ${hh}:${mi}`;
|
|
16223
|
+
}
|
|
16224
|
+
function runLine(run) {
|
|
16225
|
+
const date = formatCreatedAt(run.createdAt);
|
|
16226
|
+
const pushedTag = run.pushedTo ? "pushed" : "not pushed";
|
|
16305
16227
|
const count = `${run.componentCount} component${run.componentCount === 1 ? "" : "s"}`;
|
|
16306
|
-
|
|
16307
|
-
return `${label} ${when} ${count} ${pushStatus(run)}${agent}`;
|
|
16228
|
+
return `${run.id} - ${date} - ${run.projectPath} (${count}, ${pushedTag})`;
|
|
16308
16229
|
}
|
|
16309
16230
|
function ActionScreen({
|
|
16310
16231
|
runId,
|
|
@@ -16372,12 +16293,6 @@ function RunPicker({ runs, staleRunIds, onSelect, onCancel }) {
|
|
|
16372
16293
|
const [actionRunId, setActionRunId] = useState10(null);
|
|
16373
16294
|
const rows = buildRows(runs, expanded);
|
|
16374
16295
|
const clampedFocus = Math.min(focusIdx, rows.length - 1);
|
|
16375
|
-
const visibleRunLabels = useMemo2(() => {
|
|
16376
|
-
const visibleRuns = rows.filter((r) => r.kind === "run").map((r) => ({ id: r.run.id, projectPath: r.run.projectPath }));
|
|
16377
|
-
return disambiguateLabels(visibleRuns);
|
|
16378
|
-
}, [rows]);
|
|
16379
|
-
const focusedRow = rows[clampedFocus];
|
|
16380
|
-
const focusedRunId = focusedRow?.kind === "run" ? focusedRow.run.id : null;
|
|
16381
16296
|
const selectRow = (row) => {
|
|
16382
16297
|
if (row.kind === "show-all") {
|
|
16383
16298
|
setExpanded(true);
|
|
@@ -16440,10 +16355,9 @@ function RunPicker({ runs, staleRunIds, onSelect, onCancel }) {
|
|
|
16440
16355
|
const cursor = focused ? ">" : " ";
|
|
16441
16356
|
if (row.kind === "run") {
|
|
16442
16357
|
const isStale = staleRunIds?.has(row.run.id) ?? false;
|
|
16443
|
-
const label = visibleRunLabels.get(row.run.id) ?? row.run.projectPath;
|
|
16444
16358
|
return /* @__PURE__ */ jsxs20(Box20, { gap: 1, children: [
|
|
16445
16359
|
/* @__PURE__ */ jsx20(Text20, { color, children: cursor }),
|
|
16446
|
-
/* @__PURE__ */ jsx20(Text20, { color, children: runLine(row.run
|
|
16360
|
+
/* @__PURE__ */ jsx20(Text20, { color, children: runLine(row.run) }),
|
|
16447
16361
|
isStale ? /* @__PURE__ */ jsx20(Text20, { dimColor: true, children: " (stale)" }) : null
|
|
16448
16362
|
] }, `run-${row.run.id}`);
|
|
16449
16363
|
}
|
|
@@ -16462,10 +16376,6 @@ function RunPicker({ runs, staleRunIds, onSelect, onCancel }) {
|
|
|
16462
16376
|
/* @__PURE__ */ jsx20(Text20, { color, children: "[n] Start a new run" })
|
|
16463
16377
|
] }, "new");
|
|
16464
16378
|
}) }),
|
|
16465
|
-
focusedRunId ? /* @__PURE__ */ jsx20(Box20, { marginTop: 1, children: /* @__PURE__ */ jsxs20(Text20, { dimColor: true, children: [
|
|
16466
|
-
"ID: ",
|
|
16467
|
-
focusedRunId
|
|
16468
|
-
] }) }) : null,
|
|
16469
16379
|
/* @__PURE__ */ jsxs20(Box20, { gap: 3, marginTop: 1, children: [
|
|
16470
16380
|
/* @__PURE__ */ jsx20(Text20, { dimColor: true, children: "[j/k] Navigate" }),
|
|
16471
16381
|
/* @__PURE__ */ jsx20(Text20, { dimColor: true, children: "[Enter] Select" }),
|
|
@@ -16479,7 +16389,6 @@ var init_run_picker = __esm({
|
|
|
16479
16389
|
"packages/experience-design-system-cli/src/runs/run-picker.tsx"() {
|
|
16480
16390
|
"use strict";
|
|
16481
16391
|
init_useImmediateInput();
|
|
16482
|
-
init_picker_labels();
|
|
16483
16392
|
COLLAPSED_LIMIT = 10;
|
|
16484
16393
|
COLLAPSE_THRESHOLD = 12;
|
|
16485
16394
|
ACTION_OPTIONS = [
|
|
@@ -17418,7 +17327,7 @@ var init_preview_diff = __esm({
|
|
|
17418
17327
|
});
|
|
17419
17328
|
|
|
17420
17329
|
// packages/experience-design-system-cli/src/import/tui/steps/WizardPreviewStep.tsx
|
|
17421
|
-
import { useState as useState16, useMemo as
|
|
17330
|
+
import { useState as useState16, useMemo as useMemo2 } from "react";
|
|
17422
17331
|
import { Box as Box28, Text as Text28, useStdout as useStdout3 } from "ink";
|
|
17423
17332
|
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
17424
17333
|
function buildPreviewDiffLines(preview) {
|
|
@@ -17524,7 +17433,7 @@ function WizardPreviewStep({
|
|
|
17524
17433
|
const { stdout } = useStdout3();
|
|
17525
17434
|
const terminalRows = stdout?.rows ?? 40;
|
|
17526
17435
|
const viewportHeight = Math.max(terminalRows - 14, 10);
|
|
17527
|
-
const allDiffLines =
|
|
17436
|
+
const allDiffLines = useMemo2(() => {
|
|
17528
17437
|
if (!diffExpanded) return [];
|
|
17529
17438
|
return buildPreviewDiffLines(preview).map((line) => ({
|
|
17530
17439
|
key: line.key,
|
|
@@ -19270,12 +19179,12 @@ var init_lineage = __esm({
|
|
|
19270
19179
|
});
|
|
19271
19180
|
|
|
19272
19181
|
// packages/experience-design-system-cli/src/import/tui/hooks/useLineage.ts
|
|
19273
|
-
import { useMemo as
|
|
19182
|
+
import { useMemo as useMemo3 } from "react";
|
|
19274
19183
|
function useLineage(focusedKey, graph) {
|
|
19275
|
-
const graphKey =
|
|
19276
|
-
const stableGraph =
|
|
19277
|
-
const closures =
|
|
19278
|
-
const entries =
|
|
19184
|
+
const graphKey = useMemo3(() => JSON.stringify(graph), [graph]);
|
|
19185
|
+
const stableGraph = useMemo3(() => graph, [graphKey]);
|
|
19186
|
+
const closures = useMemo3(() => computeAllClosures(stableGraph), [stableGraph]);
|
|
19187
|
+
const entries = useMemo3(() => {
|
|
19279
19188
|
if (!focusedKey) return [];
|
|
19280
19189
|
const name = focusedKey;
|
|
19281
19190
|
const tree = buildAncestorTree(name, stableGraph);
|
|
@@ -19309,7 +19218,7 @@ function useLineage(focusedKey, graph) {
|
|
|
19309
19218
|
}
|
|
19310
19219
|
return out;
|
|
19311
19220
|
}, [focusedKey, stableGraph, closures]);
|
|
19312
|
-
const jumpables =
|
|
19221
|
+
const jumpables = useMemo3(
|
|
19313
19222
|
() => entries.map((entry, i) => ({ entry, i })).filter(({ entry }) => entry.kind === "ancestor" || entry.kind === "descendant"),
|
|
19314
19223
|
[entries]
|
|
19315
19224
|
);
|
|
@@ -19955,7 +19864,7 @@ var init_scope_gate_columns = __esm({
|
|
|
19955
19864
|
|
|
19956
19865
|
// packages/experience-design-system-cli/src/import/tui/steps/ScopeGateStep.tsx
|
|
19957
19866
|
import { Box as Box38, Text as Text40, useStdout as useStdout4 } from "ink";
|
|
19958
|
-
import React20, { useEffect as useEffect10, useMemo as
|
|
19867
|
+
import React20, { useEffect as useEffect10, useMemo as useMemo4, useRef as useRef4, useState as useState21 } from "react";
|
|
19959
19868
|
import { Fragment as Fragment11, jsx as jsx41, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
19960
19869
|
function capReasonForFocusedRow(reason, width) {
|
|
19961
19870
|
const safeWidth = Math.max(20, width);
|
|
@@ -19988,7 +19897,7 @@ function ScopeGateStep({
|
|
|
19988
19897
|
}) {
|
|
19989
19898
|
const { stdout } = useStdout4();
|
|
19990
19899
|
const totalWidth = stdout?.columns ?? 80;
|
|
19991
|
-
const columnPlan =
|
|
19900
|
+
const columnPlan = useMemo4(() => computeColumnWidths(totalWidth), [totalWidth]);
|
|
19992
19901
|
const sidebarWidth = columnPlan.main;
|
|
19993
19902
|
const [userDecisions, setUserDecisions] = useState21(/* @__PURE__ */ new Map());
|
|
19994
19903
|
const [nav, setNav] = useState21({ cursor: 0, scrollOffset: 0 });
|
|
@@ -20023,7 +19932,7 @@ function ScopeGateStep({
|
|
|
20023
19932
|
return next;
|
|
20024
19933
|
});
|
|
20025
19934
|
};
|
|
20026
|
-
const groupedItems =
|
|
19935
|
+
const groupedItems = useMemo4(
|
|
20027
19936
|
() => components.map((c2) => ({
|
|
20028
19937
|
key: c2.name,
|
|
20029
19938
|
entry: toSidebarEntry(c2),
|
|
@@ -20031,21 +19940,21 @@ function ScopeGateStep({
|
|
|
20031
19940
|
})),
|
|
20032
19941
|
[components]
|
|
20033
19942
|
);
|
|
20034
|
-
const graph =
|
|
20035
|
-
const slotCycles =
|
|
19943
|
+
const graph = useMemo4(() => buildComponentGraph(groupedItems), [groupedItems]);
|
|
19944
|
+
const slotCycles = useMemo4(() => {
|
|
20036
19945
|
try {
|
|
20037
19946
|
return findSlotCycles(graph);
|
|
20038
19947
|
} catch {
|
|
20039
19948
|
return [];
|
|
20040
19949
|
}
|
|
20041
19950
|
}, [graph]);
|
|
20042
|
-
const cycleParticipants =
|
|
19951
|
+
const cycleParticipants = useMemo4(() => {
|
|
20043
19952
|
const set = /* @__PURE__ */ new Set();
|
|
20044
19953
|
for (const c2 of slotCycles) for (const n of c2.path) set.add(n);
|
|
20045
19954
|
return set;
|
|
20046
19955
|
}, [slotCycles]);
|
|
20047
|
-
const cycleUnits =
|
|
20048
|
-
const cyclesJumpables =
|
|
19956
|
+
const cycleUnits = useMemo4(() => buildCycleUnits(slotCycles), [slotCycles]);
|
|
19957
|
+
const cyclesJumpables = useMemo4(
|
|
20049
19958
|
() => slotCycles.map((c2, i) => ({
|
|
20050
19959
|
cycleIndex: i,
|
|
20051
19960
|
jumpTarget: c2.path[0]
|
|
@@ -20053,7 +19962,7 @@ function ScopeGateStep({
|
|
|
20053
19962
|
[slotCycles]
|
|
20054
19963
|
);
|
|
20055
19964
|
const hasCycles = slotCycles.length > 0;
|
|
20056
|
-
const closures =
|
|
19965
|
+
const closures = useMemo4(() => computeAllClosures(graph), [graph]);
|
|
20057
19966
|
const [expandedGroups, setExpandedGroups] = useState21(() => {
|
|
20058
19967
|
const seed = new Set(closures.keys());
|
|
20059
19968
|
for (const p of cycleParticipants) seed.add(p);
|
|
@@ -20068,7 +19977,7 @@ function ScopeGateStep({
|
|
|
20068
19977
|
for (const p of cycleParticipants) seed.add(p);
|
|
20069
19978
|
setExpandedGroups(seed);
|
|
20070
19979
|
}, [closures, cycleParticipants]);
|
|
20071
|
-
const hasGroupRoots =
|
|
19980
|
+
const hasGroupRoots = useMemo4(() => {
|
|
20072
19981
|
if (cycleParticipants.size > 0) return true;
|
|
20073
19982
|
for (const c2 of closures.values()) if (c2.nodes.length > 1) return true;
|
|
20074
19983
|
return false;
|
|
@@ -20081,12 +19990,12 @@ function ScopeGateStep({
|
|
|
20081
19990
|
return next;
|
|
20082
19991
|
});
|
|
20083
19992
|
};
|
|
20084
|
-
const brokenKeys =
|
|
19993
|
+
const brokenKeys = useMemo4(() => {
|
|
20085
19994
|
const set = /* @__PURE__ */ new Set();
|
|
20086
19995
|
for (const c2 of components) if (isAiFlagged(c2)) set.add(c2.name);
|
|
20087
19996
|
return set;
|
|
20088
19997
|
}, [components]);
|
|
20089
|
-
const filterVisibleKeys =
|
|
19998
|
+
const filterVisibleKeys = useMemo4(() => {
|
|
20090
19999
|
if (jumpFilterTarget) {
|
|
20091
20000
|
return findAllAncestors2(jumpFilterTarget, graph);
|
|
20092
20001
|
}
|
|
@@ -20102,7 +20011,7 @@ function ScopeGateStep({
|
|
|
20102
20011
|
})();
|
|
20103
20012
|
return intersectFilterKeys(categoryKeys, searchKeys);
|
|
20104
20013
|
}, [jumpFilterTarget, activeFilters, cycleParticipants, brokenKeys, searchQuery, groupedItems, graph]);
|
|
20105
|
-
const visibleRows =
|
|
20014
|
+
const visibleRows = useMemo4(
|
|
20106
20015
|
() => buildVisibleRows({
|
|
20107
20016
|
items: groupedItems,
|
|
20108
20017
|
cycleParticipants,
|
|
@@ -20119,19 +20028,19 @@ function ScopeGateStep({
|
|
|
20119
20028
|
const currentRow = visibleRows[safeCursor];
|
|
20120
20029
|
const currentRowKey = currentRow && currentRow.itemIdx >= 0 ? groupedItems[currentRow.itemIdx]?.key : void 0;
|
|
20121
20030
|
const focusedComponent = currentRowKey ? components.find((c2) => c2.name === currentRowKey) : void 0;
|
|
20122
|
-
const selectionStateByKey =
|
|
20031
|
+
const selectionStateByKey = useMemo4(() => {
|
|
20123
20032
|
const map = /* @__PURE__ */ new Map();
|
|
20124
20033
|
for (const c2 of components) {
|
|
20125
20034
|
map.set(c2.name, getState(c2.name));
|
|
20126
20035
|
}
|
|
20127
20036
|
return map;
|
|
20128
20037
|
}, [components, userDecisions]);
|
|
20129
|
-
const aiFlaggedByKey =
|
|
20038
|
+
const aiFlaggedByKey = useMemo4(() => {
|
|
20130
20039
|
const map = /* @__PURE__ */ new Map();
|
|
20131
20040
|
for (const c2 of components) map.set(c2.name, isAiFlagged(c2));
|
|
20132
20041
|
return map;
|
|
20133
20042
|
}, [components]);
|
|
20134
|
-
const dimPredicate =
|
|
20043
|
+
const dimPredicate = useMemo4(
|
|
20135
20044
|
() => buildFlatDimPredicate({
|
|
20136
20045
|
viewMode: columnOneView,
|
|
20137
20046
|
searchQuery,
|
|
@@ -20204,7 +20113,7 @@ function ScopeGateStep({
|
|
|
20204
20113
|
return { cursor: nextCursor, scrollOffset: nextScroll };
|
|
20205
20114
|
});
|
|
20206
20115
|
}, [visibleRows]);
|
|
20207
|
-
const searchMatches =
|
|
20116
|
+
const searchMatches = useMemo4(() => {
|
|
20208
20117
|
if (!searchQuery) return [];
|
|
20209
20118
|
return components.filter((c2) => fuzzyMatches(searchQuery, c2.name)).map((c2) => c2.name);
|
|
20210
20119
|
}, [components, searchQuery]);
|
|
@@ -20600,13 +20509,13 @@ function ScopeGateStep({
|
|
|
20600
20509
|
return;
|
|
20601
20510
|
}
|
|
20602
20511
|
});
|
|
20603
|
-
const includedCount =
|
|
20512
|
+
const includedCount = useMemo4(() => components.filter((c2) => isIncluded(c2.name)).length, [components, userDecisions]);
|
|
20604
20513
|
const hasAnyAi = components.some(isAiFlagged);
|
|
20605
20514
|
const aiExcludedCount = components.filter(isAiFlagged).length;
|
|
20606
20515
|
const aiExcludedWithReasons = components.filter(
|
|
20607
20516
|
(c2) => isAiFlagged(c2) && c2.aiReason !== null && c2.aiReason !== void 0 && c2.aiReason !== ""
|
|
20608
20517
|
);
|
|
20609
|
-
const aiRows =
|
|
20518
|
+
const aiRows = useMemo4(
|
|
20610
20519
|
() => aiExcludedWithReasons.map((c2) => ({
|
|
20611
20520
|
label: `${c2.name} \u2014 ${c2.aiReason}`,
|
|
20612
20521
|
jumpTarget: c2.name
|
|
@@ -20617,15 +20526,15 @@ function ScopeGateStep({
|
|
|
20617
20526
|
const nothingIncluded = components.length > 0 && components.every((c2) => !isIncluded(c2.name));
|
|
20618
20527
|
const totalComponents = components.length;
|
|
20619
20528
|
const totalMatches = searchQuery ? searchMatches.length : 0;
|
|
20620
|
-
const addedComponents =
|
|
20529
|
+
const addedComponents = useMemo4(
|
|
20621
20530
|
() => buildAddedComponentsList(components, selectionStateByKey, cycleParticipants),
|
|
20622
20531
|
[components, selectionStateByKey, cycleParticipants]
|
|
20623
20532
|
);
|
|
20624
|
-
const addedGroups =
|
|
20533
|
+
const addedGroups = useMemo4(
|
|
20625
20534
|
() => buildAddedGroupsList(closures, selectionStateByKey, cycleParticipants, cycleUnits),
|
|
20626
20535
|
[closures, selectionStateByKey, cycleParticipants, cycleUnits]
|
|
20627
20536
|
);
|
|
20628
|
-
const counters =
|
|
20537
|
+
const counters = useMemo4(
|
|
20629
20538
|
() => computeCounters(components, closures, selectionStateByKey),
|
|
20630
20539
|
[components, closures, selectionStateByKey]
|
|
20631
20540
|
);
|
|
@@ -21086,7 +20995,7 @@ var init_ScopeGateStep = __esm({
|
|
|
21086
20995
|
|
|
21087
20996
|
// packages/experience-design-system-cli/src/import/tui/steps/AtomicScopeGateStep.tsx
|
|
21088
20997
|
import { Box as Box39, Text as Text41, useStdout as useStdout5 } from "ink";
|
|
21089
|
-
import React21, { useMemo as
|
|
20998
|
+
import React21, { useMemo as useMemo5, useState as useState22 } from "react";
|
|
21090
20999
|
import { jsx as jsx42, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
21091
21000
|
function truncateReason(reason) {
|
|
21092
21001
|
if (reason === null || reason === void 0 || reason === "") return "<no reason given>";
|
|
@@ -21233,7 +21142,7 @@ function AtomicScopeGateStep({
|
|
|
21233
21142
|
}
|
|
21234
21143
|
});
|
|
21235
21144
|
const total = flatList.length;
|
|
21236
|
-
const includedCount =
|
|
21145
|
+
const includedCount = useMemo5(
|
|
21237
21146
|
() => flatList.filter((c2) => isIncluded(c2)).length,
|
|
21238
21147
|
[components, userExcluded, userUnExcluded]
|
|
21239
21148
|
);
|
|
@@ -23758,7 +23667,7 @@ var init_history = __esm({
|
|
|
23758
23667
|
});
|
|
23759
23668
|
|
|
23760
23669
|
// packages/experience-design-system-cli/src/import/tui/steps/GenerateReviewStep.tsx
|
|
23761
|
-
import { useEffect as useEffect13, useMemo as
|
|
23670
|
+
import { useEffect as useEffect13, useMemo as useMemo6, useRef as useRef7, useState as useState26 } from "react";
|
|
23762
23671
|
import { Box as Box44, Text as Text46, useStdout as useStdout6 } from "ink";
|
|
23763
23672
|
import { Fragment as Fragment14, jsx as jsx47, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
23764
23673
|
function sortComponentsForSidebar2(components, cycleParticipants) {
|
|
@@ -24054,12 +23963,12 @@ function GenerateReviewStep({
|
|
|
24054
23963
|
} catch {
|
|
24055
23964
|
}
|
|
24056
23965
|
};
|
|
24057
|
-
const componentGraph =
|
|
24058
|
-
const sidebarGraph =
|
|
23966
|
+
const componentGraph = useMemo6(() => buildComponentGraph(components), [components]);
|
|
23967
|
+
const sidebarGraph = useMemo6(
|
|
24059
23968
|
() => buildComponentGraph(components, { stripRejectedEdges: true }),
|
|
24060
23969
|
[components]
|
|
24061
23970
|
);
|
|
24062
|
-
const closures =
|
|
23971
|
+
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
24063
23972
|
useEffect13(() => {
|
|
24064
23973
|
if (seededGroupsRef.current) return;
|
|
24065
23974
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
@@ -24068,14 +23977,14 @@ function GenerateReviewStep({
|
|
|
24068
23977
|
for (const cyc of slotCycles) for (const p of cyc.path) seed.add(p);
|
|
24069
23978
|
setExpandedGroups(seed);
|
|
24070
23979
|
}, [closures, slotCycles]);
|
|
24071
|
-
const directIssues =
|
|
23980
|
+
const directIssues = useMemo6(() => {
|
|
24072
23981
|
const m = /* @__PURE__ */ new Map();
|
|
24073
23982
|
for (const c2 of components) {
|
|
24074
23983
|
if (c2.status === "rejected") m.set(c2.key, "error");
|
|
24075
23984
|
}
|
|
24076
23985
|
return m;
|
|
24077
23986
|
}, [components]);
|
|
24078
|
-
const cycleView =
|
|
23987
|
+
const cycleView = useMemo6(() => computeCycleView(components), [components]);
|
|
24079
23988
|
useEffect13(() => {
|
|
24080
23989
|
const decision = computeAutoRejectDecision({
|
|
24081
23990
|
loading,
|
|
@@ -24185,7 +24094,7 @@ function GenerateReviewStep({
|
|
|
24185
24094
|
setLoadError(String(e));
|
|
24186
24095
|
}
|
|
24187
24096
|
};
|
|
24188
|
-
const groupedItemsMemo =
|
|
24097
|
+
const groupedItemsMemo = useMemo6(
|
|
24189
24098
|
() => components.map((c2) => ({
|
|
24190
24099
|
key: c2.key,
|
|
24191
24100
|
entry: c2.entry,
|
|
@@ -24193,12 +24102,12 @@ function GenerateReviewStep({
|
|
|
24193
24102
|
})),
|
|
24194
24103
|
[components, directIssues]
|
|
24195
24104
|
);
|
|
24196
|
-
const brokenKeys =
|
|
24105
|
+
const brokenKeys = useMemo6(
|
|
24197
24106
|
() => new Set(breakingChanges.map((b) => b.componentName)),
|
|
24198
24107
|
[breakingChanges]
|
|
24199
24108
|
);
|
|
24200
|
-
const breakingRows =
|
|
24201
|
-
const filterVisibleKeys =
|
|
24109
|
+
const breakingRows = useMemo6(() => buildBreakingRows(breakingChanges), [breakingChanges]);
|
|
24110
|
+
const filterVisibleKeys = useMemo6(() => {
|
|
24202
24111
|
if (jumpFilterTarget) {
|
|
24203
24112
|
return findAllAncestors2(jumpFilterTarget, sidebarGraph);
|
|
24204
24113
|
}
|
|
@@ -24214,7 +24123,7 @@ function GenerateReviewStep({
|
|
|
24214
24123
|
})();
|
|
24215
24124
|
return intersectFilterKeys(categoryKeys, searchKeys);
|
|
24216
24125
|
}, [jumpFilterTarget, activeFilters, cycleView, brokenKeys, searchQuery, groupedItemsMemo, sidebarGraph]);
|
|
24217
|
-
const visibleRowsMemo =
|
|
24126
|
+
const visibleRowsMemo = useMemo6(
|
|
24218
24127
|
() => buildVisibleRows({
|
|
24219
24128
|
items: groupedItemsMemo,
|
|
24220
24129
|
cycleParticipants: cycleView.structural,
|
|
@@ -24225,7 +24134,7 @@ function GenerateReviewStep({
|
|
|
24225
24134
|
}),
|
|
24226
24135
|
[groupedItemsMemo, cycleView, expandedGroups, columnOneView, sidebarGraph, filterVisibleKeys]
|
|
24227
24136
|
);
|
|
24228
|
-
const selectableRowPositions =
|
|
24137
|
+
const selectableRowPositions = useMemo6(() => {
|
|
24229
24138
|
const out = [];
|
|
24230
24139
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
24231
24140
|
if (visibleRowsMemo[i].itemIdx >= 0) out.push(i);
|
|
@@ -24282,7 +24191,7 @@ function GenerateReviewStep({
|
|
|
24282
24191
|
db.close();
|
|
24283
24192
|
}
|
|
24284
24193
|
}, [selectedIdx, components, extractSessionId]);
|
|
24285
|
-
const renderStatusByKey =
|
|
24194
|
+
const renderStatusByKey = useMemo6(() => {
|
|
24286
24195
|
const merged = /* @__PURE__ */ new Map();
|
|
24287
24196
|
for (const closure of closures.values()) {
|
|
24288
24197
|
const per = computeRenderStatuses(closure, directIssues);
|
|
@@ -24295,7 +24204,7 @@ function GenerateReviewStep({
|
|
|
24295
24204
|
}
|
|
24296
24205
|
return merged;
|
|
24297
24206
|
}, [closures, directIssues]);
|
|
24298
|
-
const selectionStateByKey =
|
|
24207
|
+
const selectionStateByKey = useMemo6(() => {
|
|
24299
24208
|
const map = /* @__PURE__ */ new Map();
|
|
24300
24209
|
for (const c2 of components) {
|
|
24301
24210
|
if (c2.status === "accepted") map.set(c2.key, "accepted");
|
|
@@ -24304,7 +24213,7 @@ function GenerateReviewStep({
|
|
|
24304
24213
|
}
|
|
24305
24214
|
return map;
|
|
24306
24215
|
}, [components]);
|
|
24307
|
-
const searchMatches =
|
|
24216
|
+
const searchMatches = useMemo6(() => {
|
|
24308
24217
|
if (!searchQuery) return [];
|
|
24309
24218
|
const out = [];
|
|
24310
24219
|
for (const pos of selectableRowPositions) {
|
|
@@ -24314,7 +24223,7 @@ function GenerateReviewStep({
|
|
|
24314
24223
|
}
|
|
24315
24224
|
return out;
|
|
24316
24225
|
}, [searchQuery, selectableRowPositions, visibleRowsMemo, components]);
|
|
24317
|
-
const searchMatchCount =
|
|
24226
|
+
const searchMatchCount = useMemo6(() => {
|
|
24318
24227
|
if (searchMatches.length === 0) return 0;
|
|
24319
24228
|
const seen = /* @__PURE__ */ new Set();
|
|
24320
24229
|
for (const pos of searchMatches) {
|
|
@@ -24323,7 +24232,7 @@ function GenerateReviewStep({
|
|
|
24323
24232
|
}
|
|
24324
24233
|
return seen.size;
|
|
24325
24234
|
}, [searchMatches, visibleRowsMemo]);
|
|
24326
|
-
const dimPredicate =
|
|
24235
|
+
const dimPredicate = useMemo6(
|
|
24327
24236
|
() => buildFlatDimPredicate({
|
|
24328
24237
|
viewMode: columnOneView,
|
|
24329
24238
|
searchQuery,
|
|
@@ -24391,7 +24300,7 @@ function GenerateReviewStep({
|
|
|
24391
24300
|
setDraftValue("");
|
|
24392
24301
|
setSaveError(null);
|
|
24393
24302
|
};
|
|
24394
|
-
const breakEdges =
|
|
24303
|
+
const breakEdges = useMemo6(() => {
|
|
24395
24304
|
const cycle = slotCycles[cyclesCursor];
|
|
24396
24305
|
if (!cycle) return [];
|
|
24397
24306
|
return enumerateCycleBreaks(cycle, components);
|
|
@@ -27558,19 +27467,6 @@ If using a custom --host, make sure the space exists on that host.`
|
|
|
27558
27467
|
summary
|
|
27559
27468
|
};
|
|
27560
27469
|
}
|
|
27561
|
-
const pushSucceeded = pushResult.componentTypes.failed === 0 && pushResult.designTokens.failed === 0 && operation.sys.status !== "failed";
|
|
27562
|
-
if (pushSucceeded && state.lastRunId) {
|
|
27563
|
-
try {
|
|
27564
|
-
await updateRun(state.lastRunId, {
|
|
27565
|
-
pushedTo: { spaceId, environmentId, host: resolvedHost }
|
|
27566
|
-
});
|
|
27567
|
-
} catch (err) {
|
|
27568
|
-
process.stderr.write(
|
|
27569
|
-
`Warning: failed to record push target on run: ${err instanceof Error ? err.message : String(err)}
|
|
27570
|
-
`
|
|
27571
|
-
);
|
|
27572
|
-
}
|
|
27573
|
-
}
|
|
27574
27470
|
update({ step: "done", pushResult });
|
|
27575
27471
|
} catch (e) {
|
|
27576
27472
|
let msg;
|
|
@@ -28855,6 +28751,9 @@ function isWithinRoot(path, root) {
|
|
|
28855
28751
|
const relativePath = relative2(root, path);
|
|
28856
28752
|
return relativePath !== ".." && !relativePath.startsWith(`..${sep}`) && !isAbsolute2(relativePath);
|
|
28857
28753
|
}
|
|
28754
|
+
function toPosixPath(path) {
|
|
28755
|
+
return sep === "/" ? path : path.split(sep).join("/");
|
|
28756
|
+
}
|
|
28858
28757
|
function parseImportedNames2(importClause) {
|
|
28859
28758
|
const names = [];
|
|
28860
28759
|
const parts = importClause.split(",").map((part) => part.trim());
|
|
@@ -28881,11 +28780,11 @@ function resolveLocalImportPath(source, componentDirectory, root, filePaths) {
|
|
|
28881
28780
|
];
|
|
28882
28781
|
for (const candidate of candidates) {
|
|
28883
28782
|
if (filePaths.has(candidate) && isWithinRoot(candidate, root)) {
|
|
28884
|
-
return relative2(root, candidate);
|
|
28783
|
+
return toPosixPath(relative2(root, candidate));
|
|
28885
28784
|
}
|
|
28886
28785
|
}
|
|
28887
28786
|
if (isWithinRoot(basePath, root)) {
|
|
28888
|
-
return relative2(root, basePath);
|
|
28787
|
+
return toPosixPath(relative2(root, basePath));
|
|
28889
28788
|
}
|
|
28890
28789
|
return void 0;
|
|
28891
28790
|
}
|
|
@@ -28928,14 +28827,14 @@ function extractSnippet(text, token, maxChars) {
|
|
|
28928
28827
|
}
|
|
28929
28828
|
function summarizeSiblingFiles(root, files, currentFile) {
|
|
28930
28829
|
return files.filter((file) => file.absolutePath !== currentFile).slice(0, MAX_SIBLING_FILES).map((file) => ({
|
|
28931
|
-
path: relative2(root, file.absolutePath),
|
|
28830
|
+
path: toPosixPath(relative2(root, file.absolutePath)),
|
|
28932
28831
|
exports: parseExports(file.text),
|
|
28933
28832
|
codeSnippet: truncateText(file.text, MAX_SIBLING_SNIPPET_CHARS)
|
|
28934
28833
|
}));
|
|
28935
28834
|
}
|
|
28936
28835
|
function findResolverReferences(root, files, componentName, currentFile) {
|
|
28937
28836
|
return files.filter((file) => file.absolutePath !== currentFile).filter((file) => file.text.includes(componentName)).filter((file) => RESOLVER_HINT_PATTERN.test(file.absolutePath) || RESOLVER_HINT_PATTERN.test(file.text)).slice(0, MAX_REFERENCE_SNIPPETS).map((file) => ({
|
|
28938
|
-
path: relative2(root, file.absolutePath),
|
|
28837
|
+
path: toPosixPath(relative2(root, file.absolutePath)),
|
|
28939
28838
|
snippet: extractSnippet(file.text, componentName, MAX_REFERENCE_CHARS)
|
|
28940
28839
|
}));
|
|
28941
28840
|
}
|
|
@@ -28947,7 +28846,7 @@ function findParentUsageSite(root, files, componentName, currentFile) {
|
|
|
28947
28846
|
const match2 = candidates[0];
|
|
28948
28847
|
if (!match2) return void 0;
|
|
28949
28848
|
return {
|
|
28950
|
-
path: relative2(root, match2.absolutePath),
|
|
28849
|
+
path: toPosixPath(relative2(root, match2.absolutePath)),
|
|
28951
28850
|
snippet: extractSnippet(match2.text, componentName, MAX_REFERENCE_CHARS)
|
|
28952
28851
|
};
|
|
28953
28852
|
}
|
|
@@ -28958,7 +28857,7 @@ async function buildRepoContextIndex(root, filePaths) {
|
|
|
28958
28857
|
filePaths.map(
|
|
28959
28858
|
async (absolutePath) => ({
|
|
28960
28859
|
absolutePath,
|
|
28961
|
-
relativePath: relative2(resolvedRoot, absolutePath),
|
|
28860
|
+
relativePath: toPosixPath(relative2(resolvedRoot, absolutePath)),
|
|
28962
28861
|
directory: dirname10(absolutePath),
|
|
28963
28862
|
text: await readFile12(absolutePath, "utf8").catch(() => "")
|
|
28964
28863
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.3-dev-build-00bd4aa.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"svelte": "^5.56.4",
|
|
40
40
|
"ts-morph": "^27.0.2",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
|
-
"@contentful/experience-design-system-types": "2.27.
|
|
42
|
+
"@contentful/experience-design-system-types": "2.27.3-dev-build-00bd4aa.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"ink-testing-library": "^4.0.0",
|
|
52
52
|
"typescript-eslint": "^8.67.0",
|
|
53
53
|
"vitest": "^4.0.16",
|
|
54
|
-
"@contentful/experience-design-system-client": "2.27.
|
|
55
|
-
"@contentful/experience-design-system-generation": "2.27.
|
|
56
|
-
"@contentful/experience-design-system-extraction": "2.27.
|
|
54
|
+
"@contentful/experience-design-system-client": "2.27.3-dev-build-00bd4aa.0",
|
|
55
|
+
"@contentful/experience-design-system-generation": "2.27.3-dev-build-00bd4aa.0",
|
|
56
|
+
"@contentful/experience-design-system-extraction": "2.27.3-dev-build-00bd4aa.0"
|
|
57
57
|
},
|
|
58
58
|
"repository": {
|
|
59
59
|
"type": "git",
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type LabelInput = {
|
|
2
|
-
id: string;
|
|
3
|
-
projectPath: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Map each run to a display label. Labels start as the project path's leaf
|
|
7
|
-
* directory and expand one segment at a time (`<parent>/<leaf>`,
|
|
8
|
-
* `<gp>/<parent>/<leaf>`, …) until every label in the input set is unique.
|
|
9
|
-
* When two rows share the exact same absolute path, the collision is broken
|
|
10
|
-
* with numeric suffixes (`(#1)`, `(#2)`, …) in input order.
|
|
11
|
-
*/
|
|
12
|
-
export declare function disambiguateLabels(runs: readonly LabelInput[]): Map<string, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Format an ISO-8601 timestamp relative to `now`. Buckets:
|
|
15
|
-
* < 60s → "just now"
|
|
16
|
-
* < 60 min → "Nm ago"
|
|
17
|
-
* < 24 h → "Nh ago"
|
|
18
|
-
* < 7 days → "Nd ago"
|
|
19
|
-
* otherwise → "YYYY-MM-DD HH:MM" (local time)
|
|
20
|
-
*
|
|
21
|
-
* Future timestamps (created after `now`) also render as "just now" — they
|
|
22
|
-
* only occur with clock skew and the delta is not worth surfacing.
|
|
23
|
-
*/
|
|
24
|
-
export declare function formatRelativeTime(iso: string, now?: Date): string;
|