@contentful/experience-design-system-cli 2.40.1-dev-build-35756f2e.0 → 2.40.1-dev-build-58bdf9b8.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 +263 -141
- package/dist/index.js +272 -148
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/02-token-input/screen.d.ts +4 -1
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +23 -1
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +4 -1
- package/dist/src/tui/settings/configuration/agents/agent-debug.d.ts +1 -1
- package/package.json +3 -3
- /package/dist/src/tui/{settings/shared → shared}/debug-trail.d.ts +0 -0
package/dist/app.js
CHANGED
|
@@ -2484,7 +2484,7 @@ var init_cache_keys = __esm({
|
|
|
2484
2484
|
});
|
|
2485
2485
|
|
|
2486
2486
|
// packages/experience-design-system-cli/app.tsx
|
|
2487
|
-
import { useEffect as
|
|
2487
|
+
import { useEffect as useEffect32, useState as useState39 } from "react";
|
|
2488
2488
|
|
|
2489
2489
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2490
2490
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -3275,8 +3275,9 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3275
3275
|
}
|
|
3276
3276
|
|
|
3277
3277
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3278
|
-
import { useState as useState6 } from "react";
|
|
3278
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
3279
3279
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3280
|
+
init_debug_store();
|
|
3280
3281
|
|
|
3281
3282
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
3282
3283
|
import { useInput as useInput8 } from "ink";
|
|
@@ -3343,23 +3344,68 @@ function validateTokenPath(rawPath) {
|
|
|
3343
3344
|
|
|
3344
3345
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3345
3346
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3346
|
-
|
|
3347
|
+
var MAX_LOGGED_ATTEMPTS = 10;
|
|
3348
|
+
function TokenInputScreen({
|
|
3349
|
+
mode,
|
|
3350
|
+
onConfirm,
|
|
3351
|
+
onBack,
|
|
3352
|
+
initialPath = ""
|
|
3353
|
+
}) {
|
|
3347
3354
|
const [tokenPath, setTokenPath] = useState6(initialPath);
|
|
3348
3355
|
const [failure, setFailure] = useState6(null);
|
|
3349
|
-
|
|
3356
|
+
const rejected = useRef4([]).current;
|
|
3357
|
+
useEffect6(() => {
|
|
3358
|
+
startDebugRun({
|
|
3359
|
+
flow: "import/token-input",
|
|
3360
|
+
step: "02-token-input",
|
|
3361
|
+
menuOption: "Token input",
|
|
3362
|
+
inputs: { import_mode: mode, initial_path: initialPath }
|
|
3363
|
+
});
|
|
3364
|
+
}, []);
|
|
3365
|
+
const back = () => {
|
|
3366
|
+
void finishDebugRun({
|
|
3367
|
+
outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
|
|
3368
|
+
status: failure ? "error" : "success",
|
|
3369
|
+
exitMethod: "discarded"
|
|
3370
|
+
});
|
|
3371
|
+
onBack();
|
|
3372
|
+
};
|
|
3373
|
+
useTokenInputControls(back);
|
|
3350
3374
|
const change = (value) => {
|
|
3351
3375
|
setTokenPath(value);
|
|
3352
3376
|
setFailure(null);
|
|
3353
3377
|
};
|
|
3378
|
+
const reject = (entered, rejection) => {
|
|
3379
|
+
if (rejected.length < MAX_LOGGED_ATTEMPTS) {
|
|
3380
|
+
rejected.push({
|
|
3381
|
+
entered,
|
|
3382
|
+
error: rejection.error,
|
|
3383
|
+
...rejection.resolvedPath ? { resolved_path: rejection.resolvedPath } : {}
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
setFailure(rejection);
|
|
3387
|
+
};
|
|
3354
3388
|
const submit = (value) => {
|
|
3355
3389
|
const rawPath = toTokenPath(value);
|
|
3356
3390
|
if (!rawPath) {
|
|
3357
|
-
|
|
3391
|
+
reject("", { error: "Enter the path to your token file." });
|
|
3358
3392
|
return;
|
|
3359
3393
|
}
|
|
3360
3394
|
const check = validateTokenPath(rawPath);
|
|
3361
|
-
if (check.ok)
|
|
3362
|
-
|
|
3395
|
+
if (!check.ok) {
|
|
3396
|
+
reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
void finishDebugRun({
|
|
3400
|
+
outputs: {
|
|
3401
|
+
token_path: check.path,
|
|
3402
|
+
changed_from_initial: rawPath !== initialPath.trim(),
|
|
3403
|
+
rejected_attempts: rejected
|
|
3404
|
+
},
|
|
3405
|
+
status: "success",
|
|
3406
|
+
exitMethod: "saved"
|
|
3407
|
+
});
|
|
3408
|
+
onConfirm(check.path);
|
|
3363
3409
|
};
|
|
3364
3410
|
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
3365
3411
|
/* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
|
|
@@ -3389,7 +3435,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
|
3389
3435
|
}
|
|
3390
3436
|
|
|
3391
3437
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3392
|
-
import { useEffect as
|
|
3438
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
3393
3439
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3394
3440
|
init_debug_store();
|
|
3395
3441
|
|
|
@@ -18061,7 +18107,7 @@ function PathValidationScreen({
|
|
|
18061
18107
|
}) {
|
|
18062
18108
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18063
18109
|
const [scan, setScan] = useState7();
|
|
18064
|
-
|
|
18110
|
+
useEffect7(() => {
|
|
18065
18111
|
startDebugRun({
|
|
18066
18112
|
flow: "import/path-validation",
|
|
18067
18113
|
step: "03-path-validation",
|
|
@@ -18069,7 +18115,7 @@ function PathValidationScreen({
|
|
|
18069
18115
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18070
18116
|
});
|
|
18071
18117
|
}, []);
|
|
18072
|
-
|
|
18118
|
+
useEffect7(() => {
|
|
18073
18119
|
setScan(scanFiles(resolvedPath));
|
|
18074
18120
|
}, [resolvedPath]);
|
|
18075
18121
|
const phase = phaseOf(scan);
|
|
@@ -18111,8 +18157,9 @@ function PathValidationScreen({
|
|
|
18111
18157
|
}
|
|
18112
18158
|
|
|
18113
18159
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18114
|
-
import { useRef as
|
|
18160
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
|
|
18115
18161
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18162
|
+
init_debug_store();
|
|
18116
18163
|
|
|
18117
18164
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18118
18165
|
import { useState as useState8 } from "react";
|
|
@@ -18289,6 +18336,39 @@ function FieldForm({
|
|
|
18289
18336
|
] });
|
|
18290
18337
|
}
|
|
18291
18338
|
|
|
18339
|
+
// packages/experience-design-system-cli/src/tui/shared/debug-trail.ts
|
|
18340
|
+
init_config();
|
|
18341
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
18342
|
+
function diffSnapshots(before, after) {
|
|
18343
|
+
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
18344
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
18345
|
+
return { changed: changed_fields.length > 0, changed_fields };
|
|
18346
|
+
}
|
|
18347
|
+
var DEFAULT_TRAIL_LIMIT = 30;
|
|
18348
|
+
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
18349
|
+
const actions = [];
|
|
18350
|
+
return {
|
|
18351
|
+
record(action) {
|
|
18352
|
+
actions.push(action);
|
|
18353
|
+
if (actions.length > limit) actions.shift();
|
|
18354
|
+
},
|
|
18355
|
+
entries: () => [...actions]
|
|
18356
|
+
};
|
|
18357
|
+
}
|
|
18358
|
+
var MIN_SECRET_LENGTH = 6;
|
|
18359
|
+
function scrubError(error, secrets) {
|
|
18360
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
18361
|
+
for (const secret of secrets) {
|
|
18362
|
+
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
18363
|
+
for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
|
|
18364
|
+
}
|
|
18365
|
+
return message;
|
|
18366
|
+
}
|
|
18367
|
+
function describeSettingsFile() {
|
|
18368
|
+
const path5 = configFilePath();
|
|
18369
|
+
return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync9(path5) };
|
|
18370
|
+
}
|
|
18371
|
+
|
|
18292
18372
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
18293
18373
|
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
18294
18374
|
function credentialsPurpose(tokensOnly) {
|
|
@@ -18303,12 +18383,36 @@ function normalize(values) {
|
|
|
18303
18383
|
host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
|
|
18304
18384
|
};
|
|
18305
18385
|
}
|
|
18306
|
-
function
|
|
18307
|
-
return
|
|
18386
|
+
function missingFields(values) {
|
|
18387
|
+
return ["spaceId", "environmentId", "cmaToken"].filter((field) => values[field] === "");
|
|
18308
18388
|
}
|
|
18309
18389
|
function isUnchanged(current, initial) {
|
|
18310
18390
|
return FIELDS.every((field) => current[field] === initial[field]);
|
|
18311
18391
|
}
|
|
18392
|
+
function rejectedAttempt(reason, credentials) {
|
|
18393
|
+
return { host: credentials.host, reason: scrubError(reason, [credentials.cmaToken]) };
|
|
18394
|
+
}
|
|
18395
|
+
function credentialsLog(credentials) {
|
|
18396
|
+
return {
|
|
18397
|
+
space_id: credentials.spaceId,
|
|
18398
|
+
environment_id: credentials.environmentId,
|
|
18399
|
+
host: credentials.host,
|
|
18400
|
+
cma_token: credentials.cmaToken
|
|
18401
|
+
};
|
|
18402
|
+
}
|
|
18403
|
+
function credentialsOutputs({
|
|
18404
|
+
outcome,
|
|
18405
|
+
credentials,
|
|
18406
|
+
initial,
|
|
18407
|
+
attempts
|
|
18408
|
+
}) {
|
|
18409
|
+
return {
|
|
18410
|
+
outcome,
|
|
18411
|
+
...credentialsLog(credentials),
|
|
18412
|
+
changed_fields: diffSnapshots(initial, credentials).changed_fields,
|
|
18413
|
+
rejected_attempts: attempts
|
|
18414
|
+
};
|
|
18415
|
+
}
|
|
18312
18416
|
|
|
18313
18417
|
// packages/experience-design-system-cli/src/tui/user-agent.ts
|
|
18314
18418
|
init_version();
|
|
@@ -18356,14 +18460,16 @@ var MENU = [
|
|
|
18356
18460
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
18357
18461
|
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
18358
18462
|
];
|
|
18463
|
+
var MAX_LOGGED_ATTEMPTS2 = 10;
|
|
18359
18464
|
function CredentialsScreen({
|
|
18465
|
+
mode,
|
|
18360
18466
|
onDone,
|
|
18361
18467
|
onBack,
|
|
18362
18468
|
initial = {},
|
|
18363
18469
|
validate: validate3 = validateCredentials,
|
|
18364
18470
|
tokensOnly = false
|
|
18365
18471
|
}) {
|
|
18366
|
-
const initialValues =
|
|
18472
|
+
const initialValues = useRef5(
|
|
18367
18473
|
normalize({
|
|
18368
18474
|
spaceId: initial.spaceId ?? "",
|
|
18369
18475
|
environmentId: initial.environmentId || "master",
|
|
@@ -18379,17 +18485,64 @@ function CredentialsScreen({
|
|
|
18379
18485
|
const [focus, setFocus] = useState9(0);
|
|
18380
18486
|
const [active, setActive] = useState9(0);
|
|
18381
18487
|
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18488
|
+
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18489
|
+
useEffect8(() => {
|
|
18490
|
+
startDebugRun({
|
|
18491
|
+
flow: "import/credentials",
|
|
18492
|
+
step: "04-credentials",
|
|
18493
|
+
menuOption: "Credentials",
|
|
18494
|
+
inputs: { import_mode: mode, prefilled, ...credentialsLog(initialValues) }
|
|
18495
|
+
});
|
|
18496
|
+
}, []);
|
|
18497
|
+
const reject = (attempt, text) => {
|
|
18498
|
+
if (visit.attempts.length < MAX_LOGGED_ATTEMPTS2) visit.attempts.push(attempt);
|
|
18499
|
+
visit.lastReason = attempt.reason;
|
|
18500
|
+
setNotice({ kind: "error", text });
|
|
18501
|
+
};
|
|
18502
|
+
const leave = () => {
|
|
18503
|
+
void finishDebugRun({
|
|
18504
|
+
outputs: {
|
|
18505
|
+
...credentialsOutputs({
|
|
18506
|
+
outcome: "back",
|
|
18507
|
+
credentials: normalize(values),
|
|
18508
|
+
initial: initialValues,
|
|
18509
|
+
attempts: visit.attempts
|
|
18510
|
+
}),
|
|
18511
|
+
...notice ? { error: visit.lastReason } : {}
|
|
18512
|
+
},
|
|
18513
|
+
status: notice ? "error" : "success",
|
|
18514
|
+
exitMethod: "discarded"
|
|
18515
|
+
});
|
|
18516
|
+
onBack();
|
|
18517
|
+
};
|
|
18382
18518
|
const submit = async () => {
|
|
18383
18519
|
const credentials = normalize(values);
|
|
18384
|
-
|
|
18385
|
-
|
|
18520
|
+
const missing = missingFields(credentials);
|
|
18521
|
+
if (missing.length > 0) {
|
|
18522
|
+
reject(
|
|
18523
|
+
rejectedAttempt(`Missing required fields: ${missing.join(", ")}`, credentials),
|
|
18524
|
+
"Space ID, environment and CMA token are all required."
|
|
18525
|
+
);
|
|
18386
18526
|
return;
|
|
18387
18527
|
}
|
|
18388
18528
|
setValidating(true);
|
|
18389
18529
|
const result = await validate3(credentials);
|
|
18390
18530
|
setValidating(false);
|
|
18391
|
-
if (result.ok)
|
|
18392
|
-
|
|
18531
|
+
if (!result.ok) {
|
|
18532
|
+
reject(rejectedAttempt(result.error, credentials), result.error);
|
|
18533
|
+
return;
|
|
18534
|
+
}
|
|
18535
|
+
void finishDebugRun({
|
|
18536
|
+
outputs: credentialsOutputs({
|
|
18537
|
+
outcome: "validated",
|
|
18538
|
+
credentials,
|
|
18539
|
+
initial: initialValues,
|
|
18540
|
+
attempts: visit.attempts
|
|
18541
|
+
}),
|
|
18542
|
+
status: "success",
|
|
18543
|
+
exitMethod: "saved"
|
|
18544
|
+
});
|
|
18545
|
+
onDone({ skipped: false, credentials });
|
|
18393
18546
|
};
|
|
18394
18547
|
const choose = (choice) => {
|
|
18395
18548
|
if (choice === "continue") void submit();
|
|
@@ -18398,7 +18551,7 @@ function CredentialsScreen({
|
|
|
18398
18551
|
setBeforeEdit(values);
|
|
18399
18552
|
setActive(0);
|
|
18400
18553
|
setEditing(true);
|
|
18401
|
-
} else
|
|
18554
|
+
} else leave();
|
|
18402
18555
|
};
|
|
18403
18556
|
const stopEditing = () => {
|
|
18404
18557
|
setEditing(false);
|
|
@@ -18408,7 +18561,7 @@ function CredentialsScreen({
|
|
|
18408
18561
|
if (validating) return;
|
|
18409
18562
|
if (editing) {
|
|
18410
18563
|
if (key.escape) {
|
|
18411
|
-
if (!prefilled)
|
|
18564
|
+
if (!prefilled) leave();
|
|
18412
18565
|
else {
|
|
18413
18566
|
setValues(beforeEdit);
|
|
18414
18567
|
setNotice(null);
|
|
@@ -18744,14 +18897,14 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
18744
18897
|
init_config();
|
|
18745
18898
|
|
|
18746
18899
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
18747
|
-
import { useEffect as
|
|
18900
|
+
import { useEffect as useEffect9, useRef as useRef6, useState as useState11 } from "react";
|
|
18748
18901
|
|
|
18749
18902
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
18750
18903
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
18751
18904
|
import { join as join20, resolve as resolve24 } from "node:path";
|
|
18752
18905
|
|
|
18753
18906
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
18754
|
-
import { existsSync as
|
|
18907
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
18755
18908
|
import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
|
|
18756
18909
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
18757
18910
|
function findSkillPath(fileName) {
|
|
@@ -18759,7 +18912,7 @@ function findSkillPath(fileName) {
|
|
|
18759
18912
|
let dir = thisDir;
|
|
18760
18913
|
for (; ; ) {
|
|
18761
18914
|
const candidate = join19(dir, "skills", fileName);
|
|
18762
|
-
if (
|
|
18915
|
+
if (existsSync10(candidate)) return candidate;
|
|
18763
18916
|
const parent = resolve22(dir, "..");
|
|
18764
18917
|
if (parent === dir) {
|
|
18765
18918
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
@@ -19000,8 +19153,8 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19000
19153
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19001
19154
|
function useExtraction(input) {
|
|
19002
19155
|
const [state2, setState] = useState11();
|
|
19003
|
-
const current =
|
|
19004
|
-
|
|
19156
|
+
const current = useRef6();
|
|
19157
|
+
useEffect9(() => {
|
|
19005
19158
|
current.current = input;
|
|
19006
19159
|
if (!input) {
|
|
19007
19160
|
setState(void 0);
|
|
@@ -19027,7 +19180,7 @@ function useExtraction(input) {
|
|
|
19027
19180
|
}
|
|
19028
19181
|
|
|
19029
19182
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19030
|
-
import { useEffect as
|
|
19183
|
+
import { useEffect as useEffect10, useRef as useRef7, useState as useState12 } from "react";
|
|
19031
19184
|
|
|
19032
19185
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19033
19186
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19061,8 +19214,8 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19061
19214
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19062
19215
|
function useTokensOnly(input) {
|
|
19063
19216
|
const [state2, setState] = useState12();
|
|
19064
|
-
const current =
|
|
19065
|
-
|
|
19217
|
+
const current = useRef7();
|
|
19218
|
+
useEffect10(() => {
|
|
19066
19219
|
current.current = input;
|
|
19067
19220
|
if (!input) {
|
|
19068
19221
|
setState(void 0);
|
|
@@ -20192,7 +20345,7 @@ import React11 from "react";
|
|
|
20192
20345
|
import { Box as Box23, Text as Text24 } from "ink";
|
|
20193
20346
|
|
|
20194
20347
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
|
|
20195
|
-
import { useLayoutEffect, useRef as
|
|
20348
|
+
import { useLayoutEffect, useRef as useRef8 } from "react";
|
|
20196
20349
|
import { useStdin } from "ink";
|
|
20197
20350
|
function parseInput(data) {
|
|
20198
20351
|
const isShiftTab = data === "\x1B[Z";
|
|
@@ -20255,7 +20408,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
|
|
|
20255
20408
|
}
|
|
20256
20409
|
function useImmediateInput(handler, enabled = true) {
|
|
20257
20410
|
const { stdin, setRawMode } = useStdin();
|
|
20258
|
-
const handlerRef =
|
|
20411
|
+
const handlerRef = useRef8(handler);
|
|
20259
20412
|
handlerRef.current = handler;
|
|
20260
20413
|
useLayoutEffect(() => {
|
|
20261
20414
|
if (!enabled) return;
|
|
@@ -20266,7 +20419,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20266
20419
|
|
|
20267
20420
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20268
20421
|
import { useStdout as useStdout2 } from "ink";
|
|
20269
|
-
import { useEffect as
|
|
20422
|
+
import { useEffect as useEffect11, useState as useState13 } from "react";
|
|
20270
20423
|
function readTerminalSize(stdout) {
|
|
20271
20424
|
return {
|
|
20272
20425
|
columns: stdout?.columns ?? 80,
|
|
@@ -20276,7 +20429,7 @@ function readTerminalSize(stdout) {
|
|
|
20276
20429
|
function useTerminalSize() {
|
|
20277
20430
|
const { stdout } = useStdout2();
|
|
20278
20431
|
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
20279
|
-
|
|
20432
|
+
useEffect11(() => {
|
|
20280
20433
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20281
20434
|
stdout?.on("resize", updateSize);
|
|
20282
20435
|
updateSize();
|
|
@@ -20459,7 +20612,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20459
20612
|
}
|
|
20460
20613
|
|
|
20461
20614
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20462
|
-
import { useEffect as
|
|
20615
|
+
import { useEffect as useEffect12, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
20463
20616
|
|
|
20464
20617
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20465
20618
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21195,8 +21348,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21195
21348
|
for (const p of cycleParticipants) seed.add(p);
|
|
21196
21349
|
return seed;
|
|
21197
21350
|
});
|
|
21198
|
-
const seededGroupsRef =
|
|
21199
|
-
|
|
21351
|
+
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21352
|
+
useEffect12(() => {
|
|
21200
21353
|
if (seededGroupsRef.current) return;
|
|
21201
21354
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21202
21355
|
seededGroupsRef.current = true;
|
|
@@ -21287,7 +21440,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21287
21440
|
entryCount: 0
|
|
21288
21441
|
});
|
|
21289
21442
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21290
|
-
|
|
21443
|
+
useEffect12(() => {
|
|
21291
21444
|
setNav((prev) => {
|
|
21292
21445
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21293
21446
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -21762,7 +21915,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
|
|
|
21762
21915
|
}
|
|
21763
21916
|
|
|
21764
21917
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
21765
|
-
import { useEffect as
|
|
21918
|
+
import { useEffect as useEffect13, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
21766
21919
|
|
|
21767
21920
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
21768
21921
|
async function checkGenerationCache(input) {
|
|
@@ -21809,9 +21962,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
|
|
|
21809
21962
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
21810
21963
|
const sessionId = input?.sessionId;
|
|
21811
21964
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
21812
|
-
const cacheCheck =
|
|
21965
|
+
const cacheCheck = useRef10(void 0);
|
|
21813
21966
|
const [confirmed, setConfirmed] = useState17();
|
|
21814
|
-
|
|
21967
|
+
useEffect13(() => {
|
|
21815
21968
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
21816
21969
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
21817
21970
|
}, [input, loaded]);
|
|
@@ -21878,7 +22031,7 @@ function GenerationScreen({
|
|
|
21878
22031
|
}
|
|
21879
22032
|
|
|
21880
22033
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
21881
|
-
import { useEffect as
|
|
22034
|
+
import { useEffect as useEffect14, useRef as useRef11, useState as useState18 } from "react";
|
|
21882
22035
|
|
|
21883
22036
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
21884
22037
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22043,8 +22196,8 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22043
22196
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22044
22197
|
function useGeneration(input) {
|
|
22045
22198
|
const [state2, setState] = useState18();
|
|
22046
|
-
const current =
|
|
22047
|
-
|
|
22199
|
+
const current = useRef11();
|
|
22200
|
+
useEffect14(() => {
|
|
22048
22201
|
current.current = input;
|
|
22049
22202
|
if (!input) {
|
|
22050
22203
|
setState(void 0);
|
|
@@ -22525,7 +22678,7 @@ function PreviewValidationErrorScreen({
|
|
|
22525
22678
|
}
|
|
22526
22679
|
|
|
22527
22680
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
22528
|
-
import { useCallback as useCallback5, useEffect as
|
|
22681
|
+
import { useCallback as useCallback5, useEffect as useEffect21, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
|
|
22529
22682
|
import figures8 from "figures";
|
|
22530
22683
|
|
|
22531
22684
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -22786,7 +22939,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
22786
22939
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
22787
22940
|
|
|
22788
22941
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
22789
|
-
import React13, { useEffect as
|
|
22942
|
+
import React13, { useEffect as useEffect15, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
22790
22943
|
import figures6 from "figures";
|
|
22791
22944
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
22792
22945
|
|
|
@@ -24344,7 +24497,7 @@ function FieldEditor({
|
|
|
24344
24497
|
}
|
|
24345
24498
|
return Math.max(start + 1, end2);
|
|
24346
24499
|
};
|
|
24347
|
-
|
|
24500
|
+
useEffect15(() => {
|
|
24348
24501
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24349
24502
|
setListScrollStart((previous) => {
|
|
24350
24503
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -25416,7 +25569,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25416
25569
|
}
|
|
25417
25570
|
|
|
25418
25571
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
25419
|
-
import { useCallback as useCallback2, useEffect as
|
|
25572
|
+
import { useCallback as useCallback2, useEffect as useEffect17, useRef as useRef13, useState as useState21 } from "react";
|
|
25420
25573
|
|
|
25421
25574
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
25422
25575
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -25472,7 +25625,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
25472
25625
|
}
|
|
25473
25626
|
|
|
25474
25627
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
25475
|
-
import { useEffect as
|
|
25628
|
+
import { useEffect as useEffect16, useRef as useRef12, useState as useState20 } from "react";
|
|
25476
25629
|
|
|
25477
25630
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
25478
25631
|
var TimeoutError = class extends Error {
|
|
@@ -25630,9 +25783,9 @@ function useFinalizePreview(opts) {
|
|
|
25630
25783
|
const [status, setStatus] = useState20("idle");
|
|
25631
25784
|
const [removed, setRemoved] = useState20([]);
|
|
25632
25785
|
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
25633
|
-
const generationRef =
|
|
25786
|
+
const generationRef = useRef12(0);
|
|
25634
25787
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
25635
|
-
|
|
25788
|
+
useEffect16(() => {
|
|
25636
25789
|
if (!open) {
|
|
25637
25790
|
setStatus("idle");
|
|
25638
25791
|
setRemoved([]);
|
|
@@ -25695,7 +25848,7 @@ function useReviewSession({
|
|
|
25695
25848
|
}));
|
|
25696
25849
|
return { result, catalog };
|
|
25697
25850
|
}, [loadSession, tokensPath]);
|
|
25698
|
-
|
|
25851
|
+
useEffect17(() => {
|
|
25699
25852
|
let disposed = false;
|
|
25700
25853
|
void (async () => {
|
|
25701
25854
|
try {
|
|
@@ -25748,7 +25901,7 @@ function useReviewSession({
|
|
|
25748
25901
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
25749
25902
|
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
25750
25903
|
const [componentRationale, setComponentRationale] = useState21(null);
|
|
25751
|
-
|
|
25904
|
+
useEffect17(() => {
|
|
25752
25905
|
const current = components[selectedIdx];
|
|
25753
25906
|
if (!current) {
|
|
25754
25907
|
setReviewMetadata(null);
|
|
@@ -25778,9 +25931,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
|
25778
25931
|
return { reviewMetadata, componentRationale };
|
|
25779
25932
|
}
|
|
25780
25933
|
function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
|
|
25781
|
-
const historyRef =
|
|
25782
|
-
const historySeededRef =
|
|
25783
|
-
|
|
25934
|
+
const historyRef = useRef13(null);
|
|
25935
|
+
const historySeededRef = useRef13(false);
|
|
25936
|
+
useEffect17(() => {
|
|
25784
25937
|
if (loading || historySeededRef.current) return;
|
|
25785
25938
|
historySeededRef.current = true;
|
|
25786
25939
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -25831,7 +25984,7 @@ function useReviewFinalize({
|
|
|
25831
25984
|
}
|
|
25832
25985
|
|
|
25833
25986
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
25834
|
-
import { useEffect as
|
|
25987
|
+
import { useEffect as useEffect18, useRef as useRef14, useState as useState22 } from "react";
|
|
25835
25988
|
|
|
25836
25989
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
25837
25990
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -25882,9 +26035,9 @@ function useReviewEditor({
|
|
|
25882
26035
|
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
25883
26036
|
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
25884
26037
|
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
25885
|
-
const tokenReviewSuggestedRef =
|
|
25886
|
-
const pendingGRef =
|
|
25887
|
-
|
|
26038
|
+
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26039
|
+
const pendingGRef = useRef14(false);
|
|
26040
|
+
useEffect18(() => {
|
|
25888
26041
|
setTokenReviewRow(0);
|
|
25889
26042
|
setTokenReviewEditing(false);
|
|
25890
26043
|
setTokenReviewEditCursor(0);
|
|
@@ -26296,7 +26449,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26296
26449
|
}
|
|
26297
26450
|
|
|
26298
26451
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26299
|
-
import { useCallback as useCallback4, useEffect as
|
|
26452
|
+
import { useCallback as useCallback4, useEffect as useEffect20, useState as useState25 } from "react";
|
|
26300
26453
|
|
|
26301
26454
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26302
26455
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26331,25 +26484,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26331
26484
|
}
|
|
26332
26485
|
|
|
26333
26486
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26334
|
-
import { useCallback as useCallback3, useEffect as
|
|
26487
|
+
import { useCallback as useCallback3, useEffect as useEffect19, useRef as useRef15, useState as useState24 } from "react";
|
|
26335
26488
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26336
26489
|
function useLivePreview(opts) {
|
|
26337
26490
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26338
26491
|
const [status, setStatus] = useState24("idle");
|
|
26339
26492
|
const [disabled, setDisabled] = useState24(false);
|
|
26340
|
-
const timerRef =
|
|
26341
|
-
const generationRef =
|
|
26342
|
-
const latestRef =
|
|
26343
|
-
const inflightRef =
|
|
26344
|
-
const optsRef =
|
|
26345
|
-
|
|
26493
|
+
const timerRef = useRef15(null);
|
|
26494
|
+
const generationRef = useRef15(0);
|
|
26495
|
+
const latestRef = useRef15(0);
|
|
26496
|
+
const inflightRef = useRef15(0);
|
|
26497
|
+
const optsRef = useRef15(opts);
|
|
26498
|
+
useEffect19(() => {
|
|
26346
26499
|
optsRef.current = opts;
|
|
26347
26500
|
});
|
|
26348
|
-
const disabledRef =
|
|
26349
|
-
|
|
26501
|
+
const disabledRef = useRef15(disabled);
|
|
26502
|
+
useEffect19(() => {
|
|
26350
26503
|
disabledRef.current = disabled;
|
|
26351
26504
|
}, [disabled]);
|
|
26352
|
-
|
|
26505
|
+
useEffect19(() => {
|
|
26353
26506
|
return () => {
|
|
26354
26507
|
if (timerRef.current) {
|
|
26355
26508
|
clearTimeout(timerRef.current);
|
|
@@ -26463,13 +26616,13 @@ function useReviewPreview({
|
|
|
26463
26616
|
deleteAllComponents
|
|
26464
26617
|
});
|
|
26465
26618
|
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
26466
|
-
|
|
26619
|
+
useEffect20(() => {
|
|
26467
26620
|
if (livePreviewHook.status !== "running") return;
|
|
26468
26621
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
26469
26622
|
return () => clearInterval(id);
|
|
26470
26623
|
}, [livePreviewHook.status]);
|
|
26471
26624
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
26472
|
-
|
|
26625
|
+
useEffect20(() => {
|
|
26473
26626
|
if (loading) return;
|
|
26474
26627
|
if (!livePreview) return;
|
|
26475
26628
|
if (components.length === 0) return;
|
|
@@ -26782,7 +26935,7 @@ function GenerateReviewStepView({
|
|
|
26782
26935
|
setFinalizeError
|
|
26783
26936
|
} = reviewSurface;
|
|
26784
26937
|
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
26785
|
-
const removedBannerDefaultedRef =
|
|
26938
|
+
const removedBannerDefaultedRef = useRef16(false);
|
|
26786
26939
|
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
26787
26940
|
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
26788
26941
|
const cyclePanel = useOverlayPanel({
|
|
@@ -26802,7 +26955,7 @@ function GenerateReviewStepView({
|
|
|
26802
26955
|
const [breakCursor, setBreakCursor] = useState26(0);
|
|
26803
26956
|
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
26804
26957
|
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
26805
|
-
const seededGroupsRef =
|
|
26958
|
+
const seededGroupsRef = useRef16(false);
|
|
26806
26959
|
const {
|
|
26807
26960
|
searchOpen,
|
|
26808
26961
|
setSearchOpen,
|
|
@@ -26826,7 +26979,7 @@ function GenerateReviewStepView({
|
|
|
26826
26979
|
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
26827
26980
|
const [autoRejected, setAutoRejected] = useState26([]);
|
|
26828
26981
|
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
26829
|
-
const autoRejectFiredRef =
|
|
26982
|
+
const autoRejectFiredRef = useRef16(false);
|
|
26830
26983
|
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
26831
26984
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
26832
26985
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
@@ -26889,7 +27042,7 @@ function GenerateReviewStepView({
|
|
|
26889
27042
|
[components]
|
|
26890
27043
|
);
|
|
26891
27044
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
26892
|
-
|
|
27045
|
+
useEffect21(() => {
|
|
26893
27046
|
if (seededGroupsRef.current) return;
|
|
26894
27047
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
26895
27048
|
seededGroupsRef.current = true;
|
|
@@ -26916,7 +27069,7 @@ function GenerateReviewStepView({
|
|
|
26916
27069
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
26917
27070
|
}));
|
|
26918
27071
|
}, [slotCycles, cycleView]);
|
|
26919
|
-
|
|
27072
|
+
useEffect21(() => {
|
|
26920
27073
|
const decision = computeAutoRejectDecision({
|
|
26921
27074
|
loading,
|
|
26922
27075
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -26959,8 +27112,8 @@ function GenerateReviewStepView({
|
|
|
26959
27112
|
}),
|
|
26960
27113
|
applySnapshot: applyHistorySnapshot
|
|
26961
27114
|
});
|
|
26962
|
-
const autoRejectPushedRef =
|
|
26963
|
-
|
|
27115
|
+
const autoRejectPushedRef = useRef16(false);
|
|
27116
|
+
useEffect21(() => {
|
|
26964
27117
|
if (loading) return;
|
|
26965
27118
|
if (!historySeededRef.current) return;
|
|
26966
27119
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27044,7 +27197,7 @@ function GenerateReviewStepView({
|
|
|
27044
27197
|
const panelHeight = leftPanelHeight + 2;
|
|
27045
27198
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27046
27199
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27047
|
-
|
|
27200
|
+
useEffect21(() => {
|
|
27048
27201
|
if (selectableRowPositions.length === 0) return;
|
|
27049
27202
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27050
27203
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -27989,10 +28142,10 @@ function normalizePath(input) {
|
|
|
27989
28142
|
}
|
|
27990
28143
|
|
|
27991
28144
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
27992
|
-
import { useEffect as
|
|
28145
|
+
import { useEffect as useEffect22, useState as useState27 } from "react";
|
|
27993
28146
|
function useBlinkingCursor() {
|
|
27994
28147
|
const [visible, setVisible] = useState27(true);
|
|
27995
|
-
|
|
28148
|
+
useEffect22(() => {
|
|
27996
28149
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
27997
28150
|
return () => clearInterval(interval);
|
|
27998
28151
|
}, []);
|
|
@@ -28108,12 +28261,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28108
28261
|
}
|
|
28109
28262
|
|
|
28110
28263
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28111
|
-
import { useEffect as
|
|
28264
|
+
import { useEffect as useEffect23, useState as useState29 } from "react";
|
|
28112
28265
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28113
28266
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28114
28267
|
function useTimedSpinner() {
|
|
28115
28268
|
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
28116
|
-
|
|
28269
|
+
useEffect23(() => {
|
|
28117
28270
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28118
28271
|
return () => {
|
|
28119
28272
|
clearInterval(timer);
|
|
@@ -28171,7 +28324,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28171
28324
|
}
|
|
28172
28325
|
|
|
28173
28326
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28174
|
-
import { useEffect as
|
|
28327
|
+
import { useEffect as useEffect24, useState as useState30, useMemo as useMemo7 } from "react";
|
|
28175
28328
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28176
28329
|
|
|
28177
28330
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -28566,7 +28719,7 @@ function WizardPreviewStep({
|
|
|
28566
28719
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
28567
28720
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
28568
28721
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
28569
|
-
|
|
28722
|
+
useEffect24(() => {
|
|
28570
28723
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
28571
28724
|
}, [maxScroll]);
|
|
28572
28725
|
useImmediateInput((input, key) => {
|
|
@@ -28784,7 +28937,7 @@ function FlowScreen({
|
|
|
28784
28937
|
}
|
|
28785
28938
|
|
|
28786
28939
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
28787
|
-
import { useEffect as
|
|
28940
|
+
import { useEffect as useEffect25, useRef as useRef17, useSyncExternalStore } from "react";
|
|
28788
28941
|
|
|
28789
28942
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
28790
28943
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
@@ -29526,7 +29679,7 @@ function createFlowController(start, deps) {
|
|
|
29526
29679
|
|
|
29527
29680
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29528
29681
|
function useFlow(start, options = {}) {
|
|
29529
|
-
const controller =
|
|
29682
|
+
const controller = useRef17();
|
|
29530
29683
|
if (start && !controller.current) {
|
|
29531
29684
|
try {
|
|
29532
29685
|
startWizardLog();
|
|
@@ -29543,14 +29696,14 @@ function useFlow(start, options = {}) {
|
|
|
29543
29696
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
29544
29697
|
() => current?.getState()
|
|
29545
29698
|
);
|
|
29546
|
-
|
|
29699
|
+
useEffect25(() => {
|
|
29547
29700
|
if (!start) controller.current = void 0;
|
|
29548
29701
|
}, [start]);
|
|
29549
29702
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
29550
29703
|
}
|
|
29551
29704
|
|
|
29552
29705
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
29553
|
-
import { useEffect as
|
|
29706
|
+
import { useEffect as useEffect26, useState as useState31 } from "react";
|
|
29554
29707
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
29555
29708
|
init_debug_store();
|
|
29556
29709
|
|
|
@@ -29624,7 +29777,7 @@ function Section({ title, rows }) {
|
|
|
29624
29777
|
}
|
|
29625
29778
|
function HelpScreen({ onDone }) {
|
|
29626
29779
|
const [info, setInfo] = useState31();
|
|
29627
|
-
|
|
29780
|
+
useEffect26(() => {
|
|
29628
29781
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
29629
29782
|
void readHelpInfo().then(setInfo);
|
|
29630
29783
|
}, []);
|
|
@@ -29721,43 +29874,10 @@ import { useState as useState36 } from "react";
|
|
|
29721
29874
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
29722
29875
|
|
|
29723
29876
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
29724
|
-
import { useEffect as
|
|
29877
|
+
import { useEffect as useEffect28, useRef as useRef18, useState as useState34 } from "react";
|
|
29725
29878
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
29726
29879
|
init_debug_store();
|
|
29727
29880
|
|
|
29728
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
|
|
29729
|
-
init_config();
|
|
29730
|
-
import { existsSync as existsSync10 } from "node:fs";
|
|
29731
|
-
function diffSnapshots(before, after) {
|
|
29732
|
-
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
29733
|
-
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
29734
|
-
return { changed: changed_fields.length > 0, changed_fields };
|
|
29735
|
-
}
|
|
29736
|
-
var DEFAULT_TRAIL_LIMIT = 30;
|
|
29737
|
-
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
29738
|
-
const actions = [];
|
|
29739
|
-
return {
|
|
29740
|
-
record(action) {
|
|
29741
|
-
actions.push(action);
|
|
29742
|
-
if (actions.length > limit) actions.shift();
|
|
29743
|
-
},
|
|
29744
|
-
entries: () => [...actions]
|
|
29745
|
-
};
|
|
29746
|
-
}
|
|
29747
|
-
var MIN_SECRET_LENGTH = 6;
|
|
29748
|
-
function scrubError(error, secrets) {
|
|
29749
|
-
let message = error instanceof Error ? error.message : String(error);
|
|
29750
|
-
for (const secret of secrets) {
|
|
29751
|
-
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
29752
|
-
for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
|
|
29753
|
-
}
|
|
29754
|
-
return message;
|
|
29755
|
-
}
|
|
29756
|
-
function describeSettingsFile() {
|
|
29757
|
-
const path5 = configFilePath();
|
|
29758
|
-
return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
|
|
29759
|
-
}
|
|
29760
|
-
|
|
29761
29881
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
29762
29882
|
import { execFile as execFile2 } from "node:child_process";
|
|
29763
29883
|
import { access as access5, constants } from "node:fs/promises";
|
|
@@ -30050,7 +30170,7 @@ async function writeAgentConfig(config) {
|
|
|
30050
30170
|
}
|
|
30051
30171
|
|
|
30052
30172
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30053
|
-
import { useEffect as
|
|
30173
|
+
import { useEffect as useEffect27, useState as useState33 } from "react";
|
|
30054
30174
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30055
30175
|
|
|
30056
30176
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -30113,7 +30233,7 @@ function AgentDetail({
|
|
|
30113
30233
|
const [testing, setTesting] = useState33(false);
|
|
30114
30234
|
const [notice, setNotice] = useState33(null);
|
|
30115
30235
|
const [checks, setChecks] = useState33(void 0);
|
|
30116
|
-
|
|
30236
|
+
useEffect27(() => {
|
|
30117
30237
|
let active = true;
|
|
30118
30238
|
setChecks(void 0);
|
|
30119
30239
|
const timer = setTimeout(() => {
|
|
@@ -30198,7 +30318,7 @@ function AgentsScreen({ onDone }) {
|
|
|
30198
30318
|
const [saving, setSaving] = useState34(false);
|
|
30199
30319
|
const [loadError, setLoadError] = useState34(null);
|
|
30200
30320
|
const [checks, setChecks] = useState34({});
|
|
30201
|
-
const visit =
|
|
30321
|
+
const visit = useRef18({
|
|
30202
30322
|
trail: createTrail(),
|
|
30203
30323
|
before: void 0,
|
|
30204
30324
|
environment: void 0,
|
|
@@ -30211,7 +30331,7 @@ function AgentsScreen({ onDone }) {
|
|
|
30211
30331
|
);
|
|
30212
30332
|
}
|
|
30213
30333
|
};
|
|
30214
|
-
|
|
30334
|
+
useEffect28(() => {
|
|
30215
30335
|
readAgentConfig().then((loaded) => {
|
|
30216
30336
|
setConfig(loaded);
|
|
30217
30337
|
inspectAll(loaded);
|
|
@@ -30388,7 +30508,7 @@ function AgentsScreen({ onDone }) {
|
|
|
30388
30508
|
}
|
|
30389
30509
|
|
|
30390
30510
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
30391
|
-
import { useEffect as
|
|
30511
|
+
import { useEffect as useEffect29, useRef as useRef19, useState as useState35 } from "react";
|
|
30392
30512
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
30393
30513
|
init_debug_store();
|
|
30394
30514
|
|
|
@@ -30446,14 +30566,14 @@ function ProjectScreen({ onDone }) {
|
|
|
30446
30566
|
const [saving, setSaving] = useState35(false);
|
|
30447
30567
|
const [notice, setNotice] = useState35(null);
|
|
30448
30568
|
const [loadError, setLoadError] = useState35(null);
|
|
30449
|
-
const visit =
|
|
30569
|
+
const visit = useRef19({
|
|
30450
30570
|
trail: createTrail(),
|
|
30451
30571
|
before: void 0,
|
|
30452
30572
|
persisted: void 0,
|
|
30453
30573
|
error: ""
|
|
30454
30574
|
}).current;
|
|
30455
30575
|
const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
30456
|
-
|
|
30576
|
+
useEffect29(() => {
|
|
30457
30577
|
readCredentials().then((cfg) => {
|
|
30458
30578
|
setConfig(cfg);
|
|
30459
30579
|
visit.before = snapshotOf(cfg);
|
|
@@ -30605,7 +30725,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
30605
30725
|
}
|
|
30606
30726
|
|
|
30607
30727
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
30608
|
-
import { useEffect as
|
|
30728
|
+
import { useEffect as useEffect30, useState as useState37 } from "react";
|
|
30609
30729
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
30610
30730
|
|
|
30611
30731
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -30629,7 +30749,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
|
|
|
30629
30749
|
function OptInAnalyticsScreen({ onDone }) {
|
|
30630
30750
|
const [loading, setLoading] = useState37(true);
|
|
30631
30751
|
const [enabled, setEnabled] = useState37(true);
|
|
30632
|
-
|
|
30752
|
+
useEffect30(() => {
|
|
30633
30753
|
readAnalyticsSetting().then((setting) => {
|
|
30634
30754
|
setEnabled(setting.enabled);
|
|
30635
30755
|
setLoading(false);
|
|
@@ -30683,7 +30803,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
30683
30803
|
}
|
|
30684
30804
|
|
|
30685
30805
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
30686
|
-
import { useEffect as
|
|
30806
|
+
import { useEffect as useEffect31, useRef as useRef20, useState as useState38 } from "react";
|
|
30687
30807
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
30688
30808
|
init_debug_mode_store();
|
|
30689
30809
|
init_debug_store();
|
|
@@ -30700,8 +30820,8 @@ function DebugModeScreen({ onDone }) {
|
|
|
30700
30820
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
30701
30821
|
);
|
|
30702
30822
|
const [notice, setNotice] = useState38(null);
|
|
30703
|
-
const visit =
|
|
30704
|
-
|
|
30823
|
+
const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
30824
|
+
useEffect31(() => {
|
|
30705
30825
|
readDebugModeSetting().then((loaded) => {
|
|
30706
30826
|
setSetting(loaded);
|
|
30707
30827
|
setPending(loaded.retentionDays);
|
|
@@ -30856,7 +30976,7 @@ function App({ importOptions, inkClear }) {
|
|
|
30856
30976
|
const [flowStart, setFlowStart] = useState39();
|
|
30857
30977
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
30858
30978
|
const [importDefaults, setImportDefaults] = useState39();
|
|
30859
|
-
|
|
30979
|
+
useEffect32(() => {
|
|
30860
30980
|
if (screen !== "import") {
|
|
30861
30981
|
setImportDefaults(void 0);
|
|
30862
30982
|
return;
|
|
@@ -30929,7 +31049,7 @@ function App({ importOptions, inkClear }) {
|
|
|
30929
31049
|
}
|
|
30930
31050
|
});
|
|
30931
31051
|
};
|
|
30932
|
-
|
|
31052
|
+
useEffect32(() => {
|
|
30933
31053
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
30934
31054
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
30935
31055
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -30951,12 +31071,12 @@ function App({ importOptions, inkClear }) {
|
|
|
30951
31071
|
}
|
|
30952
31072
|
});
|
|
30953
31073
|
}, [tokensOnly, tokensOnlyRun]);
|
|
30954
|
-
|
|
31074
|
+
useEffect32(() => {
|
|
30955
31075
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
30956
31076
|
setExtractionRun(void 0);
|
|
30957
31077
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
30958
31078
|
}, [extraction, extractionRun]);
|
|
30959
|
-
|
|
31079
|
+
useEffect32(() => {
|
|
30960
31080
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
30961
31081
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
30962
31082
|
setGenerationInput({
|
|
@@ -30974,7 +31094,7 @@ function App({ importOptions, inkClear }) {
|
|
|
30974
31094
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
30975
31095
|
});
|
|
30976
31096
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
30977
|
-
|
|
31097
|
+
useEffect32(() => {
|
|
30978
31098
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
30979
31099
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
30980
31100
|
inkClear();
|
|
@@ -31067,6 +31187,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31067
31187
|
return /* @__PURE__ */ jsx66(
|
|
31068
31188
|
TokenInputScreen,
|
|
31069
31189
|
{
|
|
31190
|
+
mode: target,
|
|
31070
31191
|
initialPath: importDefaults.tokenFile,
|
|
31071
31192
|
onConfirm: (tokensPath) => answer({ tokensPath }),
|
|
31072
31193
|
onBack: () => goBackFrom("token-file")
|
|
@@ -31142,6 +31263,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31142
31263
|
return /* @__PURE__ */ jsx66(
|
|
31143
31264
|
CredentialsScreen,
|
|
31144
31265
|
{
|
|
31266
|
+
mode: target,
|
|
31145
31267
|
initial: importDefaults.credentials,
|
|
31146
31268
|
tokensOnly: target === "tokens",
|
|
31147
31269
|
onBack: () => goBackFrom("credentials"),
|