@contentful/experience-design-system-cli 2.37.1-dev-build-7652d7c0.0 → 2.37.1-dev-build-eed963c1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +235 -457
- package/dist/index.js +1547 -1961
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.d.ts +1 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/step-filters.d.ts +4 -0
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate.d.ts +1 -0
- package/legacy/dist/src/analytics/apply.d.ts +6 -0
- package/legacy/dist/src/analytics/client.d.ts +8 -0
- package/legacy/dist/src/analytics/constants.d.ts +4 -0
- package/legacy/dist/src/analytics/exit.d.ts +1 -1
- package/legacy/dist/src/analytics/index.d.ts +5 -2
- package/legacy/dist/src/analytics/normalize.d.ts +3 -0
- package/legacy/dist/src/analytics/os.d.ts +2 -0
- package/legacy/dist/src/analytics/session.d.ts +3 -0
- package/legacy/dist/src/analytics/tracker.d.ts +16 -0
- package/legacy/dist/src/analytics/types.d.ts +28 -0
- package/legacy/dist/src/index.js +19243 -19358
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -4733,7 +4733,7 @@ async function getCliCacheVersion() {
|
|
|
4733
4733
|
return _cliCacheVersionCache;
|
|
4734
4734
|
}
|
|
4735
4735
|
}
|
|
4736
|
-
function storeExtractCache(db, filePath, fileHash,
|
|
4736
|
+
function storeExtractCache(db, filePath, fileHash, cliVersion, components) {
|
|
4737
4737
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4738
4738
|
const componentsJson = JSON.stringify(components);
|
|
4739
4739
|
db.prepare(`INSERT INTO extract_cache (file_path, file_hash, cli_version, created_at, updated_at, components_json)
|
|
@@ -4741,12 +4741,12 @@ function storeExtractCache(db, filePath, fileHash, cliVersion2, components) {
|
|
|
4741
4741
|
ON CONFLICT(file_hash, cli_version) DO UPDATE SET
|
|
4742
4742
|
file_path = excluded.file_path,
|
|
4743
4743
|
updated_at = excluded.updated_at,
|
|
4744
|
-
components_json = excluded.components_json`).run(filePath, fileHash,
|
|
4744
|
+
components_json = excluded.components_json`).run(filePath, fileHash, cliVersion, now, now, componentsJson);
|
|
4745
4745
|
}
|
|
4746
|
-
function lookupExtractCache(db, fileHash,
|
|
4746
|
+
function lookupExtractCache(db, fileHash, cliVersion) {
|
|
4747
4747
|
const row = db.prepare(`SELECT file_path, file_hash, cli_version, created_at, updated_at, components_json
|
|
4748
4748
|
FROM extract_cache
|
|
4749
|
-
WHERE file_hash = ? AND cli_version = ?`).get(fileHash,
|
|
4749
|
+
WHERE file_hash = ? AND cli_version = ?`).get(fileHash, cliVersion);
|
|
4750
4750
|
if (!row)
|
|
4751
4751
|
return null;
|
|
4752
4752
|
let components = [];
|
|
@@ -4764,31 +4764,31 @@ function lookupExtractCache(db, fileHash, cliVersion2) {
|
|
|
4764
4764
|
components
|
|
4765
4765
|
};
|
|
4766
4766
|
}
|
|
4767
|
-
function storeCompositionCache(db, inputHash,
|
|
4767
|
+
function storeCompositionCache(db, inputHash, cliVersion, agentOutput) {
|
|
4768
4768
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4769
4769
|
db.prepare(`INSERT INTO composition_cache (input_hash, cli_version, agent_output, created_at, updated_at)
|
|
4770
4770
|
VALUES (?, ?, ?, ?, ?)
|
|
4771
4771
|
ON CONFLICT(input_hash, cli_version) DO UPDATE SET
|
|
4772
4772
|
agent_output = excluded.agent_output,
|
|
4773
|
-
updated_at = excluded.updated_at`).run(inputHash,
|
|
4773
|
+
updated_at = excluded.updated_at`).run(inputHash, cliVersion, agentOutput, now, now);
|
|
4774
4774
|
}
|
|
4775
|
-
function lookupCompositionCache(db, inputHash,
|
|
4776
|
-
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash,
|
|
4775
|
+
function lookupCompositionCache(db, inputHash, cliVersion) {
|
|
4776
|
+
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash, cliVersion);
|
|
4777
4777
|
return row ? row.agent_output : null;
|
|
4778
4778
|
}
|
|
4779
|
-
function storeSelectCache(db, componentHash, promptHash,
|
|
4779
|
+
function storeSelectCache(db, componentHash, promptHash, cliVersion, decision, reason) {
|
|
4780
4780
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4781
4781
|
db.prepare(`INSERT INTO select_cache (component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at)
|
|
4782
4782
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
4783
4783
|
ON CONFLICT(component_hash, prompt_hash, cli_version) DO UPDATE SET
|
|
4784
4784
|
decision = excluded.decision,
|
|
4785
4785
|
reason = excluded.reason,
|
|
4786
|
-
updated_at = excluded.updated_at`).run(componentHash, promptHash,
|
|
4786
|
+
updated_at = excluded.updated_at`).run(componentHash, promptHash, cliVersion, decision, reason, now, now);
|
|
4787
4787
|
}
|
|
4788
|
-
function lookupSelectCache(db, componentHash, promptHash,
|
|
4788
|
+
function lookupSelectCache(db, componentHash, promptHash, cliVersion) {
|
|
4789
4789
|
const row = db.prepare(`SELECT component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at
|
|
4790
4790
|
FROM select_cache
|
|
4791
|
-
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash,
|
|
4791
|
+
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash, cliVersion);
|
|
4792
4792
|
if (!row)
|
|
4793
4793
|
return null;
|
|
4794
4794
|
return {
|
|
@@ -12880,60 +12880,6 @@ async function loadAcceptedNames(sessionId) {
|
|
|
12880
12880
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/index.js
|
|
12881
12881
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
12882
12882
|
|
|
12883
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
|
|
12884
|
-
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
12885
|
-
var ADJECTIVES2 = [
|
|
12886
|
-
"bright",
|
|
12887
|
-
"calm",
|
|
12888
|
-
"dark",
|
|
12889
|
-
"fast",
|
|
12890
|
-
"green",
|
|
12891
|
-
"happy",
|
|
12892
|
-
"keen",
|
|
12893
|
-
"light",
|
|
12894
|
-
"long",
|
|
12895
|
-
"loud",
|
|
12896
|
-
"pale",
|
|
12897
|
-
"quick",
|
|
12898
|
-
"sharp",
|
|
12899
|
-
"slow",
|
|
12900
|
-
"soft",
|
|
12901
|
-
"warm",
|
|
12902
|
-
"wild",
|
|
12903
|
-
"wise"
|
|
12904
|
-
];
|
|
12905
|
-
var NOUNS2 = [
|
|
12906
|
-
"cloud",
|
|
12907
|
-
"creek",
|
|
12908
|
-
"dawn",
|
|
12909
|
-
"dusk",
|
|
12910
|
-
"field",
|
|
12911
|
-
"flame",
|
|
12912
|
-
"frost",
|
|
12913
|
-
"grove",
|
|
12914
|
-
"hill",
|
|
12915
|
-
"lake",
|
|
12916
|
-
"leaf",
|
|
12917
|
-
"moon",
|
|
12918
|
-
"peak",
|
|
12919
|
-
"rain",
|
|
12920
|
-
"river",
|
|
12921
|
-
"rock",
|
|
12922
|
-
"snow",
|
|
12923
|
-
"star",
|
|
12924
|
-
"storm",
|
|
12925
|
-
"tide",
|
|
12926
|
-
"tree",
|
|
12927
|
-
"wave",
|
|
12928
|
-
"wind"
|
|
12929
|
-
];
|
|
12930
|
-
function generateSessionId2() {
|
|
12931
|
-
const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
|
|
12932
|
-
const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
|
|
12933
|
-
const hex = randomBytes3(2).toString("hex");
|
|
12934
|
-
return `${adj}-${noun}-${hex}`;
|
|
12935
|
-
}
|
|
12936
|
-
|
|
12937
12883
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/migration.js
|
|
12938
12884
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
12939
12885
|
|
|
@@ -14739,172 +14685,6 @@ function loadTokenLeaves(db, sessionId) {
|
|
|
14739
14685
|
return db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path").all(sessionId);
|
|
14740
14686
|
}
|
|
14741
14687
|
|
|
14742
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/cli-info.js
|
|
14743
|
-
var cliVersionString = "0.0.0-unknown";
|
|
14744
|
-
function cliVersion() {
|
|
14745
|
-
return cliVersionString;
|
|
14746
|
-
}
|
|
14747
|
-
|
|
14748
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/opt-out.js
|
|
14749
|
-
var persistedDisabled = false;
|
|
14750
|
-
function analyticsEnabled() {
|
|
14751
|
-
return !persistedDisabled && !process.env["DISABLE_ANALYTICS"];
|
|
14752
|
-
}
|
|
14753
|
-
|
|
14754
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js
|
|
14755
|
-
import { Analytics } from "@segment/analytics-node";
|
|
14756
|
-
var DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
14757
|
-
var analyticsClient = null;
|
|
14758
|
-
function resolveWriteKey() {
|
|
14759
|
-
const key = (process.env["SEGMENT_WRITE_KEY"] ?? "").trim();
|
|
14760
|
-
return key.length > 0 ? key : DEFAULT_WRITE_KEY;
|
|
14761
|
-
}
|
|
14762
|
-
function getClient() {
|
|
14763
|
-
if (!analyticsEnabled())
|
|
14764
|
-
return null;
|
|
14765
|
-
const writeKey = resolveWriteKey();
|
|
14766
|
-
if (!writeKey)
|
|
14767
|
-
return null;
|
|
14768
|
-
if (!analyticsClient) {
|
|
14769
|
-
analyticsClient = new Analytics({ writeKey });
|
|
14770
|
-
analyticsClient.on("error", () => {
|
|
14771
|
-
});
|
|
14772
|
-
}
|
|
14773
|
-
return analyticsClient;
|
|
14774
|
-
}
|
|
14775
|
-
async function trackEvent(event, properties, anonymousId, options) {
|
|
14776
|
-
const client2 = getClient();
|
|
14777
|
-
if (!client2)
|
|
14778
|
-
return;
|
|
14779
|
-
try {
|
|
14780
|
-
client2.track({
|
|
14781
|
-
event,
|
|
14782
|
-
properties,
|
|
14783
|
-
anonymousId,
|
|
14784
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
14785
|
-
});
|
|
14786
|
-
if (options?.flush)
|
|
14787
|
-
await flushAnalytics();
|
|
14788
|
-
} catch {
|
|
14789
|
-
}
|
|
14790
|
-
}
|
|
14791
|
-
async function flushAnalytics() {
|
|
14792
|
-
if (!analyticsClient)
|
|
14793
|
-
return;
|
|
14794
|
-
try {
|
|
14795
|
-
await analyticsClient.closeAndFlush();
|
|
14796
|
-
} catch {
|
|
14797
|
-
} finally {
|
|
14798
|
-
analyticsClient = null;
|
|
14799
|
-
}
|
|
14800
|
-
}
|
|
14801
|
-
|
|
14802
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js
|
|
14803
|
-
var ANALYTICS_SESSION_ENV = "EDS_ANALYTICS_SESSION_ID";
|
|
14804
|
-
var IMPORT_PIPELINE_ENV = "EDS_IMPORT_PIPELINE";
|
|
14805
|
-
|
|
14806
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/session.js
|
|
14807
|
-
function resolveAnalyticsSessionId(explicit) {
|
|
14808
|
-
const inherited = process.env[ANALYTICS_SESSION_ENV]?.trim();
|
|
14809
|
-
if (inherited)
|
|
14810
|
-
return inherited;
|
|
14811
|
-
const passed = explicit?.trim();
|
|
14812
|
-
if (passed)
|
|
14813
|
-
return passed;
|
|
14814
|
-
return generateSessionId2();
|
|
14815
|
-
}
|
|
14816
|
-
function isPipelineAnalyticsChild() {
|
|
14817
|
-
return Boolean(process.env[ANALYTICS_SESSION_ENV]?.trim());
|
|
14818
|
-
}
|
|
14819
|
-
|
|
14820
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/pending-command.js
|
|
14821
|
-
var state = {
|
|
14822
|
-
pending: null,
|
|
14823
|
-
sessionId: void 0,
|
|
14824
|
-
sessionStartedEmitted: false
|
|
14825
|
-
};
|
|
14826
|
-
function isPipelineStep() {
|
|
14827
|
-
return process.env[IMPORT_PIPELINE_ENV] === "1";
|
|
14828
|
-
}
|
|
14829
|
-
function buildBaseProps(command) {
|
|
14830
|
-
return {
|
|
14831
|
-
dsi_session_id: state.sessionId,
|
|
14832
|
-
command,
|
|
14833
|
-
...isPipelineStep() ? { is_pipeline_step: true } : {}
|
|
14834
|
-
};
|
|
14835
|
-
}
|
|
14836
|
-
function mergeContext(target, source) {
|
|
14837
|
-
if (source.space_key !== void 0)
|
|
14838
|
-
target.space_key = source.space_key;
|
|
14839
|
-
if (source.environment_key !== void 0)
|
|
14840
|
-
target.environment_key = source.environment_key;
|
|
14841
|
-
if (source.x_contentful_request_id !== void 0) {
|
|
14842
|
-
target.x_contentful_request_id = source.x_contentful_request_id;
|
|
14843
|
-
}
|
|
14844
|
-
}
|
|
14845
|
-
function setCommandContext(context) {
|
|
14846
|
-
if (!state.pending)
|
|
14847
|
-
return;
|
|
14848
|
-
mergeContext(state.pending.context, context);
|
|
14849
|
-
mergeContext(state.pending.completion, context);
|
|
14850
|
-
}
|
|
14851
|
-
function enrichCommandResult(fields) {
|
|
14852
|
-
if (!state.pending)
|
|
14853
|
-
return;
|
|
14854
|
-
Object.assign(state.pending.completion, fields);
|
|
14855
|
-
mergeContext(state.pending.context, fields);
|
|
14856
|
-
}
|
|
14857
|
-
|
|
14858
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/os.js
|
|
14859
|
-
var OS_NAMES2 = {
|
|
14860
|
-
android: "Android",
|
|
14861
|
-
aix: "Linux",
|
|
14862
|
-
darwin: "macOS",
|
|
14863
|
-
freebsd: "Linux",
|
|
14864
|
-
linux: "Linux",
|
|
14865
|
-
openbsd: "Linux",
|
|
14866
|
-
sunos: "Linux",
|
|
14867
|
-
win32: "Windows"
|
|
14868
|
-
};
|
|
14869
|
-
function getOsName() {
|
|
14870
|
-
return OS_NAMES2[process.platform] ?? "other";
|
|
14871
|
-
}
|
|
14872
|
-
|
|
14873
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/emit-events.js
|
|
14874
|
-
async function bindAnalyticsSessionId(explicit, context) {
|
|
14875
|
-
const id = resolveAnalyticsSessionId(explicit);
|
|
14876
|
-
await bindAnalyticsSession(id, context);
|
|
14877
|
-
return id;
|
|
14878
|
-
}
|
|
14879
|
-
async function bindAnalyticsSession(id, context) {
|
|
14880
|
-
state.sessionId = id;
|
|
14881
|
-
if (context)
|
|
14882
|
-
setCommandContext(context);
|
|
14883
|
-
await emitInvokedIfReady();
|
|
14884
|
-
}
|
|
14885
|
-
async function emitSessionStarted(entryCommand) {
|
|
14886
|
-
if (!state.sessionId || state.sessionStartedEmitted)
|
|
14887
|
-
return;
|
|
14888
|
-
state.sessionStartedEmitted = true;
|
|
14889
|
-
await trackEvent("dsi_cli_session_started", {
|
|
14890
|
-
dsi_session_id: state.sessionId,
|
|
14891
|
-
entry_command: entryCommand,
|
|
14892
|
-
cli_version: cliVersion(),
|
|
14893
|
-
node_version: process.version,
|
|
14894
|
-
os_name: getOsName()
|
|
14895
|
-
}, state.sessionId, { flush: true });
|
|
14896
|
-
await emitInvokedIfReady();
|
|
14897
|
-
}
|
|
14898
|
-
async function emitInvokedIfReady() {
|
|
14899
|
-
if (!state.pending || state.pending.invoked || !state.sessionId)
|
|
14900
|
-
return;
|
|
14901
|
-
state.pending.invoked = true;
|
|
14902
|
-
await trackEvent("dsi_cli_command_invoked", {
|
|
14903
|
-
...buildBaseProps(state.pending.command),
|
|
14904
|
-
...state.pending.context
|
|
14905
|
-
}, state.sessionId, { flush: true });
|
|
14906
|
-
}
|
|
14907
|
-
|
|
14908
14688
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
14909
14689
|
var DEFAULT_TIMEOUT_MS2 = 5 * 60 * 1e3;
|
|
14910
14690
|
var MapTokensRunFailure = class _MapTokensRunFailure extends Error {
|
|
@@ -14934,34 +14714,23 @@ async function runMapTokens(request) {
|
|
|
14934
14714
|
if (!sessionId) {
|
|
14935
14715
|
throw new MapTokensRunFailure({ type: "no-session" });
|
|
14936
14716
|
}
|
|
14937
|
-
await bindAnalyticsSessionId(sessionId);
|
|
14938
14717
|
const tokenLeaves = loadTokenLeaves(db, sessionId);
|
|
14939
14718
|
const knownTokenPaths = new Set(tokenLeaves.map((t) => t.path));
|
|
14940
|
-
const diagnostics = [];
|
|
14941
14719
|
if (request.tokenMapInline) {
|
|
14942
14720
|
const validMappings = {};
|
|
14943
14721
|
for (const [rawName, path5] of Object.entries(request.tokenMapInline)) {
|
|
14944
|
-
if (knownTokenPaths.has(path5))
|
|
14722
|
+
if (knownTokenPaths.has(path5))
|
|
14945
14723
|
validMappings[rawName] = path5;
|
|
14946
|
-
} else {
|
|
14947
|
-
diagnostics.push(`Token map '${rawName}' -> '${path5}': path not found in session tokens \u2014 skipped.`);
|
|
14948
|
-
}
|
|
14949
14724
|
}
|
|
14950
14725
|
replaceRawTokenNamePaths(db, sessionId, validMappings, "manual");
|
|
14951
14726
|
}
|
|
14952
14727
|
const rawDefaults = loadRawDefaults(db, sessionId);
|
|
14953
14728
|
const defaultResolution = resolveTokenDefaults(rawDefaults.map((row) => ({ rawDefault: row.default_reference, tokenKind: row.cdf_token_kind })), tokenLeaves);
|
|
14954
|
-
for (const diagnostic of defaultResolution.diagnostics)
|
|
14955
|
-
diagnostics.push(diagnostic.message);
|
|
14956
14729
|
const manualMappings = new Map(getRawTokenNamePathRows(db, sessionId).filter((row) => row.source === "manual").map((row) => [row.rawName, row.path]));
|
|
14957
14730
|
const automaticMappings = {};
|
|
14958
14731
|
for (const [rawName, path5] of Object.entries(defaultResolution.mappings)) {
|
|
14959
|
-
|
|
14960
|
-
if (manualPath === void 0) {
|
|
14732
|
+
if (manualMappings.get(rawName) === void 0)
|
|
14961
14733
|
automaticMappings[rawName] = path5;
|
|
14962
|
-
} else if (manualPath !== path5) {
|
|
14963
|
-
diagnostics.push(`Token default '${rawName}' automatically resolves to '${path5}', but manual mapping '${manualPath}' is retained.`);
|
|
14964
|
-
}
|
|
14965
14734
|
}
|
|
14966
14735
|
replaceRawTokenNamePaths(db, sessionId, automaticMappings, "automatic");
|
|
14967
14736
|
const cdfEntries = loadCDFComponents(db, sessionId);
|
|
@@ -14972,7 +14741,7 @@ async function runMapTokens(request) {
|
|
|
14972
14741
|
const { groups, tokens } = getDtcgTokensForSession(db, sessionId);
|
|
14973
14742
|
const tokenCount = tokens.length;
|
|
14974
14743
|
if (mappablePropCount === 0 || tokenCount === 0) {
|
|
14975
|
-
return { type: "nothing-to-map", sessionId, mappablePropCount, tokenCount
|
|
14744
|
+
return { type: "nothing-to-map", sessionId, mappablePropCount, tokenCount };
|
|
14976
14745
|
}
|
|
14977
14746
|
const generatedCdf = Object.fromEntries(cdfEntries.map((c2) => [c2.key, c2.entry]));
|
|
14978
14747
|
const tokenTree = rebuildDTCGTree(groups, tokens);
|
|
@@ -14990,7 +14759,7 @@ async function runMapTokens(request) {
|
|
|
14990
14759
|
});
|
|
14991
14760
|
if (request.printPrompt) {
|
|
14992
14761
|
const prompt2 = await buildMapPrompt();
|
|
14993
|
-
return { type: "printed-prompt", sessionId, prompt: prompt2
|
|
14762
|
+
return { type: "printed-prompt", sessionId, prompt: prompt2 };
|
|
14994
14763
|
}
|
|
14995
14764
|
if (request.skipAgent) {
|
|
14996
14765
|
const stepId2 = createStep(db, sessionId, "map tokens", {
|
|
@@ -14999,7 +14768,7 @@ async function runMapTokens(request) {
|
|
|
14999
14768
|
skipAgent: "true"
|
|
15000
14769
|
});
|
|
15001
14770
|
updateStep(db, stepId2, "complete", { applied: "0", skipAgent: "true" });
|
|
15002
|
-
return { type: "skipped", sessionId, stepId: stepId2
|
|
14771
|
+
return { type: "skipped", sessionId, stepId: stepId2 };
|
|
15003
14772
|
}
|
|
15004
14773
|
const agent = request.agent;
|
|
15005
14774
|
const noCache = request.cache === false || process.env["EDS_NO_CACHE"] === "1";
|
|
@@ -15011,7 +14780,7 @@ async function runMapTokens(request) {
|
|
|
15011
14780
|
const applied2 = copyMapTokensFromCache(db, cached.sourceSessionId, sessionId);
|
|
15012
14781
|
const stepId2 = createStep(db, sessionId, "map tokens", { agent, model: request.model ?? "" });
|
|
15013
14782
|
updateStep(db, stepId2, "complete", { cached: "true", applied: String(applied2) });
|
|
15014
|
-
return { type: "cached", sessionId, applied: applied2, stepId: stepId2
|
|
14783
|
+
return { type: "cached", sessionId, applied: applied2, stepId: stepId2 };
|
|
15015
14784
|
}
|
|
15016
14785
|
}
|
|
15017
14786
|
const binary = resolveBinary(agent);
|
|
@@ -15038,7 +14807,7 @@ async function runMapTokens(request) {
|
|
|
15038
14807
|
storeCache(db, inputHash, "token_mapping", "__map_tokens__", sessionId, false, promptHash);
|
|
15039
14808
|
}
|
|
15040
14809
|
updateStep(db, stepId, "complete", { applied: String(applied), warnings: String(warnings.length) });
|
|
15041
|
-
return { type: "applied", sessionId, applied, warnings, stepId
|
|
14810
|
+
return { type: "applied", sessionId, applied, warnings, stepId };
|
|
15042
14811
|
} finally {
|
|
15043
14812
|
db.close();
|
|
15044
14813
|
}
|
|
@@ -16258,9 +16027,6 @@ async function runExtractAndComposeSession(request) {
|
|
|
16258
16027
|
outDir
|
|
16259
16028
|
});
|
|
16260
16029
|
await onSessionCreated?.(sessionId);
|
|
16261
|
-
await bindAnalyticsSessionId(sessionId);
|
|
16262
|
-
if (!isPipelineAnalyticsChild())
|
|
16263
|
-
await emitSessionStarted("analyze_extract");
|
|
16264
16030
|
const stepId = createStep(db, sessionId, "analyze extract", { project: projectPath });
|
|
16265
16031
|
if (cacheHits === 0 && !noCache) {
|
|
16266
16032
|
await persistExtractCache(db, sourceFiles, extraction.components, cacheVersion);
|
|
@@ -16288,7 +16054,6 @@ async function runExtractAndComposeSession(request) {
|
|
|
16288
16054
|
await persistSlotCycles(db, sessionId, composition.components);
|
|
16289
16055
|
storeScannedFiles(db, sessionId, sourceFiles.map((f) => relative2(projectPath, f)));
|
|
16290
16056
|
await retryDatabaseWrite(() => updateStep(db, stepId, "complete", { sessionId }));
|
|
16291
|
-
enrichCommandResult({ extracted_component_count: composition.components.length });
|
|
16292
16057
|
return {
|
|
16293
16058
|
sessionId,
|
|
16294
16059
|
compositionPhase: composition.phase,
|
|
@@ -16351,7 +16116,6 @@ async function runGenerateTokensSession(request) {
|
|
|
16351
16116
|
outDir
|
|
16352
16117
|
});
|
|
16353
16118
|
await onSessionCreated?.(tokenSessionId);
|
|
16354
|
-
await bindAnalyticsSessionId(tokenSessionId);
|
|
16355
16119
|
const tokenPromptHash = await hashPromptForSkill("tokens", agent, agentModel, skillPath);
|
|
16356
16120
|
const warnings = [];
|
|
16357
16121
|
onProgress?.({ kind: "resolving" });
|
|
@@ -16728,7 +16492,6 @@ async function runGenerateComponentsSession(request) {
|
|
|
16728
16492
|
const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
|
|
16729
16493
|
const agent = request.agent;
|
|
16730
16494
|
const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
|
|
16731
|
-
await bindAnalyticsSessionId(request.sessionId);
|
|
16732
16495
|
const db = openPipelineDb();
|
|
16733
16496
|
try {
|
|
16734
16497
|
const acceptedNames = await loadAcceptedNames(request.sessionId);
|
|
@@ -17428,7 +17191,7 @@ function ExtractionScreen({
|
|
|
17428
17191
|
}
|
|
17429
17192
|
|
|
17430
17193
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
17431
|
-
import { randomBytes as
|
|
17194
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
17432
17195
|
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
17433
17196
|
import { homedir as homedir3 } from "node:os";
|
|
17434
17197
|
import { dirname as dirname13, join as join17 } from "node:path";
|
|
@@ -17447,7 +17210,7 @@ async function readSettings2() {
|
|
|
17447
17210
|
async function writeSettings2(settings) {
|
|
17448
17211
|
const path5 = configFilePath2();
|
|
17449
17212
|
await mkdir6(dirname13(path5), { recursive: true });
|
|
17450
|
-
const tmp = `${path5}.${process.pid}.${
|
|
17213
|
+
const tmp = `${path5}.${process.pid}.${randomBytes3(4).toString("hex")}.tmp`;
|
|
17451
17214
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
17452
17215
|
`, { mode: 384 });
|
|
17453
17216
|
await rename2(tmp, path5);
|
|
@@ -17493,13 +17256,13 @@ async function runSelection(options) {
|
|
|
17493
17256
|
const db = openPipelineDb();
|
|
17494
17257
|
let components;
|
|
17495
17258
|
const cachedDecisions = /* @__PURE__ */ new Map();
|
|
17496
|
-
const
|
|
17259
|
+
const cliVersion = await getCliCacheVersion();
|
|
17497
17260
|
const promptHash = await hashSelectPrompt(options);
|
|
17498
17261
|
try {
|
|
17499
17262
|
components = loadRawComponents(db, options.sessionId);
|
|
17500
17263
|
if (!options.noCache) {
|
|
17501
17264
|
for (const component of components) {
|
|
17502
|
-
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash,
|
|
17265
|
+
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash, cliVersion);
|
|
17503
17266
|
if (cached) cachedDecisions.set(component.name, { decision: cached.decision, reason: cached.reason });
|
|
17504
17267
|
}
|
|
17505
17268
|
}
|
|
@@ -17554,7 +17317,7 @@ async function runSelection(options) {
|
|
|
17554
17317
|
writeDb,
|
|
17555
17318
|
hashComponentShape(component),
|
|
17556
17319
|
promptHash,
|
|
17557
|
-
|
|
17320
|
+
cliVersion,
|
|
17558
17321
|
rejected ? "rejected" : "accepted",
|
|
17559
17322
|
rejected ? reason : null
|
|
17560
17323
|
);
|
|
@@ -17714,7 +17477,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
17714
17477
|
|
|
17715
17478
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
17716
17479
|
function useExtraction(input) {
|
|
17717
|
-
const [
|
|
17480
|
+
const [state, setState] = useState8();
|
|
17718
17481
|
const current = useRef2();
|
|
17719
17482
|
useEffect5(() => {
|
|
17720
17483
|
current.current = input;
|
|
@@ -17739,7 +17502,7 @@ function useExtraction(input) {
|
|
|
17739
17502
|
if (current.current === input) current.current = void 0;
|
|
17740
17503
|
};
|
|
17741
17504
|
}, [input]);
|
|
17742
|
-
return
|
|
17505
|
+
return state;
|
|
17743
17506
|
}
|
|
17744
17507
|
|
|
17745
17508
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
@@ -18909,7 +18672,8 @@ function GroupedSidebar(props) {
|
|
|
18909
18672
|
dimPredicate,
|
|
18910
18673
|
visibleRows: providedRows,
|
|
18911
18674
|
graph,
|
|
18912
|
-
filterVisibleKeys
|
|
18675
|
+
filterVisibleKeys,
|
|
18676
|
+
emptyMessage
|
|
18913
18677
|
} = props;
|
|
18914
18678
|
const allRows = providedRows ?? buildVisibleRows({
|
|
18915
18679
|
items,
|
|
@@ -18926,6 +18690,10 @@ function GroupedSidebar(props) {
|
|
|
18926
18690
|
const end = windowed ? start + (visibleCount ?? allRows.length) : allRows.length;
|
|
18927
18691
|
const rows = windowed ? allRows.slice(start, end) : allRows;
|
|
18928
18692
|
return /* @__PURE__ */ jsxs18(WindowedPanel, { width, height: props.height, title, focused, children: [
|
|
18693
|
+
allRows.length === 0 && emptyMessage !== void 0 && /* @__PURE__ */ jsxs18(Text19, { color: PALETTE2.warning, children: [
|
|
18694
|
+
" ",
|
|
18695
|
+
emptyMessage
|
|
18696
|
+
] }),
|
|
18929
18697
|
windowed && /* @__PURE__ */ jsx21(WindowIndicator, { direction: "up", count: start }),
|
|
18930
18698
|
rows.map((row, i) => {
|
|
18931
18699
|
const absoluteRowIdx = start + i;
|
|
@@ -19241,9 +19009,9 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
19241
19009
|
{ keys: "L", label: "Flat view" },
|
|
19242
19010
|
{ keys: "i", label: "Focus lineage" }
|
|
19243
19011
|
];
|
|
19244
|
-
if (includeBreaking) entries.push({ keys: "w", label: "
|
|
19012
|
+
if (includeBreaking) entries.push({ keys: "w", label: "Show only components with breaking changes" });
|
|
19245
19013
|
entries.push(
|
|
19246
|
-
{ keys: "o", label: "
|
|
19014
|
+
{ keys: "o", label: "Show only components in slot cycles" },
|
|
19247
19015
|
{ keys: "space", label: "Expand/collapse group" },
|
|
19248
19016
|
{ keys: "E / C", label: "Expand/collapse all" }
|
|
19249
19017
|
);
|
|
@@ -19810,6 +19578,17 @@ function computeFilterKeys(input) {
|
|
|
19810
19578
|
if (active.has("deleted")) for (const k of input.data.deleted ?? []) out.add(k);
|
|
19811
19579
|
return out;
|
|
19812
19580
|
}
|
|
19581
|
+
var FILTER_LABELS = {
|
|
19582
|
+
broken: "components with breaking changes",
|
|
19583
|
+
cycles: "slot cycles",
|
|
19584
|
+
deleted: "removed components"
|
|
19585
|
+
};
|
|
19586
|
+
function describeEmptyFilter(input) {
|
|
19587
|
+
const names = [...input.filters].map((f) => FILTER_LABELS[f]);
|
|
19588
|
+
if (input.slotDependencies) names.push("slot dependencies");
|
|
19589
|
+
if (names.length === 0) return void 0;
|
|
19590
|
+
return `Nothing to show: no ${names.join(" or ")} in this import.`;
|
|
19591
|
+
}
|
|
19813
19592
|
function intersectFilterKeys(a, b) {
|
|
19814
19593
|
if (a === void 0) return b;
|
|
19815
19594
|
if (b === void 0) return a;
|
|
@@ -19830,62 +19609,62 @@ function buildFlatDimPredicate(input) {
|
|
|
19830
19609
|
}
|
|
19831
19610
|
|
|
19832
19611
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
19833
|
-
function apply(
|
|
19834
|
-
const next = new Map(
|
|
19612
|
+
function apply(state, entries) {
|
|
19613
|
+
const next = new Map(state);
|
|
19835
19614
|
for (const [name, decision] of entries) next.set(name, decision);
|
|
19836
19615
|
return next;
|
|
19837
19616
|
}
|
|
19838
|
-
function reduceDecisions(
|
|
19617
|
+
function reduceDecisions(state, action, components, graph) {
|
|
19839
19618
|
switch (action.type) {
|
|
19840
19619
|
case "accept": {
|
|
19841
|
-
if (
|
|
19620
|
+
if (state.get(action.name) === "accepted") return state;
|
|
19842
19621
|
return apply(
|
|
19843
|
-
|
|
19622
|
+
state,
|
|
19844
19623
|
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
19845
19624
|
);
|
|
19846
19625
|
}
|
|
19847
19626
|
case "reject": {
|
|
19848
|
-
if (
|
|
19627
|
+
if (state.get(action.name) === "rejected") return state;
|
|
19849
19628
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
19850
|
-
return apply(
|
|
19629
|
+
return apply(state, [
|
|
19851
19630
|
...toReject.map((name) => [name, "rejected"]),
|
|
19852
19631
|
...toDeselect.map((name) => [name, "undecided"])
|
|
19853
19632
|
]);
|
|
19854
19633
|
}
|
|
19855
19634
|
case "toggle-all": {
|
|
19856
19635
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
19857
|
-
const anyNotAccepted = nonCycle.some((name) =>
|
|
19636
|
+
const anyNotAccepted = nonCycle.some((name) => state.get(name) !== "accepted");
|
|
19858
19637
|
if (anyNotAccepted) {
|
|
19859
|
-
return apply(
|
|
19638
|
+
return apply(state, [
|
|
19860
19639
|
...nonCycle.map((name) => [name, "accepted"]),
|
|
19861
19640
|
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
19862
19641
|
]);
|
|
19863
19642
|
}
|
|
19864
|
-
return apply(
|
|
19643
|
+
return apply(state, [
|
|
19865
19644
|
...nonCycle.map((name) => [name, "rejected"]),
|
|
19866
|
-
...components.filter((c2) => graph.cycleParticipants.has(c2.name) &&
|
|
19645
|
+
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
19867
19646
|
]);
|
|
19868
19647
|
}
|
|
19869
19648
|
case "accept-unflagged": {
|
|
19870
19649
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
19871
|
-
return apply(
|
|
19650
|
+
return apply(state, [
|
|
19872
19651
|
...seeds.map((name) => [name, "accepted"]),
|
|
19873
19652
|
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
19874
19653
|
]);
|
|
19875
19654
|
}
|
|
19876
19655
|
}
|
|
19877
19656
|
}
|
|
19878
|
-
function rejectNeedsConfirmation(graph, name,
|
|
19879
|
-
if (
|
|
19657
|
+
function rejectNeedsConfirmation(graph, name, state) {
|
|
19658
|
+
if (state.get(name) === "rejected") return false;
|
|
19880
19659
|
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
19881
19660
|
const ancestors = toReject.filter((n) => n !== name);
|
|
19882
19661
|
return ancestors.length + toDeselect.length >= 2;
|
|
19883
19662
|
}
|
|
19884
|
-
function partitionDecisions(components,
|
|
19663
|
+
function partitionDecisions(components, state) {
|
|
19885
19664
|
const accepted = [];
|
|
19886
19665
|
const rejected = [];
|
|
19887
19666
|
for (const c2 of components) {
|
|
19888
|
-
if (
|
|
19667
|
+
if (state.get(c2.name) === "accepted") accepted.push(c2.name);
|
|
19889
19668
|
else rejected.push(c2.name);
|
|
19890
19669
|
}
|
|
19891
19670
|
return { accepted, rejected };
|
|
@@ -20005,6 +19784,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
|
|
|
20005
19784
|
}),
|
|
20006
19785
|
[groupedItems, cycleParticipants, expandedGroups, columnOneView, graph, filterVisibleKeys]
|
|
20007
19786
|
);
|
|
19787
|
+
const emptyMessage = visibleRows.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters, slotDependencies: showDependencies }) : void 0;
|
|
20008
19788
|
const total = visibleRows.length;
|
|
20009
19789
|
const safeCursor = Math.min(nav.cursor, Math.max(0, total - 1));
|
|
20010
19790
|
const currentRow = visibleRows[safeCursor];
|
|
@@ -20326,6 +20106,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
|
|
|
20326
20106
|
expandedGroups,
|
|
20327
20107
|
toggleExpanded,
|
|
20328
20108
|
visibleRows,
|
|
20109
|
+
emptyMessage,
|
|
20329
20110
|
safeCursor,
|
|
20330
20111
|
scrollOffset: nav.scrollOffset,
|
|
20331
20112
|
selectionStateByKey,
|
|
@@ -20379,7 +20160,7 @@ var HELP_SECTIONS = [
|
|
|
20379
20160
|
title: "Panels",
|
|
20380
20161
|
entries: [
|
|
20381
20162
|
{ keys: "c", label: "Cycle list" },
|
|
20382
|
-
{ keys: "d", label: "Show slot
|
|
20163
|
+
{ keys: "d", label: "Show slot dependenciess" },
|
|
20383
20164
|
{ keys: "x", label: "Review flags" }
|
|
20384
20165
|
]
|
|
20385
20166
|
},
|
|
@@ -20448,6 +20229,7 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
|
|
|
20448
20229
|
aiFlaggedByKey: gate.aiFlaggedByKey,
|
|
20449
20230
|
dimPredicate: gate.dimPredicate,
|
|
20450
20231
|
visibleRows: gate.visibleRows,
|
|
20232
|
+
emptyMessage: gate.emptyMessage,
|
|
20451
20233
|
viewMode: gate.columnOneView,
|
|
20452
20234
|
graph: graph.nodes
|
|
20453
20235
|
}
|
|
@@ -20716,7 +20498,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
|
|
|
20716
20498
|
update({ mapTokens: "running" });
|
|
20717
20499
|
try {
|
|
20718
20500
|
const mapTokensOptions = await buildMapTokensOptions(input);
|
|
20719
|
-
|
|
20501
|
+
await deps.runMapTokens({
|
|
20720
20502
|
sessionId: input.sessionId,
|
|
20721
20503
|
agent: input.agent,
|
|
20722
20504
|
...input.agentModel ? { model: input.agentModel } : {},
|
|
@@ -20724,11 +20506,6 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
|
|
|
20724
20506
|
skillPathOverride: MAP_TOKENS_SKILL_PATH,
|
|
20725
20507
|
...mapTokensOptions
|
|
20726
20508
|
});
|
|
20727
|
-
if (mapResult.diagnostics.length > 0) {
|
|
20728
|
-
process.stderr.write(`Unresolved token defaults:
|
|
20729
|
-
${mapResult.diagnostics.map((d) => ` ${d}`).join("\n")}
|
|
20730
|
-
`);
|
|
20731
|
-
}
|
|
20732
20509
|
} catch (error) {
|
|
20733
20510
|
const message = error instanceof MapTokensRunFailure ? error.message : error instanceof Error ? error.message : String(error);
|
|
20734
20511
|
return fail2("map tokens", message);
|
|
@@ -20782,7 +20559,7 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
20782
20559
|
|
|
20783
20560
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
20784
20561
|
function useGeneration(input) {
|
|
20785
|
-
const [
|
|
20562
|
+
const [state, setState] = useState14();
|
|
20786
20563
|
const current = useRef6();
|
|
20787
20564
|
useEffect9(() => {
|
|
20788
20565
|
current.current = input;
|
|
@@ -20800,7 +20577,7 @@ function useGeneration(input) {
|
|
|
20800
20577
|
if (current.current === input) current.current = void 0;
|
|
20801
20578
|
};
|
|
20802
20579
|
}, [input]);
|
|
20803
|
-
return
|
|
20580
|
+
return state;
|
|
20804
20581
|
}
|
|
20805
20582
|
|
|
20806
20583
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
@@ -21565,7 +21342,7 @@ function parseToState(json) {
|
|
|
21565
21342
|
});
|
|
21566
21343
|
return { state: { componentDescription, props, slots }, error: null };
|
|
21567
21344
|
}
|
|
21568
|
-
function serializeState(
|
|
21345
|
+
function serializeState(state, originalJson) {
|
|
21569
21346
|
let wrapperKey = null;
|
|
21570
21347
|
try {
|
|
21571
21348
|
const orig = JSON.parse(originalJson);
|
|
@@ -21579,7 +21356,7 @@ function serializeState(state2, originalJson) {
|
|
|
21579
21356
|
} catch {
|
|
21580
21357
|
}
|
|
21581
21358
|
const $properties = {};
|
|
21582
|
-
for (const p of
|
|
21359
|
+
for (const p of state.props) {
|
|
21583
21360
|
const def = {
|
|
21584
21361
|
$type: p.type,
|
|
21585
21362
|
$category: p.category
|
|
@@ -21602,10 +21379,10 @@ function serializeState(state2, originalJson) {
|
|
|
21602
21379
|
$type: "component",
|
|
21603
21380
|
$properties
|
|
21604
21381
|
};
|
|
21605
|
-
if (
|
|
21606
|
-
if (
|
|
21382
|
+
if (state.componentDescription) entry.$description = state.componentDescription;
|
|
21383
|
+
if (state.slots.length > 0) {
|
|
21607
21384
|
entry.$slots = {};
|
|
21608
|
-
for (const s of
|
|
21385
|
+
for (const s of state.slots) {
|
|
21609
21386
|
const slotDef = {};
|
|
21610
21387
|
if (s.description) slotDef.$description = s.description;
|
|
21611
21388
|
if (s.required) slotDef.$required = true;
|
|
@@ -24695,71 +24472,71 @@ function ReviewReloadDialog({ open }) {
|
|
|
24695
24472
|
|
|
24696
24473
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-input.ts
|
|
24697
24474
|
var PANEL_CONTENT_HEIGHT = 12;
|
|
24698
|
-
function handleReviewOverlayInput(input, key,
|
|
24699
|
-
if (
|
|
24700
|
-
if (
|
|
24701
|
-
if (input === "q" || key.escape || key.return)
|
|
24475
|
+
function handleReviewOverlayInput(input, key, state) {
|
|
24476
|
+
if (state.loading) return true;
|
|
24477
|
+
if (state.loadError) {
|
|
24478
|
+
if (input === "q" || key.escape || key.return) state.onQuit();
|
|
24702
24479
|
return true;
|
|
24703
24480
|
}
|
|
24704
|
-
if (
|
|
24481
|
+
if (state.showFinalize) {
|
|
24705
24482
|
if (key.downArrow) {
|
|
24706
|
-
|
|
24483
|
+
state.finalizePreview.scrollBy(1);
|
|
24707
24484
|
return true;
|
|
24708
24485
|
}
|
|
24709
24486
|
if (key.upArrow) {
|
|
24710
|
-
|
|
24487
|
+
state.finalizePreview.scrollBy(-1);
|
|
24711
24488
|
return true;
|
|
24712
24489
|
}
|
|
24713
24490
|
return true;
|
|
24714
24491
|
}
|
|
24715
|
-
if (
|
|
24716
|
-
if (
|
|
24492
|
+
if (state.dialogOpen || state.showHelp) return true;
|
|
24493
|
+
if (state.showReloadDialog) {
|
|
24717
24494
|
if (key.return) {
|
|
24718
|
-
|
|
24719
|
-
|
|
24495
|
+
state.reloadFromSave();
|
|
24496
|
+
state.setShowReloadDialog(false);
|
|
24720
24497
|
return true;
|
|
24721
24498
|
}
|
|
24722
24499
|
if (key.escape) {
|
|
24723
|
-
|
|
24500
|
+
state.setShowReloadDialog(false);
|
|
24724
24501
|
return true;
|
|
24725
24502
|
}
|
|
24726
24503
|
return true;
|
|
24727
24504
|
}
|
|
24728
24505
|
if (key.ctrl && input === "z") {
|
|
24729
|
-
|
|
24506
|
+
state.handleUndo();
|
|
24730
24507
|
return true;
|
|
24731
24508
|
}
|
|
24732
24509
|
if (key.ctrl && input === "y") {
|
|
24733
|
-
|
|
24510
|
+
state.handleRedo();
|
|
24734
24511
|
return true;
|
|
24735
24512
|
}
|
|
24736
24513
|
if (key.ctrl && input === "r") {
|
|
24737
|
-
|
|
24514
|
+
state.setShowReloadDialog(true);
|
|
24738
24515
|
return true;
|
|
24739
24516
|
}
|
|
24740
24517
|
return false;
|
|
24741
24518
|
}
|
|
24742
|
-
function handleTokenReviewInput(input, key,
|
|
24743
|
-
if (
|
|
24744
|
-
const suggestions =
|
|
24745
|
-
const row = suggestions[
|
|
24746
|
-
if (
|
|
24519
|
+
function handleTokenReviewInput(input, key, state) {
|
|
24520
|
+
if (state.panelOpen !== "token-review") return false;
|
|
24521
|
+
const suggestions = state.currentTokenSuggestions();
|
|
24522
|
+
const row = suggestions[state.tokenReviewRow];
|
|
24523
|
+
if (state.tokenReviewEditing) {
|
|
24747
24524
|
if (key.ctrl && input === "s" && row) {
|
|
24748
|
-
|
|
24525
|
+
state.handleTokenEditSave(row);
|
|
24749
24526
|
return true;
|
|
24750
24527
|
}
|
|
24751
24528
|
if (row && row.paths.length > 0) {
|
|
24752
24529
|
if (key.upArrow || input === "k") {
|
|
24753
|
-
|
|
24530
|
+
state.setTokenReviewEditCursor((cursor) => Math.max(0, cursor - 1));
|
|
24754
24531
|
return true;
|
|
24755
24532
|
}
|
|
24756
24533
|
if (key.downArrow || input === "j") {
|
|
24757
|
-
|
|
24534
|
+
state.setTokenReviewEditCursor((cursor) => Math.min(row.paths.length - 1, cursor + 1));
|
|
24758
24535
|
return true;
|
|
24759
24536
|
}
|
|
24760
24537
|
if (input === " " || key.return) {
|
|
24761
|
-
const path5 = row.paths[
|
|
24762
|
-
|
|
24538
|
+
const path5 = row.paths[state.tokenReviewEditCursor];
|
|
24539
|
+
state.setTokenReviewEditSelection((previous) => {
|
|
24763
24540
|
const next = new Set(previous);
|
|
24764
24541
|
if (next.has(path5) && next.size === 1) return next;
|
|
24765
24542
|
if (next.has(path5)) next.delete(path5);
|
|
@@ -24770,34 +24547,34 @@ function handleTokenReviewInput(input, key, state2) {
|
|
|
24770
24547
|
}
|
|
24771
24548
|
}
|
|
24772
24549
|
if (key.escape) {
|
|
24773
|
-
|
|
24550
|
+
state.setTokenReviewEditing(false);
|
|
24774
24551
|
return true;
|
|
24775
24552
|
}
|
|
24776
24553
|
return true;
|
|
24777
24554
|
}
|
|
24778
24555
|
if (key.upArrow || input === "k") {
|
|
24779
|
-
|
|
24556
|
+
state.setTokenReviewRow((rowIndex) => Math.max(0, rowIndex - 1));
|
|
24780
24557
|
return true;
|
|
24781
24558
|
}
|
|
24782
24559
|
if (key.downArrow || input === "j") {
|
|
24783
|
-
|
|
24560
|
+
state.setTokenReviewRow((rowIndex) => Math.min(Math.max(0, suggestions.length - 1), rowIndex + 1));
|
|
24784
24561
|
return true;
|
|
24785
24562
|
}
|
|
24786
24563
|
if (key.return && row) {
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24564
|
+
state.setTokenReviewEditCursor(0);
|
|
24565
|
+
state.setTokenReviewEditSelection(new Set(row.allowed));
|
|
24566
|
+
state.setTokenReviewEditing(true);
|
|
24790
24567
|
return true;
|
|
24791
24568
|
}
|
|
24792
24569
|
if (key.escape || input === "t") {
|
|
24793
|
-
|
|
24570
|
+
state.setPanelOpen("none");
|
|
24794
24571
|
return true;
|
|
24795
24572
|
}
|
|
24796
24573
|
return true;
|
|
24797
24574
|
}
|
|
24798
|
-
function setReviewPanel(
|
|
24799
|
-
|
|
24800
|
-
|
|
24575
|
+
function setReviewPanel(state, panel) {
|
|
24576
|
+
state.setPanelOpen(panel);
|
|
24577
|
+
state.setPanelScrollOffset(() => 0);
|
|
24801
24578
|
}
|
|
24802
24579
|
function rationalePanelForInput(input, propKey, componentKey) {
|
|
24803
24580
|
if (input === propKey) return "prop-rationale";
|
|
@@ -24805,70 +24582,70 @@ function rationalePanelForInput(input, propKey, componentKey) {
|
|
|
24805
24582
|
if (input === "s") return "source";
|
|
24806
24583
|
return null;
|
|
24807
24584
|
}
|
|
24808
|
-
function handleRationalePanelInput(input, key,
|
|
24809
|
-
if (
|
|
24810
|
-
const next = computeNextScrollOffset(
|
|
24585
|
+
function handleRationalePanelInput(input, key, state) {
|
|
24586
|
+
if (state.panelOpen === "none" || state.panelOpen === "token-review") return false;
|
|
24587
|
+
const next = computeNextScrollOffset(state.panelScrollOffset, input, key, 9999, PANEL_CONTENT_HEIGHT);
|
|
24811
24588
|
if (next !== null) {
|
|
24812
|
-
|
|
24589
|
+
state.setPanelScrollOffset(() => next);
|
|
24813
24590
|
return true;
|
|
24814
24591
|
}
|
|
24815
24592
|
if (key.escape) {
|
|
24816
|
-
setReviewPanel(
|
|
24593
|
+
setReviewPanel(state, "none");
|
|
24817
24594
|
return true;
|
|
24818
24595
|
}
|
|
24819
24596
|
const togglable = !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
24820
24597
|
if (!togglable) return true;
|
|
24821
|
-
const panel = rationalePanelForInput(input,
|
|
24822
|
-
if (panel) setReviewPanel(
|
|
24598
|
+
const panel = rationalePanelForInput(input, state.propKey, state.componentKey);
|
|
24599
|
+
if (panel) setReviewPanel(state, state.panelOpen === panel ? "none" : panel);
|
|
24823
24600
|
return true;
|
|
24824
24601
|
}
|
|
24825
|
-
function handleReviewPanelShortcuts(input, key,
|
|
24826
|
-
if (handleTokenReviewInput(input, key,
|
|
24827
|
-
if (handleRationalePanelInput(input, key,
|
|
24828
|
-
const rationaleKeyOk = !
|
|
24602
|
+
function handleReviewPanelShortcuts(input, key, state) {
|
|
24603
|
+
if (handleTokenReviewInput(input, key, state)) return true;
|
|
24604
|
+
if (handleRationalePanelInput(input, key, state)) return true;
|
|
24605
|
+
const rationaleKeyOk = !state.textEntryActive && !state.showJson && !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
24829
24606
|
if (!rationaleKeyOk) return false;
|
|
24830
|
-
const panel = rationalePanelForInput(input,
|
|
24607
|
+
const panel = rationalePanelForInput(input, state.propKey, state.componentKey);
|
|
24831
24608
|
if (panel) {
|
|
24832
|
-
setReviewPanel(
|
|
24609
|
+
setReviewPanel(state, panel);
|
|
24833
24610
|
return true;
|
|
24834
24611
|
}
|
|
24835
|
-
if (input === "t" &&
|
|
24836
|
-
|
|
24837
|
-
|
|
24612
|
+
if (input === "t" && state.currentTokenSuggestions().length > 0) {
|
|
24613
|
+
state.setPanelOpen("token-review");
|
|
24614
|
+
state.setTokenReviewRow(0);
|
|
24838
24615
|
return true;
|
|
24839
24616
|
}
|
|
24840
24617
|
return false;
|
|
24841
24618
|
}
|
|
24842
|
-
function handleReviewViewToggleInput(input,
|
|
24619
|
+
function handleReviewViewToggleInput(input, state) {
|
|
24843
24620
|
if (input === "J") {
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
24621
|
+
state.setShowJson((previous) => !previous);
|
|
24622
|
+
state.setJsonScrollOffset(0);
|
|
24623
|
+
state.pendingGRef.current = false;
|
|
24847
24624
|
return true;
|
|
24848
24625
|
}
|
|
24849
24626
|
return false;
|
|
24850
24627
|
}
|
|
24851
|
-
function handleJsonPanelInput(input, key,
|
|
24852
|
-
if (
|
|
24853
|
-
const totalLines =
|
|
24854
|
-
const maxOffset = Math.max(0, totalLines -
|
|
24628
|
+
function handleJsonPanelInput(input, key, state) {
|
|
24629
|
+
if (state.sidebarFocused || !state.showJson) return false;
|
|
24630
|
+
const totalLines = state.jsonValue.split("\n").length;
|
|
24631
|
+
const maxOffset = Math.max(0, totalLines - state.height);
|
|
24855
24632
|
if (input === "g" && !key.ctrl) {
|
|
24856
|
-
if (
|
|
24857
|
-
|
|
24858
|
-
|
|
24633
|
+
if (state.pendingGRef.current) {
|
|
24634
|
+
state.pendingGRef.current = false;
|
|
24635
|
+
state.setJsonScrollOffset(() => 0);
|
|
24859
24636
|
return true;
|
|
24860
24637
|
}
|
|
24861
|
-
|
|
24638
|
+
state.pendingGRef.current = true;
|
|
24862
24639
|
return true;
|
|
24863
24640
|
}
|
|
24864
|
-
const next = computeNextScrollOffset(
|
|
24641
|
+
const next = computeNextScrollOffset(state.jsonScrollOffset, input, key, totalLines, state.height);
|
|
24865
24642
|
if (next !== null) {
|
|
24866
|
-
|
|
24643
|
+
state.pendingGRef.current = false;
|
|
24867
24644
|
const clamped = Math.min(maxOffset, Math.max(0, next));
|
|
24868
|
-
|
|
24645
|
+
state.setJsonScrollOffset(() => clamped);
|
|
24869
24646
|
return true;
|
|
24870
24647
|
}
|
|
24871
|
-
|
|
24648
|
+
state.pendingGRef.current = false;
|
|
24872
24649
|
return true;
|
|
24873
24650
|
}
|
|
24874
24651
|
|
|
@@ -25212,12 +24989,12 @@ var HELP_SECTIONS2 = [
|
|
|
25212
24989
|
title: "Panels",
|
|
25213
24990
|
entries: [
|
|
25214
24991
|
{ keys: "c", label: "Cycle list" },
|
|
25215
|
-
{ keys: "b", label: "
|
|
25216
|
-
{ keys: "w", label: "
|
|
25217
|
-
{ keys: "o", label: "
|
|
24992
|
+
{ keys: "b", label: "Show breaking changes" },
|
|
24993
|
+
{ keys: "w", label: "Filter components with breaking changes" },
|
|
24994
|
+
{ keys: "o", label: "Filter components in slot cycles" },
|
|
25218
24995
|
{ keys: "p", label: "Prop rationale" },
|
|
25219
24996
|
{ keys: "P", label: "Component rationale" },
|
|
25220
|
-
{ keys: "s", label: "Source" },
|
|
24997
|
+
{ keys: "s", label: "Source code snippet" },
|
|
25221
24998
|
{ keys: "J", label: "Toggle JSON" },
|
|
25222
24999
|
{ keys: "t", label: "Token review" }
|
|
25223
25000
|
]
|
|
@@ -25936,18 +25713,18 @@ function GenerateReviewStepView({
|
|
|
25936
25713
|
}
|
|
25937
25714
|
return;
|
|
25938
25715
|
}
|
|
25939
|
-
if (input === "c" && !key.ctrl && !key.meta && cycleRows.length > 0) {
|
|
25716
|
+
if (input === "c" && !reviewEditor.textEntryActive && !key.ctrl && !key.meta && cycleRows.length > 0) {
|
|
25940
25717
|
cyclePanel.open();
|
|
25941
25718
|
setCyclePanelScroll(0);
|
|
25942
25719
|
setCyclesCursor(0);
|
|
25943
25720
|
return;
|
|
25944
25721
|
}
|
|
25945
|
-
if (input === "b" && sidebarFocused && breakingChanges.length > 0) {
|
|
25722
|
+
if (input === "b" && !reviewEditor.textEntryActive && sidebarFocused && breakingChanges.length > 0) {
|
|
25946
25723
|
breakingPanel.open();
|
|
25947
25724
|
setBreakingCursor(0);
|
|
25948
25725
|
return;
|
|
25949
25726
|
}
|
|
25950
|
-
if (input === "o" || input === "w") {
|
|
25727
|
+
if (!reviewEditor.textEntryActive && (input === "o" || input === "w")) {
|
|
25951
25728
|
const category = input === "o" ? "cycles" : "broken";
|
|
25952
25729
|
setActiveFilters((prev) => {
|
|
25953
25730
|
const next = new Set(prev);
|
|
@@ -26333,6 +26110,7 @@ function GenerateReviewStepView({
|
|
|
26333
26110
|
visibleCount,
|
|
26334
26111
|
dimPredicate,
|
|
26335
26112
|
visibleRows: visibleRowsMemo,
|
|
26113
|
+
emptyMessage: visibleRowsMemo.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters }) : void 0,
|
|
26336
26114
|
viewMode: columnOneView,
|
|
26337
26115
|
graph: sidebarGraph
|
|
26338
26116
|
}
|
|
@@ -27217,38 +26995,38 @@ function buildRunTeaserLine(runId) {
|
|
|
27217
26995
|
|
|
27218
26996
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
27219
26997
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
27220
|
-
function totalStepsFor(
|
|
27221
|
-
const hasTokenStage = !!
|
|
27222
|
-
return 3 + (hasTokenStage ? 1 : 0) + 2 + (
|
|
26998
|
+
function totalStepsFor(state) {
|
|
26999
|
+
const hasTokenStage = !!state.tokensPath || !!state.rawTokensPath;
|
|
27000
|
+
return 3 + (hasTokenStage ? 1 : 0) + 2 + (state.mapTokensEligible === true ? 1 : 0);
|
|
27223
27001
|
}
|
|
27224
27002
|
function canEditFromPreview(cdf) {
|
|
27225
27003
|
if (!cdf) return false;
|
|
27226
27004
|
return parseCDFComponents(cdf).components.length > 0;
|
|
27227
27005
|
}
|
|
27228
27006
|
function FlowScreen({
|
|
27229
|
-
state
|
|
27007
|
+
state,
|
|
27230
27008
|
controller,
|
|
27231
27009
|
livePreview = true,
|
|
27232
27010
|
generatePromptPath,
|
|
27233
27011
|
onExit
|
|
27234
27012
|
}) {
|
|
27235
|
-
const totalSteps = totalStepsFor(
|
|
27013
|
+
const totalSteps = totalStepsFor(state);
|
|
27236
27014
|
const quit = () => onExit(0);
|
|
27237
27015
|
const content = (() => {
|
|
27238
|
-
switch (
|
|
27016
|
+
switch (state.step) {
|
|
27239
27017
|
case "final-review":
|
|
27240
27018
|
return /* @__PURE__ */ jsx52(
|
|
27241
27019
|
GenerateReviewStep,
|
|
27242
27020
|
{
|
|
27243
|
-
extractSessionId:
|
|
27244
|
-
tokenSessionId:
|
|
27021
|
+
extractSessionId: state.extractSessionId,
|
|
27022
|
+
tokenSessionId: state.tokenSessionId,
|
|
27245
27023
|
livePreview,
|
|
27246
|
-
spaceId:
|
|
27247
|
-
environmentId:
|
|
27248
|
-
cmaToken:
|
|
27249
|
-
host:
|
|
27250
|
-
tokensPath:
|
|
27251
|
-
initialFinalizeError:
|
|
27024
|
+
spaceId: state.spaceId,
|
|
27025
|
+
environmentId: state.environmentId,
|
|
27026
|
+
cmaToken: state.cmaToken,
|
|
27027
|
+
host: state.host,
|
|
27028
|
+
tokensPath: state.tokensPath,
|
|
27029
|
+
initialFinalizeError: state.finalizeErrorBanner,
|
|
27252
27030
|
onFinalize: controller.finalize,
|
|
27253
27031
|
onQuit: quit
|
|
27254
27032
|
}
|
|
@@ -27264,27 +27042,27 @@ function FlowScreen({
|
|
|
27264
27042
|
}
|
|
27265
27043
|
);
|
|
27266
27044
|
case "preview-gate":
|
|
27267
|
-
if (!
|
|
27045
|
+
if (!state.serverPreview) return null;
|
|
27268
27046
|
return /* @__PURE__ */ jsx52(
|
|
27269
27047
|
WizardPreviewStep,
|
|
27270
27048
|
{
|
|
27271
|
-
preview:
|
|
27272
|
-
spaceId:
|
|
27273
|
-
environmentId:
|
|
27049
|
+
preview: state.serverPreview,
|
|
27050
|
+
spaceId: state.spaceId,
|
|
27051
|
+
environmentId: state.environmentId,
|
|
27274
27052
|
stepNumber: totalSteps,
|
|
27275
27053
|
totalSteps,
|
|
27276
27054
|
onConfirm: controller.confirmPreview,
|
|
27277
|
-
...canEditFromPreview(
|
|
27055
|
+
...canEditFromPreview(state.cdf) ? { onEdit: controller.editDefinitions } : {},
|
|
27278
27056
|
onQuit: quit
|
|
27279
27057
|
}
|
|
27280
27058
|
);
|
|
27281
27059
|
case "pushing":
|
|
27282
|
-
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress:
|
|
27060
|
+
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress: state.pushProgress });
|
|
27283
27061
|
case "path-prompt":
|
|
27284
27062
|
return /* @__PURE__ */ jsx52(
|
|
27285
27063
|
PathPrompt,
|
|
27286
27064
|
{
|
|
27287
|
-
defaultPath:
|
|
27065
|
+
defaultPath: state.outDir,
|
|
27288
27066
|
onSubmit: (submitted) => void controller.submitPath(submitted),
|
|
27289
27067
|
onCancel: quit
|
|
27290
27068
|
}
|
|
@@ -27300,12 +27078,12 @@ function FlowScreen({
|
|
|
27300
27078
|
}
|
|
27301
27079
|
);
|
|
27302
27080
|
case "print-gate": {
|
|
27303
|
-
const teaser = buildRunTeaserLine(
|
|
27081
|
+
const teaser = buildRunTeaserLine(state.lastRunId);
|
|
27304
27082
|
return /* @__PURE__ */ jsx52(
|
|
27305
27083
|
GateStep,
|
|
27306
27084
|
{
|
|
27307
27085
|
message: "Files saved",
|
|
27308
|
-
summary:
|
|
27086
|
+
summary: state.componentsPath ? `components.json \u2192 ${state.componentsPath}` : void 0,
|
|
27309
27087
|
context: teaser ? `Your files are saved to disk. ${teaser}` : "Your files are saved to disk. Run `experiences import` again when you're ready to push to Contentful.",
|
|
27310
27088
|
continueLabel: "Exit",
|
|
27311
27089
|
onContinue: quit,
|
|
@@ -27314,17 +27092,17 @@ function FlowScreen({
|
|
|
27314
27092
|
);
|
|
27315
27093
|
}
|
|
27316
27094
|
case "done": {
|
|
27317
|
-
const totalFailed =
|
|
27095
|
+
const totalFailed = state.pushResult.componentTypes.failed + state.pushResult.designTokens.failed;
|
|
27318
27096
|
return /* @__PURE__ */ jsx52(
|
|
27319
27097
|
DoneStep,
|
|
27320
27098
|
{
|
|
27321
|
-
componentTypes:
|
|
27322
|
-
designTokens:
|
|
27323
|
-
summary:
|
|
27324
|
-
failures:
|
|
27325
|
-
spaceId:
|
|
27326
|
-
environmentId:
|
|
27327
|
-
host:
|
|
27099
|
+
componentTypes: state.pushResult.componentTypes,
|
|
27100
|
+
designTokens: state.pushResult.designTokens,
|
|
27101
|
+
summary: state.pushResult.summary,
|
|
27102
|
+
failures: state.pushResult.failures,
|
|
27103
|
+
spaceId: state.spaceId,
|
|
27104
|
+
environmentId: state.environmentId,
|
|
27105
|
+
host: state.host,
|
|
27328
27106
|
onExit: () => onExit(totalFailed > 0 ? 1 : 0)
|
|
27329
27107
|
}
|
|
27330
27108
|
);
|
|
@@ -27333,8 +27111,8 @@ function FlowScreen({
|
|
|
27333
27111
|
return /* @__PURE__ */ jsx52(
|
|
27334
27112
|
PreviewValidationErrorScreen,
|
|
27335
27113
|
{
|
|
27336
|
-
errors:
|
|
27337
|
-
missingNames:
|
|
27114
|
+
errors: state.previewValidationErrors,
|
|
27115
|
+
missingNames: state.previewValidationMissingNames,
|
|
27338
27116
|
onEdit: controller.editDefinitions,
|
|
27339
27117
|
onSkip: () => void controller.skipValidationErrors(),
|
|
27340
27118
|
onQuit: quit
|
|
@@ -27344,10 +27122,10 @@ function FlowScreen({
|
|
|
27344
27122
|
return /* @__PURE__ */ jsx52(
|
|
27345
27123
|
ErrorStep,
|
|
27346
27124
|
{
|
|
27347
|
-
stepName:
|
|
27348
|
-
message:
|
|
27125
|
+
stepName: state.errorStep,
|
|
27126
|
+
message: state.errorMessage,
|
|
27349
27127
|
onExit: () => onExit(1),
|
|
27350
|
-
onAcknowledgeBreakingChanges:
|
|
27128
|
+
onAcknowledgeBreakingChanges: state.errorAllowBreakingChangeAcknowledgment && state.cdf ? controller.acknowledgeBreakingChanges : void 0
|
|
27351
27129
|
}
|
|
27352
27130
|
);
|
|
27353
27131
|
}
|
|
@@ -27368,8 +27146,8 @@ import { tmpdir } from "node:os";
|
|
|
27368
27146
|
import { join as join23 } from "node:path";
|
|
27369
27147
|
|
|
27370
27148
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
27371
|
-
function shouldBypassPreview(
|
|
27372
|
-
return
|
|
27149
|
+
function shouldBypassPreview(state) {
|
|
27150
|
+
return state.credentialsSkipped === true;
|
|
27373
27151
|
}
|
|
27374
27152
|
function buildSkippedPreviewTransition() {
|
|
27375
27153
|
return { step: "done", serverPreview: null };
|
|
@@ -27378,8 +27156,8 @@ function resolveCycleGateAction(opts) {
|
|
|
27378
27156
|
if (!opts.hasCycles) return "proceed";
|
|
27379
27157
|
return "block";
|
|
27380
27158
|
}
|
|
27381
|
-
function shouldRefusePush(
|
|
27382
|
-
return
|
|
27159
|
+
function shouldRefusePush(state) {
|
|
27160
|
+
return state.credentialsSkipped === true;
|
|
27383
27161
|
}
|
|
27384
27162
|
function buildSkippedPushTransition() {
|
|
27385
27163
|
return { step: "print-gate" };
|
|
@@ -27774,17 +27552,17 @@ async function runPrintFiles(input, deps, onPatch) {
|
|
|
27774
27552
|
return { ok: true, patch: nextStateAfterPrint({ skipGate: input.skipGate, componentsPath }) };
|
|
27775
27553
|
}
|
|
27776
27554
|
async function recordRun(input, deps) {
|
|
27777
|
-
const { state
|
|
27555
|
+
const { state } = input;
|
|
27778
27556
|
try {
|
|
27779
27557
|
let sourceFingerprint = null;
|
|
27780
27558
|
try {
|
|
27781
|
-
if (
|
|
27559
|
+
if (state.extractSessionId) {
|
|
27782
27560
|
const db = deps.openDb();
|
|
27783
27561
|
try {
|
|
27784
27562
|
sourceFingerprint = await deps.buildSourceFingerprint({
|
|
27785
27563
|
db,
|
|
27786
|
-
extractSessionId:
|
|
27787
|
-
rawTokensPath:
|
|
27564
|
+
extractSessionId: state.extractSessionId,
|
|
27565
|
+
rawTokensPath: state.rawTokensPath || null
|
|
27788
27566
|
});
|
|
27789
27567
|
} finally {
|
|
27790
27568
|
db.close();
|
|
@@ -27795,16 +27573,16 @@ async function recordRun(input, deps) {
|
|
|
27795
27573
|
`);
|
|
27796
27574
|
}
|
|
27797
27575
|
const record3 = await deps.appendRun({
|
|
27798
|
-
projectPath:
|
|
27576
|
+
projectPath: state.projectPath,
|
|
27799
27577
|
savePath: input.savePath,
|
|
27800
|
-
componentCount:
|
|
27801
|
-
tokenCount:
|
|
27802
|
-
tokensPath: (
|
|
27803
|
-
tokenSessionId:
|
|
27804
|
-
agent:
|
|
27578
|
+
componentCount: state.generatedAcceptedCount || state.generatedCount,
|
|
27579
|
+
tokenCount: state.tokenCount,
|
|
27580
|
+
tokensPath: (state.tokenSessionId ? state.tokensPath || null : null) || null,
|
|
27581
|
+
tokenSessionId: state.tokenSessionId,
|
|
27582
|
+
agent: state.agent,
|
|
27805
27583
|
pushedTo: null,
|
|
27806
|
-
extractSessionId:
|
|
27807
|
-
generateSessionId:
|
|
27584
|
+
extractSessionId: state.extractSessionId ?? "",
|
|
27585
|
+
generateSessionId: state.generateSessionId,
|
|
27808
27586
|
sourceFingerprint
|
|
27809
27587
|
});
|
|
27810
27588
|
return record3.id;
|
|
@@ -27940,7 +27718,7 @@ function namesToSkip(errors) {
|
|
|
27940
27718
|
return [...new Set(errors.map((e) => e.componentName))];
|
|
27941
27719
|
}
|
|
27942
27720
|
function createFlowController(start, deps) {
|
|
27943
|
-
let
|
|
27721
|
+
let state = initialFlowState(start);
|
|
27944
27722
|
const listeners = /* @__PURE__ */ new Set();
|
|
27945
27723
|
let allowEmptyDeleteAll = false;
|
|
27946
27724
|
let pendingSave = {};
|
|
@@ -27949,27 +27727,27 @@ function createFlowController(start, deps) {
|
|
|
27949
27727
|
deps.log({ update: sanitizeForLog(patch) });
|
|
27950
27728
|
} catch {
|
|
27951
27729
|
}
|
|
27952
|
-
if (patch.step !== void 0 && patch.step !==
|
|
27730
|
+
if (patch.step !== void 0 && patch.step !== state.step) {
|
|
27953
27731
|
try {
|
|
27954
27732
|
deps.beforeStepChange?.();
|
|
27955
27733
|
} catch {
|
|
27956
27734
|
}
|
|
27957
27735
|
}
|
|
27958
|
-
|
|
27736
|
+
state = { ...state, ...patch };
|
|
27959
27737
|
for (const listener of listeners) listener();
|
|
27960
27738
|
};
|
|
27961
27739
|
const preview = async () => {
|
|
27962
|
-
if (!
|
|
27740
|
+
if (!state.credentialsSkipped) update({ step: "previewing" });
|
|
27963
27741
|
update(
|
|
27964
27742
|
await runPreview(
|
|
27965
27743
|
{
|
|
27966
|
-
state
|
|
27967
|
-
extractSessionId:
|
|
27968
|
-
tokensPath:
|
|
27969
|
-
spaceId:
|
|
27970
|
-
environmentId:
|
|
27971
|
-
cmaToken:
|
|
27972
|
-
host:
|
|
27744
|
+
state,
|
|
27745
|
+
extractSessionId: state.extractSessionId,
|
|
27746
|
+
tokensPath: state.tokensPath,
|
|
27747
|
+
spaceId: state.spaceId,
|
|
27748
|
+
environmentId: state.environmentId,
|
|
27749
|
+
cmaToken: state.cmaToken,
|
|
27750
|
+
host: state.host,
|
|
27973
27751
|
deleteAll: allowEmptyDeleteAll
|
|
27974
27752
|
},
|
|
27975
27753
|
deps.preview
|
|
@@ -27977,18 +27755,18 @@ function createFlowController(start, deps) {
|
|
|
27977
27755
|
);
|
|
27978
27756
|
};
|
|
27979
27757
|
const push = async (acknowledgeBreakingChanges) => {
|
|
27980
|
-
if (!
|
|
27758
|
+
if (!state.cdf) return;
|
|
27981
27759
|
update(
|
|
27982
27760
|
await runPush(
|
|
27983
27761
|
{
|
|
27984
|
-
state
|
|
27985
|
-
cdf:
|
|
27986
|
-
spaceId:
|
|
27987
|
-
environmentId:
|
|
27988
|
-
cmaToken:
|
|
27989
|
-
host:
|
|
27762
|
+
state,
|
|
27763
|
+
cdf: state.cdf,
|
|
27764
|
+
spaceId: state.spaceId,
|
|
27765
|
+
environmentId: state.environmentId,
|
|
27766
|
+
cmaToken: state.cmaToken,
|
|
27767
|
+
host: state.host,
|
|
27990
27768
|
acknowledgeBreakingChanges,
|
|
27991
|
-
preview:
|
|
27769
|
+
preview: state.serverPreview
|
|
27992
27770
|
},
|
|
27993
27771
|
deps.push,
|
|
27994
27772
|
update
|
|
@@ -28004,11 +27782,11 @@ function createFlowController(start, deps) {
|
|
|
28004
27782
|
const { skipGate, andPush } = pendingSave;
|
|
28005
27783
|
const written = await runPrintFiles(
|
|
28006
27784
|
{
|
|
28007
|
-
extractSessionId:
|
|
27785
|
+
extractSessionId: state.extractSessionId,
|
|
28008
27786
|
outDir: path5,
|
|
28009
27787
|
...skipGate ? { skipGate: true } : {},
|
|
28010
|
-
...
|
|
28011
|
-
...
|
|
27788
|
+
...state.tokenSessionId ? { tokenSessionId: state.tokenSessionId } : {},
|
|
27789
|
+
...state.tokensPath ? { tokensPath: state.tokensPath } : {},
|
|
28012
27790
|
...allowEmptyDeleteAll ? { allowEmpty: true } : {}
|
|
28013
27791
|
},
|
|
28014
27792
|
deps.save,
|
|
@@ -28016,21 +27794,21 @@ function createFlowController(start, deps) {
|
|
|
28016
27794
|
);
|
|
28017
27795
|
update(written.patch);
|
|
28018
27796
|
if (!written.ok) return;
|
|
28019
|
-
const runId = await recordRun({ state
|
|
27797
|
+
const runId = await recordRun({ state, savePath: path5 }, deps.save);
|
|
28020
27798
|
if (runId) update({ lastRunId: runId });
|
|
28021
27799
|
if (andPush) await preview();
|
|
28022
27800
|
};
|
|
28023
27801
|
const detectAcceptedCycles = () => {
|
|
28024
|
-
if (!
|
|
27802
|
+
if (!state.extractSessionId) return [];
|
|
28025
27803
|
try {
|
|
28026
|
-
const accepted = deps.loadAcceptedComponents(
|
|
27804
|
+
const accepted = deps.loadAcceptedComponents(state.extractSessionId);
|
|
28027
27805
|
return findSlotCycles3(buildComponentGraph3(accepted));
|
|
28028
27806
|
} catch {
|
|
28029
27807
|
return [];
|
|
28030
27808
|
}
|
|
28031
27809
|
};
|
|
28032
27810
|
const begin = () => {
|
|
28033
|
-
if (!
|
|
27811
|
+
if (!state.extractSessionId || !start.handoff.generation) {
|
|
28034
27812
|
update({
|
|
28035
27813
|
step: "error",
|
|
28036
27814
|
errorStep: "start import",
|
|
@@ -28047,7 +27825,7 @@ function createFlowController(start, deps) {
|
|
|
28047
27825
|
};
|
|
28048
27826
|
begin();
|
|
28049
27827
|
return {
|
|
28050
|
-
getState: () =>
|
|
27828
|
+
getState: () => state,
|
|
28051
27829
|
subscribe: (listener) => {
|
|
28052
27830
|
listeners.add(listener);
|
|
28053
27831
|
return () => listeners.delete(listener);
|
|
@@ -28082,9 +27860,9 @@ function createFlowController(start, deps) {
|
|
|
28082
27860
|
acknowledgeBreakingChanges: () => void push(true),
|
|
28083
27861
|
editDefinitions: () => update({ step: "final-review" }),
|
|
28084
27862
|
async skipValidationErrors() {
|
|
28085
|
-
if (
|
|
28086
|
-
const names = namesToSkip(
|
|
28087
|
-
if (names.length > 0) await deps.rejectComponentsByName(
|
|
27863
|
+
if (state.extractSessionId) {
|
|
27864
|
+
const names = namesToSkip(state.previewValidationErrors);
|
|
27865
|
+
if (names.length > 0) await deps.rejectComponentsByName(state.extractSessionId, names);
|
|
28088
27866
|
}
|
|
28089
27867
|
await preview();
|
|
28090
27868
|
}
|
|
@@ -28106,14 +27884,14 @@ function useFlow(start, options = {}) {
|
|
|
28106
27884
|
});
|
|
28107
27885
|
}
|
|
28108
27886
|
const current = controller.current;
|
|
28109
|
-
const
|
|
27887
|
+
const state = useSyncExternalStore(
|
|
28110
27888
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
28111
27889
|
() => current?.getState()
|
|
28112
27890
|
);
|
|
28113
27891
|
useEffect20(() => {
|
|
28114
27892
|
if (!start) controller.current = void 0;
|
|
28115
27893
|
}, [start]);
|
|
28116
|
-
return current &&
|
|
27894
|
+
return current && state ? { controller: current, state } : void 0;
|
|
28117
27895
|
}
|
|
28118
27896
|
|
|
28119
27897
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
@@ -28859,16 +28637,16 @@ function App({ importOptions, inkClear }) {
|
|
|
28859
28637
|
const finishCredentials = async (result, projectPath2, tokens, filePaths) => {
|
|
28860
28638
|
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
28861
28639
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
28862
|
-
const
|
|
28640
|
+
const state = await inspectTokens({
|
|
28863
28641
|
rawTokensPath: tokens,
|
|
28864
28642
|
outDir: join25(resolveUserPath(projectPath2), ".contentful"),
|
|
28865
28643
|
cache: importOptions.cache
|
|
28866
28644
|
});
|
|
28867
|
-
if (
|
|
28645
|
+
if (state.kind === "cached") {
|
|
28868
28646
|
setPendingLaunch({
|
|
28869
28647
|
launch,
|
|
28870
28648
|
credentials: result,
|
|
28871
|
-
cached: { tokensPath:
|
|
28649
|
+
cached: { tokensPath: state.tokensPath, sourceChanged: state.sourceChanged }
|
|
28872
28650
|
});
|
|
28873
28651
|
return;
|
|
28874
28652
|
}
|