@contentful/experience-design-system-cli 2.37.1-dev-build-6fb2b08b.0 → 2.37.1-dev-build-a6ad74de.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 +228 -435
- package/dist/index.js +1568 -1967
- 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
|
@@ -2082,7 +2082,7 @@ var init_cache_keys = __esm({
|
|
|
2082
2082
|
});
|
|
2083
2083
|
|
|
2084
2084
|
// packages/experience-design-system-types/dist/src/config/index.js
|
|
2085
|
-
import { randomBytes as
|
|
2085
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
2086
2086
|
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
2087
2087
|
import { homedir as homedir3 } from "node:os";
|
|
2088
2088
|
import { dirname as dirname13, join as join17 } from "node:path";
|
|
@@ -2099,7 +2099,7 @@ async function readSettings2() {
|
|
|
2099
2099
|
async function writeSettings2(settings) {
|
|
2100
2100
|
const path5 = configFilePath2();
|
|
2101
2101
|
await mkdir6(dirname13(path5), { recursive: true });
|
|
2102
|
-
const tmp = `${path5}.${process.pid}.${
|
|
2102
|
+
const tmp = `${path5}.${process.pid}.${randomBytes3(4).toString("hex")}.tmp`;
|
|
2103
2103
|
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
2104
2104
|
`, { mode: 384 });
|
|
2105
2105
|
await rename2(tmp, path5);
|
|
@@ -4993,7 +4993,7 @@ async function getCliCacheVersion() {
|
|
|
4993
4993
|
return _cliCacheVersionCache;
|
|
4994
4994
|
}
|
|
4995
4995
|
}
|
|
4996
|
-
function storeExtractCache(db, filePath, fileHash,
|
|
4996
|
+
function storeExtractCache(db, filePath, fileHash, cliVersion, components) {
|
|
4997
4997
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4998
4998
|
const componentsJson = JSON.stringify(components);
|
|
4999
4999
|
db.prepare(`INSERT INTO extract_cache (file_path, file_hash, cli_version, created_at, updated_at, components_json)
|
|
@@ -5001,12 +5001,12 @@ function storeExtractCache(db, filePath, fileHash, cliVersion2, components) {
|
|
|
5001
5001
|
ON CONFLICT(file_hash, cli_version) DO UPDATE SET
|
|
5002
5002
|
file_path = excluded.file_path,
|
|
5003
5003
|
updated_at = excluded.updated_at,
|
|
5004
|
-
components_json = excluded.components_json`).run(filePath, fileHash,
|
|
5004
|
+
components_json = excluded.components_json`).run(filePath, fileHash, cliVersion, now, now, componentsJson);
|
|
5005
5005
|
}
|
|
5006
|
-
function lookupExtractCache(db, fileHash,
|
|
5006
|
+
function lookupExtractCache(db, fileHash, cliVersion) {
|
|
5007
5007
|
const row = db.prepare(`SELECT file_path, file_hash, cli_version, created_at, updated_at, components_json
|
|
5008
5008
|
FROM extract_cache
|
|
5009
|
-
WHERE file_hash = ? AND cli_version = ?`).get(fileHash,
|
|
5009
|
+
WHERE file_hash = ? AND cli_version = ?`).get(fileHash, cliVersion);
|
|
5010
5010
|
if (!row)
|
|
5011
5011
|
return null;
|
|
5012
5012
|
let components = [];
|
|
@@ -5024,31 +5024,31 @@ function lookupExtractCache(db, fileHash, cliVersion2) {
|
|
|
5024
5024
|
components
|
|
5025
5025
|
};
|
|
5026
5026
|
}
|
|
5027
|
-
function storeCompositionCache(db, inputHash,
|
|
5027
|
+
function storeCompositionCache(db, inputHash, cliVersion, agentOutput) {
|
|
5028
5028
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5029
5029
|
db.prepare(`INSERT INTO composition_cache (input_hash, cli_version, agent_output, created_at, updated_at)
|
|
5030
5030
|
VALUES (?, ?, ?, ?, ?)
|
|
5031
5031
|
ON CONFLICT(input_hash, cli_version) DO UPDATE SET
|
|
5032
5032
|
agent_output = excluded.agent_output,
|
|
5033
|
-
updated_at = excluded.updated_at`).run(inputHash,
|
|
5033
|
+
updated_at = excluded.updated_at`).run(inputHash, cliVersion, agentOutput, now, now);
|
|
5034
5034
|
}
|
|
5035
|
-
function lookupCompositionCache(db, inputHash,
|
|
5036
|
-
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash,
|
|
5035
|
+
function lookupCompositionCache(db, inputHash, cliVersion) {
|
|
5036
|
+
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash, cliVersion);
|
|
5037
5037
|
return row ? row.agent_output : null;
|
|
5038
5038
|
}
|
|
5039
|
-
function storeSelectCache(db, componentHash, promptHash,
|
|
5039
|
+
function storeSelectCache(db, componentHash, promptHash, cliVersion, decision, reason) {
|
|
5040
5040
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5041
5041
|
db.prepare(`INSERT INTO select_cache (component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at)
|
|
5042
5042
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
5043
5043
|
ON CONFLICT(component_hash, prompt_hash, cli_version) DO UPDATE SET
|
|
5044
5044
|
decision = excluded.decision,
|
|
5045
5045
|
reason = excluded.reason,
|
|
5046
|
-
updated_at = excluded.updated_at`).run(componentHash, promptHash,
|
|
5046
|
+
updated_at = excluded.updated_at`).run(componentHash, promptHash, cliVersion, decision, reason, now, now);
|
|
5047
5047
|
}
|
|
5048
|
-
function lookupSelectCache(db, componentHash, promptHash,
|
|
5048
|
+
function lookupSelectCache(db, componentHash, promptHash, cliVersion) {
|
|
5049
5049
|
const row = db.prepare(`SELECT component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at
|
|
5050
5050
|
FROM select_cache
|
|
5051
|
-
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash,
|
|
5051
|
+
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash, cliVersion);
|
|
5052
5052
|
if (!row)
|
|
5053
5053
|
return null;
|
|
5054
5054
|
return {
|
|
@@ -13140,60 +13140,6 @@ async function loadAcceptedNames(sessionId) {
|
|
|
13140
13140
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/index.js
|
|
13141
13141
|
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
13142
13142
|
|
|
13143
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
|
|
13144
|
-
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
13145
|
-
var ADJECTIVES2 = [
|
|
13146
|
-
"bright",
|
|
13147
|
-
"calm",
|
|
13148
|
-
"dark",
|
|
13149
|
-
"fast",
|
|
13150
|
-
"green",
|
|
13151
|
-
"happy",
|
|
13152
|
-
"keen",
|
|
13153
|
-
"light",
|
|
13154
|
-
"long",
|
|
13155
|
-
"loud",
|
|
13156
|
-
"pale",
|
|
13157
|
-
"quick",
|
|
13158
|
-
"sharp",
|
|
13159
|
-
"slow",
|
|
13160
|
-
"soft",
|
|
13161
|
-
"warm",
|
|
13162
|
-
"wild",
|
|
13163
|
-
"wise"
|
|
13164
|
-
];
|
|
13165
|
-
var NOUNS2 = [
|
|
13166
|
-
"cloud",
|
|
13167
|
-
"creek",
|
|
13168
|
-
"dawn",
|
|
13169
|
-
"dusk",
|
|
13170
|
-
"field",
|
|
13171
|
-
"flame",
|
|
13172
|
-
"frost",
|
|
13173
|
-
"grove",
|
|
13174
|
-
"hill",
|
|
13175
|
-
"lake",
|
|
13176
|
-
"leaf",
|
|
13177
|
-
"moon",
|
|
13178
|
-
"peak",
|
|
13179
|
-
"rain",
|
|
13180
|
-
"river",
|
|
13181
|
-
"rock",
|
|
13182
|
-
"snow",
|
|
13183
|
-
"star",
|
|
13184
|
-
"storm",
|
|
13185
|
-
"tide",
|
|
13186
|
-
"tree",
|
|
13187
|
-
"wave",
|
|
13188
|
-
"wind"
|
|
13189
|
-
];
|
|
13190
|
-
function generateSessionId2() {
|
|
13191
|
-
const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
|
|
13192
|
-
const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
|
|
13193
|
-
const hex = randomBytes3(2).toString("hex");
|
|
13194
|
-
return `${adj}-${noun}-${hex}`;
|
|
13195
|
-
}
|
|
13196
|
-
|
|
13197
13143
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/migration.js
|
|
13198
13144
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
13199
13145
|
|
|
@@ -14999,172 +14945,6 @@ function loadTokenLeaves(db, sessionId) {
|
|
|
14999
14945
|
return db.prepare("SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path").all(sessionId);
|
|
15000
14946
|
}
|
|
15001
14947
|
|
|
15002
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/cli-info.js
|
|
15003
|
-
var cliVersionString = "0.0.0-unknown";
|
|
15004
|
-
function cliVersion() {
|
|
15005
|
-
return cliVersionString;
|
|
15006
|
-
}
|
|
15007
|
-
|
|
15008
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/opt-out.js
|
|
15009
|
-
var persistedDisabled = false;
|
|
15010
|
-
function analyticsEnabled() {
|
|
15011
|
-
return !persistedDisabled && !process.env["DISABLE_ANALYTICS"];
|
|
15012
|
-
}
|
|
15013
|
-
|
|
15014
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js
|
|
15015
|
-
import { Analytics } from "@segment/analytics-node";
|
|
15016
|
-
var DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
15017
|
-
var analyticsClient = null;
|
|
15018
|
-
function resolveWriteKey() {
|
|
15019
|
-
const key = (process.env["SEGMENT_WRITE_KEY"] ?? "").trim();
|
|
15020
|
-
return key.length > 0 ? key : DEFAULT_WRITE_KEY;
|
|
15021
|
-
}
|
|
15022
|
-
function getClient() {
|
|
15023
|
-
if (!analyticsEnabled())
|
|
15024
|
-
return null;
|
|
15025
|
-
const writeKey = resolveWriteKey();
|
|
15026
|
-
if (!writeKey)
|
|
15027
|
-
return null;
|
|
15028
|
-
if (!analyticsClient) {
|
|
15029
|
-
analyticsClient = new Analytics({ writeKey });
|
|
15030
|
-
analyticsClient.on("error", () => {
|
|
15031
|
-
});
|
|
15032
|
-
}
|
|
15033
|
-
return analyticsClient;
|
|
15034
|
-
}
|
|
15035
|
-
async function trackEvent(event, properties, anonymousId, options) {
|
|
15036
|
-
const client2 = getClient();
|
|
15037
|
-
if (!client2)
|
|
15038
|
-
return;
|
|
15039
|
-
try {
|
|
15040
|
-
client2.track({
|
|
15041
|
-
event,
|
|
15042
|
-
properties,
|
|
15043
|
-
anonymousId,
|
|
15044
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
15045
|
-
});
|
|
15046
|
-
if (options?.flush)
|
|
15047
|
-
await flushAnalytics();
|
|
15048
|
-
} catch {
|
|
15049
|
-
}
|
|
15050
|
-
}
|
|
15051
|
-
async function flushAnalytics() {
|
|
15052
|
-
if (!analyticsClient)
|
|
15053
|
-
return;
|
|
15054
|
-
try {
|
|
15055
|
-
await analyticsClient.closeAndFlush();
|
|
15056
|
-
} catch {
|
|
15057
|
-
} finally {
|
|
15058
|
-
analyticsClient = null;
|
|
15059
|
-
}
|
|
15060
|
-
}
|
|
15061
|
-
|
|
15062
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js
|
|
15063
|
-
var ANALYTICS_SESSION_ENV = "EDS_ANALYTICS_SESSION_ID";
|
|
15064
|
-
var IMPORT_PIPELINE_ENV = "EDS_IMPORT_PIPELINE";
|
|
15065
|
-
|
|
15066
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/session.js
|
|
15067
|
-
function resolveAnalyticsSessionId(explicit) {
|
|
15068
|
-
const inherited = process.env[ANALYTICS_SESSION_ENV]?.trim();
|
|
15069
|
-
if (inherited)
|
|
15070
|
-
return inherited;
|
|
15071
|
-
const passed = explicit?.trim();
|
|
15072
|
-
if (passed)
|
|
15073
|
-
return passed;
|
|
15074
|
-
return generateSessionId2();
|
|
15075
|
-
}
|
|
15076
|
-
function isPipelineAnalyticsChild() {
|
|
15077
|
-
return Boolean(process.env[ANALYTICS_SESSION_ENV]?.trim());
|
|
15078
|
-
}
|
|
15079
|
-
|
|
15080
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/pending-command.js
|
|
15081
|
-
var state = {
|
|
15082
|
-
pending: null,
|
|
15083
|
-
sessionId: void 0,
|
|
15084
|
-
sessionStartedEmitted: false
|
|
15085
|
-
};
|
|
15086
|
-
function isPipelineStep() {
|
|
15087
|
-
return process.env[IMPORT_PIPELINE_ENV] === "1";
|
|
15088
|
-
}
|
|
15089
|
-
function buildBaseProps(command) {
|
|
15090
|
-
return {
|
|
15091
|
-
dsi_session_id: state.sessionId,
|
|
15092
|
-
command,
|
|
15093
|
-
...isPipelineStep() ? { is_pipeline_step: true } : {}
|
|
15094
|
-
};
|
|
15095
|
-
}
|
|
15096
|
-
function mergeContext(target, source) {
|
|
15097
|
-
if (source.space_key !== void 0)
|
|
15098
|
-
target.space_key = source.space_key;
|
|
15099
|
-
if (source.environment_key !== void 0)
|
|
15100
|
-
target.environment_key = source.environment_key;
|
|
15101
|
-
if (source.x_contentful_request_id !== void 0) {
|
|
15102
|
-
target.x_contentful_request_id = source.x_contentful_request_id;
|
|
15103
|
-
}
|
|
15104
|
-
}
|
|
15105
|
-
function setCommandContext(context) {
|
|
15106
|
-
if (!state.pending)
|
|
15107
|
-
return;
|
|
15108
|
-
mergeContext(state.pending.context, context);
|
|
15109
|
-
mergeContext(state.pending.completion, context);
|
|
15110
|
-
}
|
|
15111
|
-
function enrichCommandResult(fields) {
|
|
15112
|
-
if (!state.pending)
|
|
15113
|
-
return;
|
|
15114
|
-
Object.assign(state.pending.completion, fields);
|
|
15115
|
-
mergeContext(state.pending.context, fields);
|
|
15116
|
-
}
|
|
15117
|
-
|
|
15118
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/os.js
|
|
15119
|
-
var OS_NAMES2 = {
|
|
15120
|
-
android: "Android",
|
|
15121
|
-
aix: "Linux",
|
|
15122
|
-
darwin: "macOS",
|
|
15123
|
-
freebsd: "Linux",
|
|
15124
|
-
linux: "Linux",
|
|
15125
|
-
openbsd: "Linux",
|
|
15126
|
-
sunos: "Linux",
|
|
15127
|
-
win32: "Windows"
|
|
15128
|
-
};
|
|
15129
|
-
function getOsName() {
|
|
15130
|
-
return OS_NAMES2[process.platform] ?? "other";
|
|
15131
|
-
}
|
|
15132
|
-
|
|
15133
|
-
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/emit-events.js
|
|
15134
|
-
async function bindAnalyticsSessionId(explicit, context) {
|
|
15135
|
-
const id = resolveAnalyticsSessionId(explicit);
|
|
15136
|
-
await bindAnalyticsSession(id, context);
|
|
15137
|
-
return id;
|
|
15138
|
-
}
|
|
15139
|
-
async function bindAnalyticsSession(id, context) {
|
|
15140
|
-
state.sessionId = id;
|
|
15141
|
-
if (context)
|
|
15142
|
-
setCommandContext(context);
|
|
15143
|
-
await emitInvokedIfReady();
|
|
15144
|
-
}
|
|
15145
|
-
async function emitSessionStarted(entryCommand) {
|
|
15146
|
-
if (!state.sessionId || state.sessionStartedEmitted)
|
|
15147
|
-
return;
|
|
15148
|
-
state.sessionStartedEmitted = true;
|
|
15149
|
-
await trackEvent("dsi_cli_session_started", {
|
|
15150
|
-
dsi_session_id: state.sessionId,
|
|
15151
|
-
entry_command: entryCommand,
|
|
15152
|
-
cli_version: cliVersion(),
|
|
15153
|
-
node_version: process.version,
|
|
15154
|
-
os_name: getOsName()
|
|
15155
|
-
}, state.sessionId, { flush: true });
|
|
15156
|
-
await emitInvokedIfReady();
|
|
15157
|
-
}
|
|
15158
|
-
async function emitInvokedIfReady() {
|
|
15159
|
-
if (!state.pending || state.pending.invoked || !state.sessionId)
|
|
15160
|
-
return;
|
|
15161
|
-
state.pending.invoked = true;
|
|
15162
|
-
await trackEvent("dsi_cli_command_invoked", {
|
|
15163
|
-
...buildBaseProps(state.pending.command),
|
|
15164
|
-
...state.pending.context
|
|
15165
|
-
}, state.sessionId, { flush: true });
|
|
15166
|
-
}
|
|
15167
|
-
|
|
15168
14948
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
15169
14949
|
var DEFAULT_TIMEOUT_MS2 = 5 * 60 * 1e3;
|
|
15170
14950
|
var MapTokensRunFailure = class _MapTokensRunFailure extends Error {
|
|
@@ -15194,7 +14974,6 @@ async function runMapTokens(request) {
|
|
|
15194
14974
|
if (!sessionId) {
|
|
15195
14975
|
throw new MapTokensRunFailure({ type: "no-session" });
|
|
15196
14976
|
}
|
|
15197
|
-
await bindAnalyticsSessionId(sessionId);
|
|
15198
14977
|
const tokenLeaves = loadTokenLeaves(db, sessionId);
|
|
15199
14978
|
const knownTokenPaths = new Set(tokenLeaves.map((t) => t.path));
|
|
15200
14979
|
if (request.tokenMapInline) {
|
|
@@ -16508,9 +16287,6 @@ async function runExtractAndComposeSession(request) {
|
|
|
16508
16287
|
outDir
|
|
16509
16288
|
});
|
|
16510
16289
|
await onSessionCreated?.(sessionId);
|
|
16511
|
-
await bindAnalyticsSessionId(sessionId);
|
|
16512
|
-
if (!isPipelineAnalyticsChild())
|
|
16513
|
-
await emitSessionStarted("analyze_extract");
|
|
16514
16290
|
const stepId = createStep(db, sessionId, "analyze extract", { project: projectPath });
|
|
16515
16291
|
if (cacheHits === 0 && !noCache) {
|
|
16516
16292
|
await persistExtractCache(db, sourceFiles, extraction.components, cacheVersion);
|
|
@@ -16538,7 +16314,6 @@ async function runExtractAndComposeSession(request) {
|
|
|
16538
16314
|
await persistSlotCycles(db, sessionId, composition.components);
|
|
16539
16315
|
storeScannedFiles(db, sessionId, sourceFiles.map((f) => relative2(projectPath, f)));
|
|
16540
16316
|
await retryDatabaseWrite(() => updateStep(db, stepId, "complete", { sessionId }));
|
|
16541
|
-
enrichCommandResult({ extracted_component_count: composition.components.length });
|
|
16542
16317
|
return {
|
|
16543
16318
|
sessionId,
|
|
16544
16319
|
compositionPhase: composition.phase,
|
|
@@ -16601,7 +16376,6 @@ async function runGenerateTokensSession(request) {
|
|
|
16601
16376
|
outDir
|
|
16602
16377
|
});
|
|
16603
16378
|
await onSessionCreated?.(tokenSessionId);
|
|
16604
|
-
await bindAnalyticsSessionId(tokenSessionId);
|
|
16605
16379
|
const tokenPromptHash = await hashPromptForSkill("tokens", agent, agentModel, skillPath);
|
|
16606
16380
|
const warnings = [];
|
|
16607
16381
|
onProgress?.({ kind: "resolving" });
|
|
@@ -16978,7 +16752,6 @@ async function runGenerateComponentsSession(request) {
|
|
|
16978
16752
|
const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
|
|
16979
16753
|
const agent = request.agent;
|
|
16980
16754
|
const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
|
|
16981
|
-
await bindAnalyticsSessionId(request.sessionId);
|
|
16982
16755
|
const db = openPipelineDb();
|
|
16983
16756
|
try {
|
|
16984
16757
|
const acceptedNames = await loadAcceptedNames(request.sessionId);
|
|
@@ -17741,13 +17514,13 @@ async function runSelection(options) {
|
|
|
17741
17514
|
const db = openPipelineDb();
|
|
17742
17515
|
let components;
|
|
17743
17516
|
const cachedDecisions = /* @__PURE__ */ new Map();
|
|
17744
|
-
const
|
|
17517
|
+
const cliVersion = await getCliCacheVersion();
|
|
17745
17518
|
const promptHash = await hashSelectPrompt(options);
|
|
17746
17519
|
try {
|
|
17747
17520
|
components = loadRawComponents(db, options.sessionId);
|
|
17748
17521
|
if (!options.noCache) {
|
|
17749
17522
|
for (const component of components) {
|
|
17750
|
-
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash,
|
|
17523
|
+
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash, cliVersion);
|
|
17751
17524
|
if (cached) cachedDecisions.set(component.name, { decision: cached.decision, reason: cached.reason });
|
|
17752
17525
|
}
|
|
17753
17526
|
}
|
|
@@ -17802,7 +17575,7 @@ async function runSelection(options) {
|
|
|
17802
17575
|
writeDb,
|
|
17803
17576
|
hashComponentShape(component),
|
|
17804
17577
|
promptHash,
|
|
17805
|
-
|
|
17578
|
+
cliVersion,
|
|
17806
17579
|
rejected ? "rejected" : "accepted",
|
|
17807
17580
|
rejected ? reason : null
|
|
17808
17581
|
);
|
|
@@ -17962,7 +17735,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
17962
17735
|
|
|
17963
17736
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
17964
17737
|
function useExtraction(input) {
|
|
17965
|
-
const [
|
|
17738
|
+
const [state, setState] = useState8();
|
|
17966
17739
|
const current = useRef2();
|
|
17967
17740
|
useEffect5(() => {
|
|
17968
17741
|
current.current = input;
|
|
@@ -17987,7 +17760,7 @@ function useExtraction(input) {
|
|
|
17987
17760
|
if (current.current === input) current.current = void 0;
|
|
17988
17761
|
};
|
|
17989
17762
|
}, [input]);
|
|
17990
|
-
return
|
|
17763
|
+
return state;
|
|
17991
17764
|
}
|
|
17992
17765
|
|
|
17993
17766
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
@@ -19157,7 +18930,8 @@ function GroupedSidebar(props) {
|
|
|
19157
18930
|
dimPredicate,
|
|
19158
18931
|
visibleRows: providedRows,
|
|
19159
18932
|
graph,
|
|
19160
|
-
filterVisibleKeys
|
|
18933
|
+
filterVisibleKeys,
|
|
18934
|
+
emptyMessage
|
|
19161
18935
|
} = props;
|
|
19162
18936
|
const allRows = providedRows ?? buildVisibleRows({
|
|
19163
18937
|
items,
|
|
@@ -19174,6 +18948,10 @@ function GroupedSidebar(props) {
|
|
|
19174
18948
|
const end = windowed ? start + (visibleCount ?? allRows.length) : allRows.length;
|
|
19175
18949
|
const rows = windowed ? allRows.slice(start, end) : allRows;
|
|
19176
18950
|
return /* @__PURE__ */ jsxs18(WindowedPanel, { width, height: props.height, title, focused, children: [
|
|
18951
|
+
allRows.length === 0 && emptyMessage !== void 0 && /* @__PURE__ */ jsxs18(Text19, { color: PALETTE2.warning, children: [
|
|
18952
|
+
" ",
|
|
18953
|
+
emptyMessage
|
|
18954
|
+
] }),
|
|
19177
18955
|
windowed && /* @__PURE__ */ jsx21(WindowIndicator, { direction: "up", count: start }),
|
|
19178
18956
|
rows.map((row, i) => {
|
|
19179
18957
|
const absoluteRowIdx = start + i;
|
|
@@ -19489,9 +19267,9 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
19489
19267
|
{ keys: "L", label: "Flat view" },
|
|
19490
19268
|
{ keys: "i", label: "Focus lineage" }
|
|
19491
19269
|
];
|
|
19492
|
-
if (includeBreaking) entries.push({ keys: "w", label: "
|
|
19270
|
+
if (includeBreaking) entries.push({ keys: "w", label: "Show only components with breaking changes" });
|
|
19493
19271
|
entries.push(
|
|
19494
|
-
{ keys: "o", label: "
|
|
19272
|
+
{ keys: "o", label: "Show only components in slot cycles" },
|
|
19495
19273
|
{ keys: "space", label: "Expand/collapse group" },
|
|
19496
19274
|
{ keys: "E / C", label: "Expand/collapse all" }
|
|
19497
19275
|
);
|
|
@@ -20058,6 +19836,17 @@ function computeFilterKeys(input) {
|
|
|
20058
19836
|
if (active.has("deleted")) for (const k of input.data.deleted ?? []) out.add(k);
|
|
20059
19837
|
return out;
|
|
20060
19838
|
}
|
|
19839
|
+
var FILTER_LABELS = {
|
|
19840
|
+
broken: "components with breaking changes",
|
|
19841
|
+
cycles: "slot cycles",
|
|
19842
|
+
deleted: "removed components"
|
|
19843
|
+
};
|
|
19844
|
+
function describeEmptyFilter(input) {
|
|
19845
|
+
const names = [...input.filters].map((f) => FILTER_LABELS[f]);
|
|
19846
|
+
if (input.slotDependencies) names.push("slot dependencies");
|
|
19847
|
+
if (names.length === 0) return void 0;
|
|
19848
|
+
return `Nothing to show: no ${names.join(" or ")} in this import.`;
|
|
19849
|
+
}
|
|
20061
19850
|
function intersectFilterKeys(a, b) {
|
|
20062
19851
|
if (a === void 0) return b;
|
|
20063
19852
|
if (b === void 0) return a;
|
|
@@ -20078,62 +19867,62 @@ function buildFlatDimPredicate(input) {
|
|
|
20078
19867
|
}
|
|
20079
19868
|
|
|
20080
19869
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
20081
|
-
function apply(
|
|
20082
|
-
const next = new Map(
|
|
19870
|
+
function apply(state, entries) {
|
|
19871
|
+
const next = new Map(state);
|
|
20083
19872
|
for (const [name, decision] of entries) next.set(name, decision);
|
|
20084
19873
|
return next;
|
|
20085
19874
|
}
|
|
20086
|
-
function reduceDecisions(
|
|
19875
|
+
function reduceDecisions(state, action, components, graph) {
|
|
20087
19876
|
switch (action.type) {
|
|
20088
19877
|
case "accept": {
|
|
20089
|
-
if (
|
|
19878
|
+
if (state.get(action.name) === "accepted") return state;
|
|
20090
19879
|
return apply(
|
|
20091
|
-
|
|
19880
|
+
state,
|
|
20092
19881
|
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
20093
19882
|
);
|
|
20094
19883
|
}
|
|
20095
19884
|
case "reject": {
|
|
20096
|
-
if (
|
|
19885
|
+
if (state.get(action.name) === "rejected") return state;
|
|
20097
19886
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
20098
|
-
return apply(
|
|
19887
|
+
return apply(state, [
|
|
20099
19888
|
...toReject.map((name) => [name, "rejected"]),
|
|
20100
19889
|
...toDeselect.map((name) => [name, "undecided"])
|
|
20101
19890
|
]);
|
|
20102
19891
|
}
|
|
20103
19892
|
case "toggle-all": {
|
|
20104
19893
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
20105
|
-
const anyNotAccepted = nonCycle.some((name) =>
|
|
19894
|
+
const anyNotAccepted = nonCycle.some((name) => state.get(name) !== "accepted");
|
|
20106
19895
|
if (anyNotAccepted) {
|
|
20107
|
-
return apply(
|
|
19896
|
+
return apply(state, [
|
|
20108
19897
|
...nonCycle.map((name) => [name, "accepted"]),
|
|
20109
19898
|
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
20110
19899
|
]);
|
|
20111
19900
|
}
|
|
20112
|
-
return apply(
|
|
19901
|
+
return apply(state, [
|
|
20113
19902
|
...nonCycle.map((name) => [name, "rejected"]),
|
|
20114
|
-
...components.filter((c2) => graph.cycleParticipants.has(c2.name) &&
|
|
19903
|
+
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
20115
19904
|
]);
|
|
20116
19905
|
}
|
|
20117
19906
|
case "accept-unflagged": {
|
|
20118
19907
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
20119
|
-
return apply(
|
|
19908
|
+
return apply(state, [
|
|
20120
19909
|
...seeds.map((name) => [name, "accepted"]),
|
|
20121
19910
|
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
20122
19911
|
]);
|
|
20123
19912
|
}
|
|
20124
19913
|
}
|
|
20125
19914
|
}
|
|
20126
|
-
function rejectNeedsConfirmation(graph, name,
|
|
20127
|
-
if (
|
|
19915
|
+
function rejectNeedsConfirmation(graph, name, state) {
|
|
19916
|
+
if (state.get(name) === "rejected") return false;
|
|
20128
19917
|
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
20129
19918
|
const ancestors = toReject.filter((n) => n !== name);
|
|
20130
19919
|
return ancestors.length + toDeselect.length >= 2;
|
|
20131
19920
|
}
|
|
20132
|
-
function partitionDecisions(components,
|
|
19921
|
+
function partitionDecisions(components, state) {
|
|
20133
19922
|
const accepted = [];
|
|
20134
19923
|
const rejected = [];
|
|
20135
19924
|
for (const c2 of components) {
|
|
20136
|
-
if (
|
|
19925
|
+
if (state.get(c2.name) === "accepted") accepted.push(c2.name);
|
|
20137
19926
|
else rejected.push(c2.name);
|
|
20138
19927
|
}
|
|
20139
19928
|
return { accepted, rejected };
|
|
@@ -20253,6 +20042,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
|
|
|
20253
20042
|
}),
|
|
20254
20043
|
[groupedItems, cycleParticipants, expandedGroups, columnOneView, graph, filterVisibleKeys]
|
|
20255
20044
|
);
|
|
20045
|
+
const emptyMessage = visibleRows.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters, slotDependencies: showDependencies }) : void 0;
|
|
20256
20046
|
const total = visibleRows.length;
|
|
20257
20047
|
const safeCursor = Math.min(nav.cursor, Math.max(0, total - 1));
|
|
20258
20048
|
const currentRow = visibleRows[safeCursor];
|
|
@@ -20574,6 +20364,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
|
|
|
20574
20364
|
expandedGroups,
|
|
20575
20365
|
toggleExpanded,
|
|
20576
20366
|
visibleRows,
|
|
20367
|
+
emptyMessage,
|
|
20577
20368
|
safeCursor,
|
|
20578
20369
|
scrollOffset: nav.scrollOffset,
|
|
20579
20370
|
selectionStateByKey,
|
|
@@ -20627,7 +20418,7 @@ var HELP_SECTIONS = [
|
|
|
20627
20418
|
title: "Panels",
|
|
20628
20419
|
entries: [
|
|
20629
20420
|
{ keys: "c", label: "Cycle list" },
|
|
20630
|
-
{ keys: "d", label: "Show slot
|
|
20421
|
+
{ keys: "d", label: "Show slot dependenciess" },
|
|
20631
20422
|
{ keys: "x", label: "Review flags" }
|
|
20632
20423
|
]
|
|
20633
20424
|
},
|
|
@@ -20696,6 +20487,7 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
|
|
|
20696
20487
|
aiFlaggedByKey: gate.aiFlaggedByKey,
|
|
20697
20488
|
dimPredicate: gate.dimPredicate,
|
|
20698
20489
|
visibleRows: gate.visibleRows,
|
|
20490
|
+
emptyMessage: gate.emptyMessage,
|
|
20699
20491
|
viewMode: gate.columnOneView,
|
|
20700
20492
|
graph: graph.nodes
|
|
20701
20493
|
}
|
|
@@ -21025,7 +20817,7 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
21025
20817
|
|
|
21026
20818
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
21027
20819
|
function useGeneration(input) {
|
|
21028
|
-
const [
|
|
20820
|
+
const [state, setState] = useState14();
|
|
21029
20821
|
const current = useRef6();
|
|
21030
20822
|
useEffect9(() => {
|
|
21031
20823
|
current.current = input;
|
|
@@ -21043,7 +20835,7 @@ function useGeneration(input) {
|
|
|
21043
20835
|
if (current.current === input) current.current = void 0;
|
|
21044
20836
|
};
|
|
21045
20837
|
}, [input]);
|
|
21046
|
-
return
|
|
20838
|
+
return state;
|
|
21047
20839
|
}
|
|
21048
20840
|
|
|
21049
20841
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
@@ -21808,7 +21600,7 @@ function parseToState(json) {
|
|
|
21808
21600
|
});
|
|
21809
21601
|
return { state: { componentDescription, props, slots }, error: null };
|
|
21810
21602
|
}
|
|
21811
|
-
function serializeState(
|
|
21603
|
+
function serializeState(state, originalJson) {
|
|
21812
21604
|
let wrapperKey = null;
|
|
21813
21605
|
try {
|
|
21814
21606
|
const orig = JSON.parse(originalJson);
|
|
@@ -21822,7 +21614,7 @@ function serializeState(state2, originalJson) {
|
|
|
21822
21614
|
} catch {
|
|
21823
21615
|
}
|
|
21824
21616
|
const $properties = {};
|
|
21825
|
-
for (const p of
|
|
21617
|
+
for (const p of state.props) {
|
|
21826
21618
|
const def = {
|
|
21827
21619
|
$type: p.type,
|
|
21828
21620
|
$category: p.category
|
|
@@ -21845,10 +21637,10 @@ function serializeState(state2, originalJson) {
|
|
|
21845
21637
|
$type: "component",
|
|
21846
21638
|
$properties
|
|
21847
21639
|
};
|
|
21848
|
-
if (
|
|
21849
|
-
if (
|
|
21640
|
+
if (state.componentDescription) entry.$description = state.componentDescription;
|
|
21641
|
+
if (state.slots.length > 0) {
|
|
21850
21642
|
entry.$slots = {};
|
|
21851
|
-
for (const s of
|
|
21643
|
+
for (const s of state.slots) {
|
|
21852
21644
|
const slotDef = {};
|
|
21853
21645
|
if (s.description) slotDef.$description = s.description;
|
|
21854
21646
|
if (s.required) slotDef.$required = true;
|
|
@@ -24938,71 +24730,71 @@ function ReviewReloadDialog({ open }) {
|
|
|
24938
24730
|
|
|
24939
24731
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-input.ts
|
|
24940
24732
|
var PANEL_CONTENT_HEIGHT = 12;
|
|
24941
|
-
function handleReviewOverlayInput(input, key,
|
|
24942
|
-
if (
|
|
24943
|
-
if (
|
|
24944
|
-
if (input === "q" || key.escape || key.return)
|
|
24733
|
+
function handleReviewOverlayInput(input, key, state) {
|
|
24734
|
+
if (state.loading) return true;
|
|
24735
|
+
if (state.loadError) {
|
|
24736
|
+
if (input === "q" || key.escape || key.return) state.onQuit();
|
|
24945
24737
|
return true;
|
|
24946
24738
|
}
|
|
24947
|
-
if (
|
|
24739
|
+
if (state.showFinalize) {
|
|
24948
24740
|
if (key.downArrow) {
|
|
24949
|
-
|
|
24741
|
+
state.finalizePreview.scrollBy(1);
|
|
24950
24742
|
return true;
|
|
24951
24743
|
}
|
|
24952
24744
|
if (key.upArrow) {
|
|
24953
|
-
|
|
24745
|
+
state.finalizePreview.scrollBy(-1);
|
|
24954
24746
|
return true;
|
|
24955
24747
|
}
|
|
24956
24748
|
return true;
|
|
24957
24749
|
}
|
|
24958
|
-
if (
|
|
24959
|
-
if (
|
|
24750
|
+
if (state.dialogOpen || state.showHelp) return true;
|
|
24751
|
+
if (state.showReloadDialog) {
|
|
24960
24752
|
if (key.return) {
|
|
24961
|
-
|
|
24962
|
-
|
|
24753
|
+
state.reloadFromSave();
|
|
24754
|
+
state.setShowReloadDialog(false);
|
|
24963
24755
|
return true;
|
|
24964
24756
|
}
|
|
24965
24757
|
if (key.escape) {
|
|
24966
|
-
|
|
24758
|
+
state.setShowReloadDialog(false);
|
|
24967
24759
|
return true;
|
|
24968
24760
|
}
|
|
24969
24761
|
return true;
|
|
24970
24762
|
}
|
|
24971
24763
|
if (key.ctrl && input === "z") {
|
|
24972
|
-
|
|
24764
|
+
state.handleUndo();
|
|
24973
24765
|
return true;
|
|
24974
24766
|
}
|
|
24975
24767
|
if (key.ctrl && input === "y") {
|
|
24976
|
-
|
|
24768
|
+
state.handleRedo();
|
|
24977
24769
|
return true;
|
|
24978
24770
|
}
|
|
24979
24771
|
if (key.ctrl && input === "r") {
|
|
24980
|
-
|
|
24772
|
+
state.setShowReloadDialog(true);
|
|
24981
24773
|
return true;
|
|
24982
24774
|
}
|
|
24983
24775
|
return false;
|
|
24984
24776
|
}
|
|
24985
|
-
function handleTokenReviewInput(input, key,
|
|
24986
|
-
if (
|
|
24987
|
-
const suggestions =
|
|
24988
|
-
const row = suggestions[
|
|
24989
|
-
if (
|
|
24777
|
+
function handleTokenReviewInput(input, key, state) {
|
|
24778
|
+
if (state.panelOpen !== "token-review") return false;
|
|
24779
|
+
const suggestions = state.currentTokenSuggestions();
|
|
24780
|
+
const row = suggestions[state.tokenReviewRow];
|
|
24781
|
+
if (state.tokenReviewEditing) {
|
|
24990
24782
|
if (key.ctrl && input === "s" && row) {
|
|
24991
|
-
|
|
24783
|
+
state.handleTokenEditSave(row);
|
|
24992
24784
|
return true;
|
|
24993
24785
|
}
|
|
24994
24786
|
if (row && row.paths.length > 0) {
|
|
24995
24787
|
if (key.upArrow || input === "k") {
|
|
24996
|
-
|
|
24788
|
+
state.setTokenReviewEditCursor((cursor) => Math.max(0, cursor - 1));
|
|
24997
24789
|
return true;
|
|
24998
24790
|
}
|
|
24999
24791
|
if (key.downArrow || input === "j") {
|
|
25000
|
-
|
|
24792
|
+
state.setTokenReviewEditCursor((cursor) => Math.min(row.paths.length - 1, cursor + 1));
|
|
25001
24793
|
return true;
|
|
25002
24794
|
}
|
|
25003
24795
|
if (input === " " || key.return) {
|
|
25004
|
-
const path5 = row.paths[
|
|
25005
|
-
|
|
24796
|
+
const path5 = row.paths[state.tokenReviewEditCursor];
|
|
24797
|
+
state.setTokenReviewEditSelection((previous) => {
|
|
25006
24798
|
const next = new Set(previous);
|
|
25007
24799
|
if (next.has(path5) && next.size === 1) return next;
|
|
25008
24800
|
if (next.has(path5)) next.delete(path5);
|
|
@@ -25013,34 +24805,34 @@ function handleTokenReviewInput(input, key, state2) {
|
|
|
25013
24805
|
}
|
|
25014
24806
|
}
|
|
25015
24807
|
if (key.escape) {
|
|
25016
|
-
|
|
24808
|
+
state.setTokenReviewEditing(false);
|
|
25017
24809
|
return true;
|
|
25018
24810
|
}
|
|
25019
24811
|
return true;
|
|
25020
24812
|
}
|
|
25021
24813
|
if (key.upArrow || input === "k") {
|
|
25022
|
-
|
|
24814
|
+
state.setTokenReviewRow((rowIndex) => Math.max(0, rowIndex - 1));
|
|
25023
24815
|
return true;
|
|
25024
24816
|
}
|
|
25025
24817
|
if (key.downArrow || input === "j") {
|
|
25026
|
-
|
|
24818
|
+
state.setTokenReviewRow((rowIndex) => Math.min(Math.max(0, suggestions.length - 1), rowIndex + 1));
|
|
25027
24819
|
return true;
|
|
25028
24820
|
}
|
|
25029
24821
|
if (key.return && row) {
|
|
25030
|
-
|
|
25031
|
-
|
|
25032
|
-
|
|
24822
|
+
state.setTokenReviewEditCursor(0);
|
|
24823
|
+
state.setTokenReviewEditSelection(new Set(row.allowed));
|
|
24824
|
+
state.setTokenReviewEditing(true);
|
|
25033
24825
|
return true;
|
|
25034
24826
|
}
|
|
25035
24827
|
if (key.escape || input === "t") {
|
|
25036
|
-
|
|
24828
|
+
state.setPanelOpen("none");
|
|
25037
24829
|
return true;
|
|
25038
24830
|
}
|
|
25039
24831
|
return true;
|
|
25040
24832
|
}
|
|
25041
|
-
function setReviewPanel(
|
|
25042
|
-
|
|
25043
|
-
|
|
24833
|
+
function setReviewPanel(state, panel) {
|
|
24834
|
+
state.setPanelOpen(panel);
|
|
24835
|
+
state.setPanelScrollOffset(() => 0);
|
|
25044
24836
|
}
|
|
25045
24837
|
function rationalePanelForInput(input, propKey, componentKey) {
|
|
25046
24838
|
if (input === propKey) return "prop-rationale";
|
|
@@ -25048,70 +24840,70 @@ function rationalePanelForInput(input, propKey, componentKey) {
|
|
|
25048
24840
|
if (input === "s") return "source";
|
|
25049
24841
|
return null;
|
|
25050
24842
|
}
|
|
25051
|
-
function handleRationalePanelInput(input, key,
|
|
25052
|
-
if (
|
|
25053
|
-
const next = computeNextScrollOffset(
|
|
24843
|
+
function handleRationalePanelInput(input, key, state) {
|
|
24844
|
+
if (state.panelOpen === "none" || state.panelOpen === "token-review") return false;
|
|
24845
|
+
const next = computeNextScrollOffset(state.panelScrollOffset, input, key, 9999, PANEL_CONTENT_HEIGHT);
|
|
25054
24846
|
if (next !== null) {
|
|
25055
|
-
|
|
24847
|
+
state.setPanelScrollOffset(() => next);
|
|
25056
24848
|
return true;
|
|
25057
24849
|
}
|
|
25058
24850
|
if (key.escape) {
|
|
25059
|
-
setReviewPanel(
|
|
24851
|
+
setReviewPanel(state, "none");
|
|
25060
24852
|
return true;
|
|
25061
24853
|
}
|
|
25062
24854
|
const togglable = !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
25063
24855
|
if (!togglable) return true;
|
|
25064
|
-
const panel = rationalePanelForInput(input,
|
|
25065
|
-
if (panel) setReviewPanel(
|
|
24856
|
+
const panel = rationalePanelForInput(input, state.propKey, state.componentKey);
|
|
24857
|
+
if (panel) setReviewPanel(state, state.panelOpen === panel ? "none" : panel);
|
|
25066
24858
|
return true;
|
|
25067
24859
|
}
|
|
25068
|
-
function handleReviewPanelShortcuts(input, key,
|
|
25069
|
-
if (handleTokenReviewInput(input, key,
|
|
25070
|
-
if (handleRationalePanelInput(input, key,
|
|
25071
|
-
const rationaleKeyOk = !
|
|
24860
|
+
function handleReviewPanelShortcuts(input, key, state) {
|
|
24861
|
+
if (handleTokenReviewInput(input, key, state)) return true;
|
|
24862
|
+
if (handleRationalePanelInput(input, key, state)) return true;
|
|
24863
|
+
const rationaleKeyOk = !state.textEntryActive && !state.showJson && !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
25072
24864
|
if (!rationaleKeyOk) return false;
|
|
25073
|
-
const panel = rationalePanelForInput(input,
|
|
24865
|
+
const panel = rationalePanelForInput(input, state.propKey, state.componentKey);
|
|
25074
24866
|
if (panel) {
|
|
25075
|
-
setReviewPanel(
|
|
24867
|
+
setReviewPanel(state, panel);
|
|
25076
24868
|
return true;
|
|
25077
24869
|
}
|
|
25078
|
-
if (input === "t" &&
|
|
25079
|
-
|
|
25080
|
-
|
|
24870
|
+
if (input === "t" && state.currentTokenSuggestions().length > 0) {
|
|
24871
|
+
state.setPanelOpen("token-review");
|
|
24872
|
+
state.setTokenReviewRow(0);
|
|
25081
24873
|
return true;
|
|
25082
24874
|
}
|
|
25083
24875
|
return false;
|
|
25084
24876
|
}
|
|
25085
|
-
function handleReviewViewToggleInput(input,
|
|
24877
|
+
function handleReviewViewToggleInput(input, state) {
|
|
25086
24878
|
if (input === "J") {
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
24879
|
+
state.setShowJson((previous) => !previous);
|
|
24880
|
+
state.setJsonScrollOffset(0);
|
|
24881
|
+
state.pendingGRef.current = false;
|
|
25090
24882
|
return true;
|
|
25091
24883
|
}
|
|
25092
24884
|
return false;
|
|
25093
24885
|
}
|
|
25094
|
-
function handleJsonPanelInput(input, key,
|
|
25095
|
-
if (
|
|
25096
|
-
const totalLines =
|
|
25097
|
-
const maxOffset = Math.max(0, totalLines -
|
|
24886
|
+
function handleJsonPanelInput(input, key, state) {
|
|
24887
|
+
if (state.sidebarFocused || !state.showJson) return false;
|
|
24888
|
+
const totalLines = state.jsonValue.split("\n").length;
|
|
24889
|
+
const maxOffset = Math.max(0, totalLines - state.height);
|
|
25098
24890
|
if (input === "g" && !key.ctrl) {
|
|
25099
|
-
if (
|
|
25100
|
-
|
|
25101
|
-
|
|
24891
|
+
if (state.pendingGRef.current) {
|
|
24892
|
+
state.pendingGRef.current = false;
|
|
24893
|
+
state.setJsonScrollOffset(() => 0);
|
|
25102
24894
|
return true;
|
|
25103
24895
|
}
|
|
25104
|
-
|
|
24896
|
+
state.pendingGRef.current = true;
|
|
25105
24897
|
return true;
|
|
25106
24898
|
}
|
|
25107
|
-
const next = computeNextScrollOffset(
|
|
24899
|
+
const next = computeNextScrollOffset(state.jsonScrollOffset, input, key, totalLines, state.height);
|
|
25108
24900
|
if (next !== null) {
|
|
25109
|
-
|
|
24901
|
+
state.pendingGRef.current = false;
|
|
25110
24902
|
const clamped = Math.min(maxOffset, Math.max(0, next));
|
|
25111
|
-
|
|
24903
|
+
state.setJsonScrollOffset(() => clamped);
|
|
25112
24904
|
return true;
|
|
25113
24905
|
}
|
|
25114
|
-
|
|
24906
|
+
state.pendingGRef.current = false;
|
|
25115
24907
|
return true;
|
|
25116
24908
|
}
|
|
25117
24909
|
|
|
@@ -25455,12 +25247,12 @@ var HELP_SECTIONS2 = [
|
|
|
25455
25247
|
title: "Panels",
|
|
25456
25248
|
entries: [
|
|
25457
25249
|
{ keys: "c", label: "Cycle list" },
|
|
25458
|
-
{ keys: "b", label: "
|
|
25459
|
-
{ keys: "w", label: "
|
|
25460
|
-
{ keys: "o", label: "
|
|
25250
|
+
{ keys: "b", label: "Show breaking changes" },
|
|
25251
|
+
{ keys: "w", label: "Filter components with breaking changes" },
|
|
25252
|
+
{ keys: "o", label: "Filter components in slot cycles" },
|
|
25461
25253
|
{ keys: "p", label: "Prop rationale" },
|
|
25462
25254
|
{ keys: "P", label: "Component rationale" },
|
|
25463
|
-
{ keys: "s", label: "Source" },
|
|
25255
|
+
{ keys: "s", label: "Source code snippet" },
|
|
25464
25256
|
{ keys: "J", label: "Toggle JSON" },
|
|
25465
25257
|
{ keys: "t", label: "Token review" }
|
|
25466
25258
|
]
|
|
@@ -26179,18 +25971,18 @@ function GenerateReviewStepView({
|
|
|
26179
25971
|
}
|
|
26180
25972
|
return;
|
|
26181
25973
|
}
|
|
26182
|
-
if (input === "c" && !key.ctrl && !key.meta && cycleRows.length > 0) {
|
|
25974
|
+
if (input === "c" && !reviewEditor.textEntryActive && !key.ctrl && !key.meta && cycleRows.length > 0) {
|
|
26183
25975
|
cyclePanel.open();
|
|
26184
25976
|
setCyclePanelScroll(0);
|
|
26185
25977
|
setCyclesCursor(0);
|
|
26186
25978
|
return;
|
|
26187
25979
|
}
|
|
26188
|
-
if (input === "b" && sidebarFocused && breakingChanges.length > 0) {
|
|
25980
|
+
if (input === "b" && !reviewEditor.textEntryActive && sidebarFocused && breakingChanges.length > 0) {
|
|
26189
25981
|
breakingPanel.open();
|
|
26190
25982
|
setBreakingCursor(0);
|
|
26191
25983
|
return;
|
|
26192
25984
|
}
|
|
26193
|
-
if (input === "o" || input === "w") {
|
|
25985
|
+
if (!reviewEditor.textEntryActive && (input === "o" || input === "w")) {
|
|
26194
25986
|
const category = input === "o" ? "cycles" : "broken";
|
|
26195
25987
|
setActiveFilters((prev) => {
|
|
26196
25988
|
const next = new Set(prev);
|
|
@@ -26576,6 +26368,7 @@ function GenerateReviewStepView({
|
|
|
26576
26368
|
visibleCount,
|
|
26577
26369
|
dimPredicate,
|
|
26578
26370
|
visibleRows: visibleRowsMemo,
|
|
26371
|
+
emptyMessage: visibleRowsMemo.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters }) : void 0,
|
|
26579
26372
|
viewMode: columnOneView,
|
|
26580
26373
|
graph: sidebarGraph
|
|
26581
26374
|
}
|
|
@@ -27460,38 +27253,38 @@ function buildRunTeaserLine(runId) {
|
|
|
27460
27253
|
|
|
27461
27254
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
27462
27255
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
27463
|
-
function totalStepsFor(
|
|
27464
|
-
const hasTokenStage = !!
|
|
27465
|
-
return 3 + (hasTokenStage ? 1 : 0) + 2 + (
|
|
27256
|
+
function totalStepsFor(state) {
|
|
27257
|
+
const hasTokenStage = !!state.tokensPath || !!state.rawTokensPath;
|
|
27258
|
+
return 3 + (hasTokenStage ? 1 : 0) + 2 + (state.mapTokensEligible === true ? 1 : 0);
|
|
27466
27259
|
}
|
|
27467
27260
|
function canEditFromPreview(cdf) {
|
|
27468
27261
|
if (!cdf) return false;
|
|
27469
27262
|
return parseCDFComponents(cdf).components.length > 0;
|
|
27470
27263
|
}
|
|
27471
27264
|
function FlowScreen({
|
|
27472
|
-
state
|
|
27265
|
+
state,
|
|
27473
27266
|
controller,
|
|
27474
27267
|
livePreview = true,
|
|
27475
27268
|
generatePromptPath,
|
|
27476
27269
|
onExit
|
|
27477
27270
|
}) {
|
|
27478
|
-
const totalSteps = totalStepsFor(
|
|
27271
|
+
const totalSteps = totalStepsFor(state);
|
|
27479
27272
|
const quit = () => onExit(0);
|
|
27480
27273
|
const content = (() => {
|
|
27481
|
-
switch (
|
|
27274
|
+
switch (state.step) {
|
|
27482
27275
|
case "final-review":
|
|
27483
27276
|
return /* @__PURE__ */ jsx52(
|
|
27484
27277
|
GenerateReviewStep,
|
|
27485
27278
|
{
|
|
27486
|
-
extractSessionId:
|
|
27487
|
-
tokenSessionId:
|
|
27279
|
+
extractSessionId: state.extractSessionId,
|
|
27280
|
+
tokenSessionId: state.tokenSessionId,
|
|
27488
27281
|
livePreview,
|
|
27489
|
-
spaceId:
|
|
27490
|
-
environmentId:
|
|
27491
|
-
cmaToken:
|
|
27492
|
-
host:
|
|
27493
|
-
tokensPath:
|
|
27494
|
-
initialFinalizeError:
|
|
27282
|
+
spaceId: state.spaceId,
|
|
27283
|
+
environmentId: state.environmentId,
|
|
27284
|
+
cmaToken: state.cmaToken,
|
|
27285
|
+
host: state.host,
|
|
27286
|
+
tokensPath: state.tokensPath,
|
|
27287
|
+
initialFinalizeError: state.finalizeErrorBanner,
|
|
27495
27288
|
onFinalize: controller.finalize,
|
|
27496
27289
|
onQuit: quit
|
|
27497
27290
|
}
|
|
@@ -27507,27 +27300,27 @@ function FlowScreen({
|
|
|
27507
27300
|
}
|
|
27508
27301
|
);
|
|
27509
27302
|
case "preview-gate":
|
|
27510
|
-
if (!
|
|
27303
|
+
if (!state.serverPreview) return null;
|
|
27511
27304
|
return /* @__PURE__ */ jsx52(
|
|
27512
27305
|
WizardPreviewStep,
|
|
27513
27306
|
{
|
|
27514
|
-
preview:
|
|
27515
|
-
spaceId:
|
|
27516
|
-
environmentId:
|
|
27307
|
+
preview: state.serverPreview,
|
|
27308
|
+
spaceId: state.spaceId,
|
|
27309
|
+
environmentId: state.environmentId,
|
|
27517
27310
|
stepNumber: totalSteps,
|
|
27518
27311
|
totalSteps,
|
|
27519
27312
|
onConfirm: controller.confirmPreview,
|
|
27520
|
-
...canEditFromPreview(
|
|
27313
|
+
...canEditFromPreview(state.cdf) ? { onEdit: controller.editDefinitions } : {},
|
|
27521
27314
|
onQuit: quit
|
|
27522
27315
|
}
|
|
27523
27316
|
);
|
|
27524
27317
|
case "pushing":
|
|
27525
|
-
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress:
|
|
27318
|
+
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress: state.pushProgress });
|
|
27526
27319
|
case "path-prompt":
|
|
27527
27320
|
return /* @__PURE__ */ jsx52(
|
|
27528
27321
|
PathPrompt,
|
|
27529
27322
|
{
|
|
27530
|
-
defaultPath:
|
|
27323
|
+
defaultPath: state.outDir,
|
|
27531
27324
|
onSubmit: (submitted) => void controller.submitPath(submitted),
|
|
27532
27325
|
onCancel: quit
|
|
27533
27326
|
}
|
|
@@ -27543,12 +27336,12 @@ function FlowScreen({
|
|
|
27543
27336
|
}
|
|
27544
27337
|
);
|
|
27545
27338
|
case "print-gate": {
|
|
27546
|
-
const teaser = buildRunTeaserLine(
|
|
27339
|
+
const teaser = buildRunTeaserLine(state.lastRunId);
|
|
27547
27340
|
return /* @__PURE__ */ jsx52(
|
|
27548
27341
|
GateStep,
|
|
27549
27342
|
{
|
|
27550
27343
|
message: "Files saved",
|
|
27551
|
-
summary:
|
|
27344
|
+
summary: state.componentsPath ? `components.json \u2192 ${state.componentsPath}` : void 0,
|
|
27552
27345
|
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.",
|
|
27553
27346
|
continueLabel: "Exit",
|
|
27554
27347
|
onContinue: quit,
|
|
@@ -27557,17 +27350,17 @@ function FlowScreen({
|
|
|
27557
27350
|
);
|
|
27558
27351
|
}
|
|
27559
27352
|
case "done": {
|
|
27560
|
-
const totalFailed =
|
|
27353
|
+
const totalFailed = state.pushResult.componentTypes.failed + state.pushResult.designTokens.failed;
|
|
27561
27354
|
return /* @__PURE__ */ jsx52(
|
|
27562
27355
|
DoneStep,
|
|
27563
27356
|
{
|
|
27564
|
-
componentTypes:
|
|
27565
|
-
designTokens:
|
|
27566
|
-
summary:
|
|
27567
|
-
failures:
|
|
27568
|
-
spaceId:
|
|
27569
|
-
environmentId:
|
|
27570
|
-
host:
|
|
27357
|
+
componentTypes: state.pushResult.componentTypes,
|
|
27358
|
+
designTokens: state.pushResult.designTokens,
|
|
27359
|
+
summary: state.pushResult.summary,
|
|
27360
|
+
failures: state.pushResult.failures,
|
|
27361
|
+
spaceId: state.spaceId,
|
|
27362
|
+
environmentId: state.environmentId,
|
|
27363
|
+
host: state.host,
|
|
27571
27364
|
onExit: () => onExit(totalFailed > 0 ? 1 : 0)
|
|
27572
27365
|
}
|
|
27573
27366
|
);
|
|
@@ -27576,8 +27369,8 @@ function FlowScreen({
|
|
|
27576
27369
|
return /* @__PURE__ */ jsx52(
|
|
27577
27370
|
PreviewValidationErrorScreen,
|
|
27578
27371
|
{
|
|
27579
|
-
errors:
|
|
27580
|
-
missingNames:
|
|
27372
|
+
errors: state.previewValidationErrors,
|
|
27373
|
+
missingNames: state.previewValidationMissingNames,
|
|
27581
27374
|
onEdit: controller.editDefinitions,
|
|
27582
27375
|
onSkip: () => void controller.skipValidationErrors(),
|
|
27583
27376
|
onQuit: quit
|
|
@@ -27587,10 +27380,10 @@ function FlowScreen({
|
|
|
27587
27380
|
return /* @__PURE__ */ jsx52(
|
|
27588
27381
|
ErrorStep,
|
|
27589
27382
|
{
|
|
27590
|
-
stepName:
|
|
27591
|
-
message:
|
|
27383
|
+
stepName: state.errorStep,
|
|
27384
|
+
message: state.errorMessage,
|
|
27592
27385
|
onExit: () => onExit(1),
|
|
27593
|
-
onAcknowledgeBreakingChanges:
|
|
27386
|
+
onAcknowledgeBreakingChanges: state.errorAllowBreakingChangeAcknowledgment && state.cdf ? controller.acknowledgeBreakingChanges : void 0
|
|
27594
27387
|
}
|
|
27595
27388
|
);
|
|
27596
27389
|
}
|
|
@@ -27611,8 +27404,8 @@ import { tmpdir } from "node:os";
|
|
|
27611
27404
|
import { join as join23, resolve as resolve25 } from "node:path";
|
|
27612
27405
|
|
|
27613
27406
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
27614
|
-
function shouldBypassPreview(
|
|
27615
|
-
return
|
|
27407
|
+
function shouldBypassPreview(state) {
|
|
27408
|
+
return state.credentialsSkipped === true;
|
|
27616
27409
|
}
|
|
27617
27410
|
function buildSkippedPreviewTransition() {
|
|
27618
27411
|
return { step: "done", serverPreview: null };
|
|
@@ -27621,8 +27414,8 @@ function resolveCycleGateAction(opts) {
|
|
|
27621
27414
|
if (!opts.hasCycles) return "proceed";
|
|
27622
27415
|
return "block";
|
|
27623
27416
|
}
|
|
27624
|
-
function shouldRefusePush(
|
|
27625
|
-
return
|
|
27417
|
+
function shouldRefusePush(state) {
|
|
27418
|
+
return state.credentialsSkipped === true;
|
|
27626
27419
|
}
|
|
27627
27420
|
function buildSkippedPushTransition() {
|
|
27628
27421
|
return { step: "print-gate" };
|
|
@@ -28017,17 +27810,17 @@ async function runPrintFiles(input, deps, onPatch) {
|
|
|
28017
27810
|
return { ok: true, patch: nextStateAfterPrint({ skipGate: input.skipGate, componentsPath }) };
|
|
28018
27811
|
}
|
|
28019
27812
|
async function recordRun(input, deps) {
|
|
28020
|
-
const { state
|
|
27813
|
+
const { state } = input;
|
|
28021
27814
|
try {
|
|
28022
27815
|
let sourceFingerprint = null;
|
|
28023
27816
|
try {
|
|
28024
|
-
if (
|
|
27817
|
+
if (state.extractSessionId) {
|
|
28025
27818
|
const db = deps.openDb();
|
|
28026
27819
|
try {
|
|
28027
27820
|
sourceFingerprint = await deps.buildSourceFingerprint({
|
|
28028
27821
|
db,
|
|
28029
|
-
extractSessionId:
|
|
28030
|
-
rawTokensPath:
|
|
27822
|
+
extractSessionId: state.extractSessionId,
|
|
27823
|
+
rawTokensPath: state.rawTokensPath || null
|
|
28031
27824
|
});
|
|
28032
27825
|
} finally {
|
|
28033
27826
|
db.close();
|
|
@@ -28038,16 +27831,16 @@ async function recordRun(input, deps) {
|
|
|
28038
27831
|
`);
|
|
28039
27832
|
}
|
|
28040
27833
|
const record3 = await deps.appendRun({
|
|
28041
|
-
projectPath:
|
|
27834
|
+
projectPath: state.projectPath,
|
|
28042
27835
|
savePath: input.savePath,
|
|
28043
|
-
componentCount:
|
|
28044
|
-
tokenCount:
|
|
28045
|
-
tokensPath: (
|
|
28046
|
-
tokenSessionId:
|
|
28047
|
-
agent:
|
|
27836
|
+
componentCount: state.generatedAcceptedCount || state.generatedCount,
|
|
27837
|
+
tokenCount: state.tokenCount,
|
|
27838
|
+
tokensPath: (state.tokenSessionId ? state.tokensPath || null : null) || null,
|
|
27839
|
+
tokenSessionId: state.tokenSessionId,
|
|
27840
|
+
agent: state.agent,
|
|
28048
27841
|
pushedTo: null,
|
|
28049
|
-
extractSessionId:
|
|
28050
|
-
generateSessionId:
|
|
27842
|
+
extractSessionId: state.extractSessionId ?? "",
|
|
27843
|
+
generateSessionId: state.generateSessionId,
|
|
28051
27844
|
sourceFingerprint
|
|
28052
27845
|
});
|
|
28053
27846
|
return record3.id;
|
|
@@ -28183,7 +27976,7 @@ function namesToSkip(errors) {
|
|
|
28183
27976
|
return [...new Set(errors.map((e) => e.componentName))];
|
|
28184
27977
|
}
|
|
28185
27978
|
function createFlowController(start, deps) {
|
|
28186
|
-
let
|
|
27979
|
+
let state = initialFlowState(start);
|
|
28187
27980
|
const listeners = /* @__PURE__ */ new Set();
|
|
28188
27981
|
let allowEmptyDeleteAll = false;
|
|
28189
27982
|
let pendingSave = {};
|
|
@@ -28192,27 +27985,27 @@ function createFlowController(start, deps) {
|
|
|
28192
27985
|
deps.log({ update: sanitizeForLog(patch) });
|
|
28193
27986
|
} catch {
|
|
28194
27987
|
}
|
|
28195
|
-
if (patch.step !== void 0 && patch.step !==
|
|
27988
|
+
if (patch.step !== void 0 && patch.step !== state.step) {
|
|
28196
27989
|
try {
|
|
28197
27990
|
deps.beforeStepChange?.();
|
|
28198
27991
|
} catch {
|
|
28199
27992
|
}
|
|
28200
27993
|
}
|
|
28201
|
-
|
|
27994
|
+
state = { ...state, ...patch };
|
|
28202
27995
|
for (const listener of listeners) listener();
|
|
28203
27996
|
};
|
|
28204
27997
|
const preview = async () => {
|
|
28205
|
-
if (!
|
|
27998
|
+
if (!state.credentialsSkipped) update({ step: "previewing" });
|
|
28206
27999
|
update(
|
|
28207
28000
|
await runPreview(
|
|
28208
28001
|
{
|
|
28209
|
-
state
|
|
28210
|
-
extractSessionId:
|
|
28211
|
-
tokensPath:
|
|
28212
|
-
spaceId:
|
|
28213
|
-
environmentId:
|
|
28214
|
-
cmaToken:
|
|
28215
|
-
host:
|
|
28002
|
+
state,
|
|
28003
|
+
extractSessionId: state.extractSessionId,
|
|
28004
|
+
tokensPath: state.tokensPath,
|
|
28005
|
+
spaceId: state.spaceId,
|
|
28006
|
+
environmentId: state.environmentId,
|
|
28007
|
+
cmaToken: state.cmaToken,
|
|
28008
|
+
host: state.host,
|
|
28216
28009
|
deleteAll: allowEmptyDeleteAll
|
|
28217
28010
|
},
|
|
28218
28011
|
deps.preview
|
|
@@ -28220,18 +28013,18 @@ function createFlowController(start, deps) {
|
|
|
28220
28013
|
);
|
|
28221
28014
|
};
|
|
28222
28015
|
const push = async (acknowledgeBreakingChanges) => {
|
|
28223
|
-
if (!
|
|
28016
|
+
if (!state.cdf) return;
|
|
28224
28017
|
update(
|
|
28225
28018
|
await runPush(
|
|
28226
28019
|
{
|
|
28227
|
-
state
|
|
28228
|
-
cdf:
|
|
28229
|
-
spaceId:
|
|
28230
|
-
environmentId:
|
|
28231
|
-
cmaToken:
|
|
28232
|
-
host:
|
|
28020
|
+
state,
|
|
28021
|
+
cdf: state.cdf,
|
|
28022
|
+
spaceId: state.spaceId,
|
|
28023
|
+
environmentId: state.environmentId,
|
|
28024
|
+
cmaToken: state.cmaToken,
|
|
28025
|
+
host: state.host,
|
|
28233
28026
|
acknowledgeBreakingChanges,
|
|
28234
|
-
preview:
|
|
28027
|
+
preview: state.serverPreview
|
|
28235
28028
|
},
|
|
28236
28029
|
deps.push,
|
|
28237
28030
|
update
|
|
@@ -28247,11 +28040,11 @@ function createFlowController(start, deps) {
|
|
|
28247
28040
|
const { skipGate, andPush } = pendingSave;
|
|
28248
28041
|
const written = await runPrintFiles(
|
|
28249
28042
|
{
|
|
28250
|
-
extractSessionId:
|
|
28043
|
+
extractSessionId: state.extractSessionId,
|
|
28251
28044
|
outDir: path5,
|
|
28252
28045
|
...skipGate ? { skipGate: true } : {},
|
|
28253
|
-
...
|
|
28254
|
-
...
|
|
28046
|
+
...state.tokenSessionId ? { tokenSessionId: state.tokenSessionId } : {},
|
|
28047
|
+
...state.tokensPath ? { tokensPath: state.tokensPath } : {},
|
|
28255
28048
|
...allowEmptyDeleteAll ? { allowEmpty: true } : {}
|
|
28256
28049
|
},
|
|
28257
28050
|
deps.save,
|
|
@@ -28259,21 +28052,21 @@ function createFlowController(start, deps) {
|
|
|
28259
28052
|
);
|
|
28260
28053
|
update(written.patch);
|
|
28261
28054
|
if (!written.ok) return;
|
|
28262
|
-
const runId = await recordRun({ state
|
|
28055
|
+
const runId = await recordRun({ state, savePath: path5 }, deps.save);
|
|
28263
28056
|
if (runId) update({ lastRunId: runId });
|
|
28264
28057
|
if (andPush) await preview();
|
|
28265
28058
|
};
|
|
28266
28059
|
const detectAcceptedCycles = () => {
|
|
28267
|
-
if (!
|
|
28060
|
+
if (!state.extractSessionId) return [];
|
|
28268
28061
|
try {
|
|
28269
|
-
const accepted = deps.loadAcceptedComponents(
|
|
28062
|
+
const accepted = deps.loadAcceptedComponents(state.extractSessionId);
|
|
28270
28063
|
return findSlotCycles3(buildComponentGraph3(accepted));
|
|
28271
28064
|
} catch {
|
|
28272
28065
|
return [];
|
|
28273
28066
|
}
|
|
28274
28067
|
};
|
|
28275
28068
|
const begin = () => {
|
|
28276
|
-
if (!
|
|
28069
|
+
if (!state.extractSessionId || !start.handoff.generation) {
|
|
28277
28070
|
update({
|
|
28278
28071
|
step: "error",
|
|
28279
28072
|
errorStep: "start import",
|
|
@@ -28290,7 +28083,7 @@ function createFlowController(start, deps) {
|
|
|
28290
28083
|
};
|
|
28291
28084
|
begin();
|
|
28292
28085
|
return {
|
|
28293
|
-
getState: () =>
|
|
28086
|
+
getState: () => state,
|
|
28294
28087
|
subscribe: (listener) => {
|
|
28295
28088
|
listeners.add(listener);
|
|
28296
28089
|
return () => listeners.delete(listener);
|
|
@@ -28313,7 +28106,7 @@ function createFlowController(start, deps) {
|
|
|
28313
28106
|
},
|
|
28314
28107
|
async submitPath(submitted) {
|
|
28315
28108
|
await deps.mkdir(submitted);
|
|
28316
|
-
if (resolve25(submitted) !== resolve25(
|
|
28109
|
+
if (resolve25(submitted) !== resolve25(state.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
28317
28110
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
28318
28111
|
await deps.mkdir(subdir);
|
|
28319
28112
|
await proceedToWrite(subdir);
|
|
@@ -28325,9 +28118,9 @@ function createFlowController(start, deps) {
|
|
|
28325
28118
|
acknowledgeBreakingChanges: () => void push(true),
|
|
28326
28119
|
editDefinitions: () => update({ step: "final-review" }),
|
|
28327
28120
|
async skipValidationErrors() {
|
|
28328
|
-
if (
|
|
28329
|
-
const names = namesToSkip(
|
|
28330
|
-
if (names.length > 0) await deps.rejectComponentsByName(
|
|
28121
|
+
if (state.extractSessionId) {
|
|
28122
|
+
const names = namesToSkip(state.previewValidationErrors);
|
|
28123
|
+
if (names.length > 0) await deps.rejectComponentsByName(state.extractSessionId, names);
|
|
28331
28124
|
}
|
|
28332
28125
|
await preview();
|
|
28333
28126
|
}
|
|
@@ -28349,14 +28142,14 @@ function useFlow(start, options = {}) {
|
|
|
28349
28142
|
});
|
|
28350
28143
|
}
|
|
28351
28144
|
const current = controller.current;
|
|
28352
|
-
const
|
|
28145
|
+
const state = useSyncExternalStore(
|
|
28353
28146
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
28354
28147
|
() => current?.getState()
|
|
28355
28148
|
);
|
|
28356
28149
|
useEffect20(() => {
|
|
28357
28150
|
if (!start) controller.current = void 0;
|
|
28358
28151
|
}, [start]);
|
|
28359
|
-
return current &&
|
|
28152
|
+
return current && state ? { controller: current, state } : void 0;
|
|
28360
28153
|
}
|
|
28361
28154
|
|
|
28362
28155
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
@@ -28964,16 +28757,16 @@ function App({ importOptions, inkClear }) {
|
|
|
28964
28757
|
const finishCredentials = async (result, projectPath2, tokens, filePaths) => {
|
|
28965
28758
|
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
28966
28759
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
28967
|
-
const
|
|
28760
|
+
const state = await inspectTokens({
|
|
28968
28761
|
rawTokensPath: tokens,
|
|
28969
28762
|
contentfulDir: join25(resolveUserPath(projectPath2), ".contentful"),
|
|
28970
28763
|
cache: importOptions.cache
|
|
28971
28764
|
});
|
|
28972
|
-
if (
|
|
28765
|
+
if (state.kind === "cached") {
|
|
28973
28766
|
setPendingLaunch({
|
|
28974
28767
|
launch,
|
|
28975
28768
|
credentials: result,
|
|
28976
|
-
cached: { tokensPath:
|
|
28769
|
+
cached: { tokensPath: state.tokensPath, sourceChanged: state.sourceChanged }
|
|
28977
28770
|
});
|
|
28978
28771
|
return;
|
|
28979
28772
|
}
|