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