@contentful/experience-design-system-cli 2.37.1-dev-build-8b3a1c07.0 → 2.37.1-dev-build-0b786a83.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 +497 -373
- package/dist/index.js +523 -391
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/agents/AgentDetail.d.ts +13 -0
- package/dist/src/tui/settings/agents/AgentScreens.d.ts +2 -2
- package/dist/src/tui/settings/agents/{AgentStatusLine.d.ts → AgentStatusBadge.d.ts} +3 -7
- package/dist/src/tui/settings/agents/agent-status.d.ts +18 -3
- package/dist/src/tui/settings/shared/FieldForm.d.ts +1 -7
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3426,9 +3426,9 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
3426
3426
|
async function resolveImportSpecifiers(sourceText, fromDir) {
|
|
3427
3427
|
const resolvedPaths = [];
|
|
3428
3428
|
for (const specifier of extractRelativeImportPaths(sourceText)) {
|
|
3429
|
-
const
|
|
3430
|
-
if (
|
|
3431
|
-
resolvedPaths.push(
|
|
3429
|
+
const resolvedPath2 = await resolveRelativeImport(specifier, fromDir);
|
|
3430
|
+
if (resolvedPath2)
|
|
3431
|
+
resolvedPaths.push(resolvedPath2);
|
|
3432
3432
|
}
|
|
3433
3433
|
return resolvedPaths;
|
|
3434
3434
|
}
|
|
@@ -3442,20 +3442,20 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
3442
3442
|
if (discovered.length >= MAX_SIBLING_CANDIDATES_EXPLORED)
|
|
3443
3443
|
break;
|
|
3444
3444
|
const resolvedPaths = await resolveImportSpecifiers(node.text, node.dir);
|
|
3445
|
-
for (const
|
|
3446
|
-
if (visited.has(
|
|
3445
|
+
for (const resolvedPath2 of resolvedPaths) {
|
|
3446
|
+
if (visited.has(resolvedPath2))
|
|
3447
3447
|
continue;
|
|
3448
|
-
visited.add(
|
|
3448
|
+
visited.add(resolvedPath2);
|
|
3449
3449
|
if (discovered.length >= MAX_SIBLING_CANDIDATES_EXPLORED)
|
|
3450
3450
|
break;
|
|
3451
3451
|
let content;
|
|
3452
3452
|
try {
|
|
3453
|
-
content = await readFile4(
|
|
3453
|
+
content = await readFile4(resolvedPath2, "utf8");
|
|
3454
3454
|
} catch {
|
|
3455
3455
|
continue;
|
|
3456
3456
|
}
|
|
3457
|
-
discovered.push({ path:
|
|
3458
|
-
nextFrontier.push({ text: content, dir: dirname3(
|
|
3457
|
+
discovered.push({ path: resolvedPath2, content });
|
|
3458
|
+
nextFrontier.push({ text: content, dir: dirname3(resolvedPath2) });
|
|
3459
3459
|
}
|
|
3460
3460
|
}
|
|
3461
3461
|
frontier = nextFrontier;
|
|
@@ -4709,11 +4709,11 @@ function isBareModuleSpecifier(moduleSpecifier) {
|
|
|
4709
4709
|
return !moduleSpecifier.startsWith(".") && !moduleSpecifier.startsWith("/");
|
|
4710
4710
|
}
|
|
4711
4711
|
function findRepoLocalAliasSourceFile(originSourceFile, moduleSpecifier) {
|
|
4712
|
-
const
|
|
4713
|
-
if (!
|
|
4712
|
+
const resolvedPath2 = resolveRepoLocalAliasImportPath(originSourceFile.getFilePath(), moduleSpecifier);
|
|
4713
|
+
if (!resolvedPath2)
|
|
4714
4714
|
return void 0;
|
|
4715
4715
|
const project = originSourceFile.getProject();
|
|
4716
|
-
return findProjectSourceFileByImportPath(project,
|
|
4716
|
+
return findProjectSourceFileByImportPath(project, resolvedPath2);
|
|
4717
4717
|
}
|
|
4718
4718
|
function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
|
|
4719
4719
|
const nearestTsConfigPath = findNearestTsConfigPath(importingFilePath);
|
|
@@ -4728,8 +4728,8 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
|
|
|
4728
4728
|
continue;
|
|
4729
4729
|
for (const targetPattern of targets) {
|
|
4730
4730
|
const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
|
|
4731
|
-
const
|
|
4732
|
-
const sourceFilePath = resolveImportSourcePath(
|
|
4731
|
+
const resolvedPath2 = resolve6(tsConfigPaths.baseUrl, substitutedTarget);
|
|
4732
|
+
const sourceFilePath = resolveImportSourcePath(resolvedPath2);
|
|
4733
4733
|
if (sourceFilePath)
|
|
4734
4734
|
return sourceFilePath;
|
|
4735
4735
|
}
|
|
@@ -4807,17 +4807,17 @@ function resolveImportSourcePath(basePath) {
|
|
|
4807
4807
|
];
|
|
4808
4808
|
return candidates.find((candidatePath) => existsSync2(candidatePath));
|
|
4809
4809
|
}
|
|
4810
|
-
function findProjectSourceFileByImportPath(project,
|
|
4810
|
+
function findProjectSourceFileByImportPath(project, resolvedPath2) {
|
|
4811
4811
|
const candidatePaths = [
|
|
4812
|
-
|
|
4813
|
-
`${
|
|
4814
|
-
`${
|
|
4815
|
-
`${
|
|
4816
|
-
`${
|
|
4817
|
-
join3(
|
|
4818
|
-
join3(
|
|
4819
|
-
join3(
|
|
4820
|
-
join3(
|
|
4812
|
+
resolvedPath2,
|
|
4813
|
+
`${resolvedPath2}.ts`,
|
|
4814
|
+
`${resolvedPath2}.tsx`,
|
|
4815
|
+
`${resolvedPath2}.js`,
|
|
4816
|
+
`${resolvedPath2}.jsx`,
|
|
4817
|
+
join3(resolvedPath2, "index.ts"),
|
|
4818
|
+
join3(resolvedPath2, "index.tsx"),
|
|
4819
|
+
join3(resolvedPath2, "index.js"),
|
|
4820
|
+
join3(resolvedPath2, "index.jsx")
|
|
4821
4821
|
];
|
|
4822
4822
|
for (const candidatePath of candidatePaths) {
|
|
4823
4823
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -9422,11 +9422,11 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
|
|
|
9422
9422
|
}
|
|
9423
9423
|
function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
9424
9424
|
if (specifier.startsWith(".")) {
|
|
9425
|
-
const
|
|
9426
|
-
if (
|
|
9427
|
-
return `${
|
|
9425
|
+
const resolvedPath2 = resolve9(dirname7(fromFilePath), specifier);
|
|
9426
|
+
if (resolvedPath2.endsWith(".js")) {
|
|
9427
|
+
return `${resolvedPath2.slice(0, -3)}.ts`;
|
|
9428
9428
|
}
|
|
9429
|
-
return
|
|
9429
|
+
return resolvedPath2;
|
|
9430
9430
|
}
|
|
9431
9431
|
const spectrumPrefix = "@spectrum-web-components/core/components/";
|
|
9432
9432
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
@@ -20349,15 +20349,15 @@ function PathValidationScreen({
|
|
|
20349
20349
|
onChangePath,
|
|
20350
20350
|
onBack
|
|
20351
20351
|
}) {
|
|
20352
|
-
const
|
|
20352
|
+
const resolvedPath2 = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
20353
20353
|
const [scan, setScan] = useState5();
|
|
20354
20354
|
useEffect3(() => {
|
|
20355
|
-
setScan(scanFiles(
|
|
20356
|
-
}, [
|
|
20355
|
+
setScan(scanFiles(resolvedPath2));
|
|
20356
|
+
}, [resolvedPath2]);
|
|
20357
20357
|
const phase = phaseOf(scan);
|
|
20358
20358
|
usePathValidationControls(phase, {
|
|
20359
20359
|
onConfirm: () => {
|
|
20360
|
-
if (scan?.ok) onConfirm({ projectPath:
|
|
20360
|
+
if (scan?.ok) onConfirm({ projectPath: resolvedPath2, filePaths: scan.filePaths });
|
|
20361
20361
|
},
|
|
20362
20362
|
onChangePath,
|
|
20363
20363
|
onBack
|
|
@@ -20365,11 +20365,11 @@ function PathValidationScreen({
|
|
|
20365
20365
|
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
20366
20366
|
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
20367
20367
|
"Scanning ",
|
|
20368
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children:
|
|
20368
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath2 }),
|
|
20369
20369
|
"..."
|
|
20370
20370
|
] }),
|
|
20371
|
-
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path:
|
|
20372
|
-
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path:
|
|
20371
|
+
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath2 }),
|
|
20372
|
+
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath2 }),
|
|
20373
20373
|
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
20374
20374
|
"[",
|
|
20375
20375
|
control.keys,
|
|
@@ -33107,129 +33107,6 @@ var init_PageContainer3 = __esm({
|
|
|
33107
33107
|
}
|
|
33108
33108
|
});
|
|
33109
33109
|
|
|
33110
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
33111
|
-
import { useState as useState29 } from "react";
|
|
33112
|
-
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33113
|
-
import TextInput4 from "ink-text-input";
|
|
33114
|
-
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33115
|
-
function FieldForm({
|
|
33116
|
-
title,
|
|
33117
|
-
subtitle,
|
|
33118
|
-
fields,
|
|
33119
|
-
values,
|
|
33120
|
-
onChange,
|
|
33121
|
-
onSave,
|
|
33122
|
-
onQuit,
|
|
33123
|
-
notice,
|
|
33124
|
-
busy = false,
|
|
33125
|
-
footer,
|
|
33126
|
-
actions = []
|
|
33127
|
-
}) {
|
|
33128
|
-
const [active, setActive] = useState29(0);
|
|
33129
|
-
const [editing, setEditing] = useState29(false);
|
|
33130
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33131
|
-
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
33132
|
-
const current = fields[active];
|
|
33133
|
-
useInput11((input, key) => {
|
|
33134
|
-
if (busy) return;
|
|
33135
|
-
if (editing) {
|
|
33136
|
-
if (key.escape) {
|
|
33137
|
-
onChange(current.key, valueBeforeEdit);
|
|
33138
|
-
setEditing(false);
|
|
33139
|
-
}
|
|
33140
|
-
return;
|
|
33141
|
-
}
|
|
33142
|
-
if (key.escape || input === "q") {
|
|
33143
|
-
onQuit();
|
|
33144
|
-
return;
|
|
33145
|
-
}
|
|
33146
|
-
if (input === "s") {
|
|
33147
|
-
onSave();
|
|
33148
|
-
return;
|
|
33149
|
-
}
|
|
33150
|
-
if (input === "c") {
|
|
33151
|
-
onChange(current.key, "");
|
|
33152
|
-
return;
|
|
33153
|
-
}
|
|
33154
|
-
const action = actions.find((candidate) => candidate.key === input);
|
|
33155
|
-
if (action) {
|
|
33156
|
-
action.run();
|
|
33157
|
-
return;
|
|
33158
|
-
}
|
|
33159
|
-
if (key.tab || key.downArrow) {
|
|
33160
|
-
setActive((i) => (i + 1) % fields.length);
|
|
33161
|
-
return;
|
|
33162
|
-
}
|
|
33163
|
-
if (key.upArrow) {
|
|
33164
|
-
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
33165
|
-
return;
|
|
33166
|
-
}
|
|
33167
|
-
if (key.return) {
|
|
33168
|
-
setValueBeforeEdit(values[current.key]);
|
|
33169
|
-
setEditing(true);
|
|
33170
|
-
}
|
|
33171
|
-
});
|
|
33172
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33173
|
-
/* @__PURE__ */ jsx55(Text46, { bold: true, children: title }),
|
|
33174
|
-
subtitle && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: subtitle }),
|
|
33175
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33176
|
-
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: fields.map((field, index) => {
|
|
33177
|
-
const isActive = index === active;
|
|
33178
|
-
const value = values[field.key];
|
|
33179
|
-
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
33180
|
-
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33181
|
-
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33182
|
-
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
33183
|
-
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33184
|
-
TextInput4,
|
|
33185
|
-
{
|
|
33186
|
-
value,
|
|
33187
|
-
onChange: (next) => onChange(field.key, next),
|
|
33188
|
-
onSubmit: () => setEditing(false),
|
|
33189
|
-
mask: field.masked ? "\u2022" : void 0
|
|
33190
|
-
}
|
|
33191
|
-
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33192
|
-
field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
33193
|
-
] }, field.key);
|
|
33194
|
-
}) }),
|
|
33195
|
-
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33196
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33197
|
-
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33198
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33199
|
-
" ",
|
|
33200
|
-
notice.text
|
|
33201
|
-
] })
|
|
33202
|
-
] }),
|
|
33203
|
-
footer,
|
|
33204
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33205
|
-
/* @__PURE__ */ jsx55(
|
|
33206
|
-
ControlHints,
|
|
33207
|
-
{
|
|
33208
|
-
hints: editing ? [
|
|
33209
|
-
{ keys: "type", label: "edit" },
|
|
33210
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33211
|
-
{ keys: "\u23CE", label: "done" },
|
|
33212
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33213
|
-
] : [
|
|
33214
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
33215
|
-
{ keys: "\u23CE", label: "edit" },
|
|
33216
|
-
{ keys: "c", label: "clear" },
|
|
33217
|
-
{ keys: "s", label: "save" },
|
|
33218
|
-
...actions.map(({ key, label }) => ({ keys: key, label })),
|
|
33219
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
33220
|
-
]
|
|
33221
|
-
}
|
|
33222
|
-
)
|
|
33223
|
-
] });
|
|
33224
|
-
}
|
|
33225
|
-
var init_FieldForm = __esm({
|
|
33226
|
-
"packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
|
|
33227
|
-
"use strict";
|
|
33228
|
-
init_home_theme();
|
|
33229
|
-
init_control_hints();
|
|
33230
|
-
}
|
|
33231
|
-
});
|
|
33232
|
-
|
|
33233
33110
|
// packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
|
|
33234
33111
|
import { execFile as execFile2 } from "node:child_process";
|
|
33235
33112
|
import { access as access6, constants } from "node:fs/promises";
|
|
@@ -33302,9 +33179,11 @@ async function testAgent(name, binary, model) {
|
|
|
33302
33179
|
}
|
|
33303
33180
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33304
33181
|
}
|
|
33305
|
-
function statusFromChecks(name, checks) {
|
|
33182
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
33306
33183
|
if (checks.length === 0) return "checking";
|
|
33307
|
-
if (checks.some((check) => check.step === "path" && !check.ok))
|
|
33184
|
+
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33185
|
+
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
33186
|
+
}
|
|
33308
33187
|
const login = checks.find((check) => check.step === "login");
|
|
33309
33188
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33310
33189
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -33312,11 +33191,49 @@ function statusFromChecks(name, checks) {
|
|
|
33312
33191
|
return name === "claude" ? "ready" : "unknown";
|
|
33313
33192
|
}
|
|
33314
33193
|
function nextStepHint(name, status) {
|
|
33315
|
-
if (status === "not-
|
|
33194
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set the command path below`;
|
|
33195
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or fix the command path`;
|
|
33316
33196
|
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33317
33197
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33318
33198
|
return "";
|
|
33319
33199
|
}
|
|
33200
|
+
function resolvedPath(checks) {
|
|
33201
|
+
const path5 = checks?.find((check) => check.step === "path");
|
|
33202
|
+
return path5?.ok ? path5.detail : "";
|
|
33203
|
+
}
|
|
33204
|
+
function statusRows(_name, checks, savedBinary) {
|
|
33205
|
+
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
33206
|
+
const find = (step) => checks.find((check) => check.step === step);
|
|
33207
|
+
const path5 = find("path");
|
|
33208
|
+
if (!path5?.ok) {
|
|
33209
|
+
if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
|
|
33210
|
+
return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
|
|
33211
|
+
}
|
|
33212
|
+
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
33213
|
+
const version = find("version");
|
|
33214
|
+
if (version) {
|
|
33215
|
+
rows.push({
|
|
33216
|
+
label: "Version",
|
|
33217
|
+
value: version.ok ? version.detail : "could not be read",
|
|
33218
|
+
tone: version.ok ? "ok" : "muted"
|
|
33219
|
+
});
|
|
33220
|
+
}
|
|
33221
|
+
const login = find("login");
|
|
33222
|
+
const prompt = find("prompt");
|
|
33223
|
+
if (login) {
|
|
33224
|
+
rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
|
|
33225
|
+
} else if (prompt) {
|
|
33226
|
+
rows.push({
|
|
33227
|
+
label: "Login",
|
|
33228
|
+
value: prompt.ok ? "confirmed by the test" : "see the test result",
|
|
33229
|
+
tone: prompt.ok ? "ok" : "bad"
|
|
33230
|
+
});
|
|
33231
|
+
} else {
|
|
33232
|
+
rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
|
|
33233
|
+
}
|
|
33234
|
+
if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
|
|
33235
|
+
return rows;
|
|
33236
|
+
}
|
|
33320
33237
|
async function withBinaryEnv(name, binary, run) {
|
|
33321
33238
|
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33322
33239
|
const previous = process.env[key];
|
|
@@ -33355,89 +33272,43 @@ var init_agent_status = __esm({
|
|
|
33355
33272
|
}
|
|
33356
33273
|
});
|
|
33357
33274
|
|
|
33358
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/
|
|
33359
|
-
import {
|
|
33360
|
-
import {
|
|
33361
|
-
|
|
33362
|
-
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
|
|
33366
|
-
|
|
33367
|
-
}
|
|
33368
|
-
function AgentChecks({
|
|
33369
|
-
name,
|
|
33370
|
-
checks
|
|
33371
|
-
}) {
|
|
33372
|
-
if (!checks) {
|
|
33373
|
-
return /* @__PURE__ */ jsx56(Box45, { marginTop: 1, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Checking..." }) });
|
|
33374
|
-
}
|
|
33375
|
-
const status = statusFromChecks(name, checks);
|
|
33376
|
-
const hint = nextStepHint(name, status);
|
|
33377
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
33378
|
-
/* @__PURE__ */ jsxs46(Text47, { bold: true, children: [
|
|
33379
|
-
"Status: ",
|
|
33380
|
-
/* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] })
|
|
33381
|
-
] }),
|
|
33382
|
-
checks.map((check) => /* @__PURE__ */ jsxs46(Text47, { color: check.ok ? PALETTE.success : PALETTE.muted, children: [
|
|
33383
|
-
check.ok ? "\u2713" : "\xB7",
|
|
33384
|
-
" ",
|
|
33385
|
-
check.step,
|
|
33386
|
-
": ",
|
|
33387
|
-
check.detail
|
|
33388
|
-
] }, check.step)),
|
|
33389
|
-
hint && /* @__PURE__ */ jsxs46(Text47, { color: PALETTE.muted, children: [
|
|
33390
|
-
"Next: ",
|
|
33391
|
-
hint
|
|
33392
|
-
] })
|
|
33275
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
33276
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
33277
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33278
|
+
import TextInput4 from "ink-text-input";
|
|
33279
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33280
|
+
function Section2({ title, children }) {
|
|
33281
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
|
|
33282
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, color: PALETTE.muted, children: title }),
|
|
33283
|
+
children
|
|
33393
33284
|
] });
|
|
33394
33285
|
}
|
|
33395
|
-
|
|
33396
|
-
var init_AgentStatusLine = __esm({
|
|
33397
|
-
"packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusLine.tsx"() {
|
|
33398
|
-
"use strict";
|
|
33399
|
-
init_home_theme();
|
|
33400
|
-
init_agent_status();
|
|
33401
|
-
STATUS_TEXT = {
|
|
33402
|
-
checking: "checking...",
|
|
33403
|
-
ready: "ready",
|
|
33404
|
-
"not-found": "not found",
|
|
33405
|
-
"not-logged-in": "not logged in",
|
|
33406
|
-
unknown: "found, login not checked"
|
|
33407
|
-
};
|
|
33408
|
-
STATUS_COLOR = {
|
|
33409
|
-
checking: PALETTE.muted,
|
|
33410
|
-
ready: PALETTE.success,
|
|
33411
|
-
"not-found": PALETTE.error,
|
|
33412
|
-
"not-logged-in": PALETTE.error,
|
|
33413
|
-
unknown: PALETTE.muted
|
|
33414
|
-
};
|
|
33415
|
-
}
|
|
33416
|
-
});
|
|
33417
|
-
|
|
33418
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
33419
|
-
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
33420
|
-
import { Box as Box46, Text as Text48, useInput as useInput12 } from "ink";
|
|
33421
|
-
import { Fragment as Fragment18, jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33422
|
-
function AgentForm({
|
|
33286
|
+
function AgentDetail({
|
|
33423
33287
|
name,
|
|
33424
33288
|
config,
|
|
33425
33289
|
setConfig,
|
|
33426
33290
|
onBack
|
|
33427
33291
|
}) {
|
|
33428
|
-
const [saving, setSaving] = useState30(false);
|
|
33429
|
-
const [testing, setTesting] = useState30(false);
|
|
33430
|
-
const [notice, setNotice] = useState30(null);
|
|
33431
|
-
const [checks, setChecks] = useState30(void 0);
|
|
33432
33292
|
const settings = config.agents[name];
|
|
33293
|
+
const [focusIndex, setFocusIndex] = useState29(0);
|
|
33294
|
+
const [editing, setEditing] = useState29(false);
|
|
33295
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33296
|
+
const [saving, setSaving] = useState29(false);
|
|
33297
|
+
const [testing, setTesting] = useState29(false);
|
|
33298
|
+
const [notice, setNotice] = useState29(null);
|
|
33299
|
+
const [checks, setChecks] = useState29(void 0);
|
|
33433
33300
|
useEffect22(() => {
|
|
33434
|
-
let
|
|
33301
|
+
let active = true;
|
|
33435
33302
|
setChecks(void 0);
|
|
33436
|
-
void inspectAgent(name, settings.binary).then((result) =>
|
|
33303
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33437
33304
|
return () => {
|
|
33438
|
-
|
|
33305
|
+
active = false;
|
|
33439
33306
|
};
|
|
33440
33307
|
}, [name, settings.binary]);
|
|
33308
|
+
const setField = (field, value) => {
|
|
33309
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
|
|
33310
|
+
setNotice(null);
|
|
33311
|
+
};
|
|
33441
33312
|
const save = () => {
|
|
33442
33313
|
setSaving(true);
|
|
33443
33314
|
setNotice(null);
|
|
@@ -33448,7 +33319,7 @@ function AgentForm({
|
|
|
33448
33319
|
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
|
|
33449
33320
|
).finally(() => setSaving(false));
|
|
33450
33321
|
};
|
|
33451
|
-
const
|
|
33322
|
+
const runTest = () => {
|
|
33452
33323
|
setTesting(true);
|
|
33453
33324
|
setNotice(null);
|
|
33454
33325
|
setChecks(void 0);
|
|
@@ -33456,26 +33327,174 @@ function AgentForm({
|
|
|
33456
33327
|
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "The test could not run" })
|
|
33457
33328
|
).finally(() => setTesting(false));
|
|
33458
33329
|
};
|
|
33459
|
-
|
|
33460
|
-
|
|
33461
|
-
|
|
33462
|
-
|
|
33463
|
-
|
|
33464
|
-
|
|
33465
|
-
|
|
33466
|
-
|
|
33467
|
-
|
|
33468
|
-
|
|
33469
|
-
},
|
|
33470
|
-
onSave: save,
|
|
33471
|
-
onQuit: onBack,
|
|
33472
|
-
notice,
|
|
33473
|
-
busy: saving || testing,
|
|
33474
|
-
footer: /* @__PURE__ */ jsx57(AgentChecks, { name, checks }),
|
|
33475
|
-
actions: [{ key: "t", label: "full test (uses a few tokens)", run: runFullTest }]
|
|
33330
|
+
const focused = FOCUS_ORDER[focusIndex];
|
|
33331
|
+
const focusedField = focused === "test" ? null : focused;
|
|
33332
|
+
useInput11((input, key) => {
|
|
33333
|
+
if (saving || testing) return;
|
|
33334
|
+
if (editing) {
|
|
33335
|
+
if (key.escape && focusedField) {
|
|
33336
|
+
setField(focusedField, valueBeforeEdit);
|
|
33337
|
+
setEditing(false);
|
|
33338
|
+
}
|
|
33339
|
+
return;
|
|
33476
33340
|
}
|
|
33477
|
-
|
|
33341
|
+
if (key.escape || input === "q") {
|
|
33342
|
+
onBack();
|
|
33343
|
+
return;
|
|
33344
|
+
}
|
|
33345
|
+
if (input === "s") {
|
|
33346
|
+
save();
|
|
33347
|
+
return;
|
|
33348
|
+
}
|
|
33349
|
+
if (key.upArrow) {
|
|
33350
|
+
setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
|
|
33351
|
+
return;
|
|
33352
|
+
}
|
|
33353
|
+
if (key.downArrow || key.tab) {
|
|
33354
|
+
setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
|
|
33355
|
+
return;
|
|
33356
|
+
}
|
|
33357
|
+
if (input === "c" && focusedField) {
|
|
33358
|
+
setField(focusedField, "");
|
|
33359
|
+
return;
|
|
33360
|
+
}
|
|
33361
|
+
if (key.return) {
|
|
33362
|
+
if (focusedField) {
|
|
33363
|
+
setValueBeforeEdit(settings[focusedField]);
|
|
33364
|
+
setEditing(true);
|
|
33365
|
+
} else {
|
|
33366
|
+
runTest();
|
|
33367
|
+
}
|
|
33368
|
+
}
|
|
33369
|
+
});
|
|
33370
|
+
const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
|
|
33371
|
+
const hint = nextStepHint(name, status);
|
|
33372
|
+
const pointer = (isFocused) => /* @__PURE__ */ jsx55(Text46, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
33373
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33374
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: AGENT_LABELS[name] }),
|
|
33375
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
|
|
33376
|
+
/* @__PURE__ */ jsxs45(Section2, { title: "STATUS", children: [
|
|
33377
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsxs45(Box44, { gap: 1, paddingLeft: 2, children: [
|
|
33378
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: row.label }) }),
|
|
33379
|
+
/* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[row.tone], children: row.value })
|
|
33380
|
+
] }, row.label)),
|
|
33381
|
+
hint && /* @__PURE__ */ jsx55(Box44, { paddingLeft: 2, children: /* @__PURE__ */ jsxs45(Text46, { color: PALETTE.muted, children: [
|
|
33382
|
+
"Next: ",
|
|
33383
|
+
hint
|
|
33384
|
+
] }) })
|
|
33385
|
+
] }),
|
|
33386
|
+
/* @__PURE__ */ jsx55(Section2, { title: "SETTINGS", children: FIELDS2.map((field) => {
|
|
33387
|
+
const isFocused = focused === field;
|
|
33388
|
+
const value = settings[field];
|
|
33389
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33390
|
+
pointer(isFocused),
|
|
33391
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: FIELD_LABEL[field] }) }),
|
|
33392
|
+
isFocused && editing ? /* @__PURE__ */ jsx55(
|
|
33393
|
+
TextInput4,
|
|
33394
|
+
{
|
|
33395
|
+
value,
|
|
33396
|
+
onChange: (next) => setField(field, next),
|
|
33397
|
+
onSubmit: () => setEditing(false)
|
|
33398
|
+
}
|
|
33399
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: true, children: value }),
|
|
33400
|
+
!value && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: fieldHint(name, field) })
|
|
33401
|
+
] }, field);
|
|
33402
|
+
}) }),
|
|
33403
|
+
/* @__PURE__ */ jsx55(Section2, { title: "ACTIONS", children: /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33404
|
+
pointer(focused === "test"),
|
|
33405
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: focused === "test", color: focused === "test" ? PALETTE.accent : PALETTE.muted, children: "Run test" }) }),
|
|
33406
|
+
/* @__PURE__ */ jsx55(Text46, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
|
|
33407
|
+
] }) }),
|
|
33408
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33409
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33410
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33411
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33412
|
+
" ",
|
|
33413
|
+
notice.text
|
|
33414
|
+
] })
|
|
33415
|
+
] }),
|
|
33416
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33417
|
+
/* @__PURE__ */ jsx55(
|
|
33418
|
+
ControlHints,
|
|
33419
|
+
{
|
|
33420
|
+
hints: editing ? [
|
|
33421
|
+
{ keys: "type", label: "edit" },
|
|
33422
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33423
|
+
{ keys: "\u23CE", label: "done" },
|
|
33424
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33425
|
+
] : [
|
|
33426
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33427
|
+
{ keys: "\u23CE", label: focusedField ? "edit" : "run test" },
|
|
33428
|
+
...focusedField ? [{ keys: "c", label: "clear" }] : [],
|
|
33429
|
+
{ keys: "s", label: "save" },
|
|
33430
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
33431
|
+
]
|
|
33432
|
+
}
|
|
33433
|
+
)
|
|
33434
|
+
] });
|
|
33478
33435
|
}
|
|
33436
|
+
var FOCUS_ORDER, FIELDS2, FIELD_LABEL, LABEL_WIDTH, TONE_COLOR, fieldHint;
|
|
33437
|
+
var init_AgentDetail = __esm({
|
|
33438
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx"() {
|
|
33439
|
+
"use strict";
|
|
33440
|
+
init_home_theme();
|
|
33441
|
+
init_control_hints();
|
|
33442
|
+
init_agent_store();
|
|
33443
|
+
init_agent_status();
|
|
33444
|
+
init_apply_binary_overrides();
|
|
33445
|
+
FOCUS_ORDER = ["binary", "model", "test"];
|
|
33446
|
+
FIELDS2 = ["binary", "model"];
|
|
33447
|
+
FIELD_LABEL = { binary: "Command path", model: "Model" };
|
|
33448
|
+
LABEL_WIDTH = "Command path".length;
|
|
33449
|
+
TONE_COLOR = {
|
|
33450
|
+
ok: PALETTE.success,
|
|
33451
|
+
bad: PALETTE.error,
|
|
33452
|
+
muted: PALETTE.muted
|
|
33453
|
+
};
|
|
33454
|
+
fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
|
|
33455
|
+
}
|
|
33456
|
+
});
|
|
33457
|
+
|
|
33458
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
|
|
33459
|
+
import { Text as Text47 } from "ink";
|
|
33460
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
33461
|
+
function AgentStatusBadge({
|
|
33462
|
+
name,
|
|
33463
|
+
checks,
|
|
33464
|
+
binary
|
|
33465
|
+
}) {
|
|
33466
|
+
const status = checks ? statusFromChecks(name, checks, binary) : "checking";
|
|
33467
|
+
return /* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] });
|
|
33468
|
+
}
|
|
33469
|
+
var STATUS_TEXT, STATUS_COLOR;
|
|
33470
|
+
var init_AgentStatusBadge = __esm({
|
|
33471
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx"() {
|
|
33472
|
+
"use strict";
|
|
33473
|
+
init_home_theme();
|
|
33474
|
+
init_agent_status();
|
|
33475
|
+
STATUS_TEXT = {
|
|
33476
|
+
checking: "checking...",
|
|
33477
|
+
ready: "ready",
|
|
33478
|
+
"not-configured": "not configured",
|
|
33479
|
+
"not-found": "not found",
|
|
33480
|
+
"not-logged-in": "not logged in",
|
|
33481
|
+
unknown: "found, login not checked"
|
|
33482
|
+
};
|
|
33483
|
+
STATUS_COLOR = {
|
|
33484
|
+
checking: PALETTE.muted,
|
|
33485
|
+
ready: PALETTE.success,
|
|
33486
|
+
"not-configured": PALETTE.muted,
|
|
33487
|
+
"not-found": PALETTE.error,
|
|
33488
|
+
"not-logged-in": PALETTE.error,
|
|
33489
|
+
unknown: PALETTE.muted
|
|
33490
|
+
};
|
|
33491
|
+
}
|
|
33492
|
+
});
|
|
33493
|
+
|
|
33494
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
33495
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
33496
|
+
import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
|
|
33497
|
+
import { Fragment as Fragment18, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33479
33498
|
function AgentsScreen({ onDone }) {
|
|
33480
33499
|
const [config, setConfig] = useState30(null);
|
|
33481
33500
|
const [focus, setFocus] = useState30(0);
|
|
@@ -33489,7 +33508,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33489
33508
|
);
|
|
33490
33509
|
}
|
|
33491
33510
|
};
|
|
33492
|
-
|
|
33511
|
+
useEffect23(() => {
|
|
33493
33512
|
void readAgentConfig().then((loaded) => {
|
|
33494
33513
|
setConfig(loaded);
|
|
33495
33514
|
inspectAll(loaded);
|
|
@@ -33540,7 +33559,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33540
33559
|
}
|
|
33541
33560
|
});
|
|
33542
33561
|
if (!config) {
|
|
33543
|
-
return /* @__PURE__ */
|
|
33562
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33544
33563
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33545
33564
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33546
33565
|
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
@@ -33548,7 +33567,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33548
33567
|
}
|
|
33549
33568
|
if (open) {
|
|
33550
33569
|
return /* @__PURE__ */ jsx57(
|
|
33551
|
-
|
|
33570
|
+
AgentDetail,
|
|
33552
33571
|
{
|
|
33553
33572
|
name: open,
|
|
33554
33573
|
config,
|
|
@@ -33563,32 +33582,32 @@ function AgentsScreen({ onDone }) {
|
|
|
33563
33582
|
}
|
|
33564
33583
|
);
|
|
33565
33584
|
}
|
|
33566
|
-
return /* @__PURE__ */
|
|
33585
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33567
33586
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33568
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and
|
|
33587
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
|
|
33569
33588
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33570
33589
|
ROWS.map((row, index) => {
|
|
33571
33590
|
const isFocused = index === focus;
|
|
33572
33591
|
const pointer = /* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
33573
33592
|
if (row.kind === "default") {
|
|
33574
|
-
return /* @__PURE__ */ jsx57(
|
|
33593
|
+
return /* @__PURE__ */ jsx57(Box45, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33575
33594
|
pointer,
|
|
33576
33595
|
/* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: "Default agent" }),
|
|
33577
33596
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: `\u2039 ${AGENT_LABELS[config.defaultAgent]} \u203A` })
|
|
33578
33597
|
] }) }, "default");
|
|
33579
33598
|
}
|
|
33580
|
-
const
|
|
33581
|
-
return /* @__PURE__ */
|
|
33599
|
+
const saved = config.agents[row.name].binary;
|
|
33600
|
+
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33582
33601
|
pointer,
|
|
33583
|
-
/* @__PURE__ */ jsx57(
|
|
33584
|
-
/* @__PURE__ */ jsx57(
|
|
33585
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children:
|
|
33602
|
+
/* @__PURE__ */ jsx57(Box45, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[row.name] }) }),
|
|
33603
|
+
/* @__PURE__ */ jsx57(Box45, { width: 26, flexShrink: 0, children: /* @__PURE__ */ jsx57(AgentStatusBadge, { name: row.name, checks: checks[row.name], binary: saved }) }),
|
|
33604
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: shortenPath(resolvedPath(checks[row.name]) || saved) }),
|
|
33586
33605
|
row.name === config.defaultAgent && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: "(default)" })
|
|
33587
33606
|
] }, row.name);
|
|
33588
33607
|
}),
|
|
33589
|
-
notice && /* @__PURE__ */
|
|
33608
|
+
notice && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
33590
33609
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33591
|
-
/* @__PURE__ */
|
|
33610
|
+
/* @__PURE__ */ jsxs46(Text48, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33592
33611
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33593
33612
|
" ",
|
|
33594
33613
|
notice.text
|
|
@@ -33611,7 +33630,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33611
33630
|
)
|
|
33612
33631
|
] });
|
|
33613
33632
|
}
|
|
33614
|
-
var
|
|
33633
|
+
var ROWS, MAX_PATH_WIDTH, shortenPath;
|
|
33615
33634
|
var init_AgentScreens = __esm({
|
|
33616
33635
|
"packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx"() {
|
|
33617
33636
|
"use strict";
|
|
@@ -33619,16 +33638,129 @@ var init_AgentScreens = __esm({
|
|
|
33619
33638
|
init_home_theme();
|
|
33620
33639
|
init_control_hints();
|
|
33621
33640
|
init_debug_store();
|
|
33622
|
-
init_FieldForm();
|
|
33623
33641
|
init_agent_store();
|
|
33624
33642
|
init_agent_status();
|
|
33625
|
-
|
|
33626
|
-
|
|
33627
|
-
agentFields = (name) => [
|
|
33628
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` },
|
|
33629
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33630
|
-
];
|
|
33643
|
+
init_AgentDetail();
|
|
33644
|
+
init_AgentStatusBadge();
|
|
33631
33645
|
ROWS = [{ kind: "default" }, ...AGENT_NAMES.map((name) => ({ kind: "agent", name }))];
|
|
33646
|
+
MAX_PATH_WIDTH = 44;
|
|
33647
|
+
shortenPath = (path5) => path5.length > MAX_PATH_WIDTH ? `\u2026${path5.slice(-(MAX_PATH_WIDTH - 1))}` : path5;
|
|
33648
|
+
}
|
|
33649
|
+
});
|
|
33650
|
+
|
|
33651
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
33652
|
+
import { useState as useState31 } from "react";
|
|
33653
|
+
import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
|
|
33654
|
+
import TextInput5 from "ink-text-input";
|
|
33655
|
+
import { Fragment as Fragment19, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33656
|
+
function FieldForm({
|
|
33657
|
+
title,
|
|
33658
|
+
subtitle,
|
|
33659
|
+
fields,
|
|
33660
|
+
values,
|
|
33661
|
+
onChange,
|
|
33662
|
+
onSave,
|
|
33663
|
+
onQuit,
|
|
33664
|
+
notice,
|
|
33665
|
+
busy = false,
|
|
33666
|
+
footer
|
|
33667
|
+
}) {
|
|
33668
|
+
const [active, setActive] = useState31(0);
|
|
33669
|
+
const [editing, setEditing] = useState31(false);
|
|
33670
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
|
|
33671
|
+
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
33672
|
+
const current = fields[active];
|
|
33673
|
+
useInput13((input, key) => {
|
|
33674
|
+
if (busy) return;
|
|
33675
|
+
if (editing) {
|
|
33676
|
+
if (key.escape) {
|
|
33677
|
+
onChange(current.key, valueBeforeEdit);
|
|
33678
|
+
setEditing(false);
|
|
33679
|
+
}
|
|
33680
|
+
return;
|
|
33681
|
+
}
|
|
33682
|
+
if (key.escape || input === "q") {
|
|
33683
|
+
onQuit();
|
|
33684
|
+
return;
|
|
33685
|
+
}
|
|
33686
|
+
if (input === "s") {
|
|
33687
|
+
onSave();
|
|
33688
|
+
return;
|
|
33689
|
+
}
|
|
33690
|
+
if (input === "c") {
|
|
33691
|
+
onChange(current.key, "");
|
|
33692
|
+
return;
|
|
33693
|
+
}
|
|
33694
|
+
if (key.tab || key.downArrow) {
|
|
33695
|
+
setActive((i) => (i + 1) % fields.length);
|
|
33696
|
+
return;
|
|
33697
|
+
}
|
|
33698
|
+
if (key.upArrow) {
|
|
33699
|
+
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
33700
|
+
return;
|
|
33701
|
+
}
|
|
33702
|
+
if (key.return) {
|
|
33703
|
+
setValueBeforeEdit(values[current.key]);
|
|
33704
|
+
setEditing(true);
|
|
33705
|
+
}
|
|
33706
|
+
});
|
|
33707
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33708
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
|
|
33709
|
+
subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
|
|
33710
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33711
|
+
/* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
|
|
33712
|
+
const isActive = index === active;
|
|
33713
|
+
const value = values[field.key];
|
|
33714
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
33715
|
+
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33716
|
+
/* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33717
|
+
/* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
33718
|
+
isActive && editing ? /* @__PURE__ */ jsx58(
|
|
33719
|
+
TextInput5,
|
|
33720
|
+
{
|
|
33721
|
+
value,
|
|
33722
|
+
onChange: (next) => onChange(field.key, next),
|
|
33723
|
+
onSubmit: () => setEditing(false),
|
|
33724
|
+
mask: field.masked ? "\u2022" : void 0
|
|
33725
|
+
}
|
|
33726
|
+
) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33727
|
+
field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
|
|
33728
|
+
] }, field.key);
|
|
33729
|
+
}) }),
|
|
33730
|
+
notice && /* @__PURE__ */ jsxs47(Fragment19, { children: [
|
|
33731
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33732
|
+
/* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33733
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33734
|
+
" ",
|
|
33735
|
+
notice.text
|
|
33736
|
+
] })
|
|
33737
|
+
] }),
|
|
33738
|
+
footer,
|
|
33739
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33740
|
+
/* @__PURE__ */ jsx58(
|
|
33741
|
+
ControlHints,
|
|
33742
|
+
{
|
|
33743
|
+
hints: editing ? [
|
|
33744
|
+
{ keys: "type", label: "edit" },
|
|
33745
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33746
|
+
{ keys: "\u23CE", label: "done" },
|
|
33747
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33748
|
+
] : [
|
|
33749
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33750
|
+
{ keys: "\u23CE", label: "edit" },
|
|
33751
|
+
{ keys: "c", label: "clear" },
|
|
33752
|
+
{ keys: "s", label: "save" },
|
|
33753
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
33754
|
+
]
|
|
33755
|
+
}
|
|
33756
|
+
)
|
|
33757
|
+
] });
|
|
33758
|
+
}
|
|
33759
|
+
var init_FieldForm = __esm({
|
|
33760
|
+
"packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
|
|
33761
|
+
"use strict";
|
|
33762
|
+
init_home_theme();
|
|
33763
|
+
init_control_hints();
|
|
33632
33764
|
}
|
|
33633
33765
|
});
|
|
33634
33766
|
|
|
@@ -33664,9 +33796,9 @@ var init_config_store = __esm({
|
|
|
33664
33796
|
});
|
|
33665
33797
|
|
|
33666
33798
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
33667
|
-
import { useEffect as
|
|
33668
|
-
import { Box as Box47, Text as
|
|
33669
|
-
import { jsx as
|
|
33799
|
+
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
33800
|
+
import { Box as Box47, Text as Text50 } from "ink";
|
|
33801
|
+
import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33670
33802
|
function debugFields(config) {
|
|
33671
33803
|
return {
|
|
33672
33804
|
space_id: config?.spaceId ?? "",
|
|
@@ -33679,11 +33811,11 @@ function debugFields(config) {
|
|
|
33679
33811
|
};
|
|
33680
33812
|
}
|
|
33681
33813
|
function ProjectConfigScreen({ onDone }) {
|
|
33682
|
-
const [config, setConfig] =
|
|
33683
|
-
const [saving, setSaving] =
|
|
33684
|
-
const [notice, setNotice] =
|
|
33685
|
-
const [lastSaved, setLastSaved] =
|
|
33686
|
-
|
|
33814
|
+
const [config, setConfig] = useState32(null);
|
|
33815
|
+
const [saving, setSaving] = useState32(false);
|
|
33816
|
+
const [notice, setNotice] = useState32(null);
|
|
33817
|
+
const [lastSaved, setLastSaved] = useState32(null);
|
|
33818
|
+
useEffect24(() => {
|
|
33687
33819
|
void readCredentials().then((cfg) => {
|
|
33688
33820
|
setConfig(cfg);
|
|
33689
33821
|
startDebugRun({
|
|
@@ -33696,9 +33828,9 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
33696
33828
|
}, []);
|
|
33697
33829
|
if (!config) {
|
|
33698
33830
|
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33699
|
-
/* @__PURE__ */
|
|
33700
|
-
/* @__PURE__ */
|
|
33701
|
-
/* @__PURE__ */
|
|
33831
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
|
|
33832
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33833
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
|
|
33702
33834
|
] });
|
|
33703
33835
|
}
|
|
33704
33836
|
const save = () => {
|
|
@@ -33718,12 +33850,12 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
33718
33850
|
);
|
|
33719
33851
|
onDone();
|
|
33720
33852
|
};
|
|
33721
|
-
return /* @__PURE__ */
|
|
33853
|
+
return /* @__PURE__ */ jsx59(
|
|
33722
33854
|
FieldForm,
|
|
33723
33855
|
{
|
|
33724
33856
|
title: "Project",
|
|
33725
33857
|
subtitle: "The Contentful space and where the CLI keeps its files.",
|
|
33726
|
-
fields:
|
|
33858
|
+
fields: FIELDS3,
|
|
33727
33859
|
values: valuesOf(config),
|
|
33728
33860
|
onChange: (key, value) => {
|
|
33729
33861
|
setConfig({ ...config, [key]: value });
|
|
@@ -33736,7 +33868,7 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
33736
33868
|
}
|
|
33737
33869
|
);
|
|
33738
33870
|
}
|
|
33739
|
-
var
|
|
33871
|
+
var FIELDS3, valuesOf;
|
|
33740
33872
|
var init_ProjectConfigScreen = __esm({
|
|
33741
33873
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx"() {
|
|
33742
33874
|
"use strict";
|
|
@@ -33744,7 +33876,7 @@ var init_ProjectConfigScreen = __esm({
|
|
|
33744
33876
|
init_debug_store();
|
|
33745
33877
|
init_FieldForm();
|
|
33746
33878
|
init_config_store();
|
|
33747
|
-
|
|
33879
|
+
FIELDS3 = [
|
|
33748
33880
|
{ key: "spaceId", label: "Space ID" },
|
|
33749
33881
|
{ key: "environmentId", label: "Environment ID" },
|
|
33750
33882
|
{ key: "cmaToken", label: "CMA Token", masked: true },
|
|
@@ -33753,19 +33885,19 @@ var init_ProjectConfigScreen = __esm({
|
|
|
33753
33885
|
{ key: "defaultTokenFile", label: "Default token file" },
|
|
33754
33886
|
{ key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
|
|
33755
33887
|
];
|
|
33756
|
-
valuesOf = (config) => Object.fromEntries(
|
|
33888
|
+
valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
33757
33889
|
}
|
|
33758
33890
|
});
|
|
33759
33891
|
|
|
33760
33892
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
33761
|
-
import { useState as
|
|
33762
|
-
import { Box as Box48, Text as
|
|
33763
|
-
import { jsx as
|
|
33893
|
+
import { useState as useState33 } from "react";
|
|
33894
|
+
import { Box as Box48, Text as Text51, useInput as useInput14 } from "ink";
|
|
33895
|
+
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33764
33896
|
function ConfigurationScreen({ onDone }) {
|
|
33765
|
-
const [focus, setFocus] =
|
|
33766
|
-
const [open, setOpen] =
|
|
33897
|
+
const [focus, setFocus] = useState33(0);
|
|
33898
|
+
const [open, setOpen] = useState33(null);
|
|
33767
33899
|
const close = () => setOpen(null);
|
|
33768
|
-
|
|
33900
|
+
useInput14((input, key) => {
|
|
33769
33901
|
if (open) return;
|
|
33770
33902
|
if (key.upArrow) {
|
|
33771
33903
|
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
@@ -33781,18 +33913,18 @@ function ConfigurationScreen({ onDone }) {
|
|
|
33781
33913
|
}
|
|
33782
33914
|
if (key.escape || input === "q") onDone();
|
|
33783
33915
|
});
|
|
33784
|
-
if (open === "project") return /* @__PURE__ */
|
|
33785
|
-
if (open === "agents") return /* @__PURE__ */
|
|
33916
|
+
if (open === "project") return /* @__PURE__ */ jsx60(ProjectConfigScreen, { onDone: close });
|
|
33917
|
+
if (open === "agents") return /* @__PURE__ */ jsx60(AgentsScreen, { onDone: close });
|
|
33786
33918
|
return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33787
|
-
/* @__PURE__ */
|
|
33788
|
-
/* @__PURE__ */
|
|
33919
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, children: "Configuration" }),
|
|
33920
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33789
33921
|
SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
|
|
33790
|
-
/* @__PURE__ */
|
|
33791
|
-
/* @__PURE__ */
|
|
33792
|
-
/* @__PURE__ */
|
|
33922
|
+
/* @__PURE__ */ jsx60(Text51, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
|
|
33923
|
+
/* @__PURE__ */ jsx60(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx60(Text51, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
|
|
33924
|
+
/* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: section.description })
|
|
33793
33925
|
] }, section.id)),
|
|
33794
|
-
/* @__PURE__ */
|
|
33795
|
-
/* @__PURE__ */
|
|
33926
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33927
|
+
/* @__PURE__ */ jsx60(
|
|
33796
33928
|
ControlHints,
|
|
33797
33929
|
{
|
|
33798
33930
|
hints: [
|
|
@@ -33824,13 +33956,13 @@ var init_ContentfulConfigScreen = __esm({
|
|
|
33824
33956
|
});
|
|
33825
33957
|
|
|
33826
33958
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33827
|
-
import { useEffect as
|
|
33828
|
-
import { Box as Box49, Text as
|
|
33829
|
-
import { Fragment as
|
|
33959
|
+
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
33960
|
+
import { Box as Box49, Text as Text52, useInput as useInput15 } from "ink";
|
|
33961
|
+
import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
33830
33962
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33831
|
-
const [loading, setLoading] =
|
|
33832
|
-
const [enabled, setEnabled] =
|
|
33833
|
-
|
|
33963
|
+
const [loading, setLoading] = useState34(true);
|
|
33964
|
+
const [enabled, setEnabled] = useState34(true);
|
|
33965
|
+
useEffect25(() => {
|
|
33834
33966
|
readAnalyticsSetting().then((setting) => {
|
|
33835
33967
|
setEnabled(setting.enabled);
|
|
33836
33968
|
setLoading(false);
|
|
@@ -33842,7 +33974,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33842
33974
|
});
|
|
33843
33975
|
});
|
|
33844
33976
|
}, []);
|
|
33845
|
-
|
|
33977
|
+
useInput15((input, key) => {
|
|
33846
33978
|
if (loading) return;
|
|
33847
33979
|
if (key.return || input === " ") {
|
|
33848
33980
|
setEnabled((current) => {
|
|
@@ -33858,20 +33990,20 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33858
33990
|
}
|
|
33859
33991
|
});
|
|
33860
33992
|
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33861
|
-
/* @__PURE__ */
|
|
33862
|
-
/* @__PURE__ */
|
|
33863
|
-
loading ? /* @__PURE__ */
|
|
33864
|
-
/* @__PURE__ */ jsxs50(
|
|
33993
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33994
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33995
|
+
loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment20, { children: [
|
|
33996
|
+
/* @__PURE__ */ jsxs50(Text52, { children: [
|
|
33865
33997
|
"Share anonymous usage data:",
|
|
33866
33998
|
" ",
|
|
33867
|
-
/* @__PURE__ */
|
|
33999
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33868
34000
|
] }),
|
|
33869
|
-
/* @__PURE__ */
|
|
33870
|
-
/* @__PURE__ */
|
|
33871
|
-
/* @__PURE__ */
|
|
34001
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
34002
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
34003
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
33872
34004
|
] }),
|
|
33873
|
-
/* @__PURE__ */
|
|
33874
|
-
/* @__PURE__ */
|
|
34005
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
34006
|
+
/* @__PURE__ */ jsx61(
|
|
33875
34007
|
ControlHints,
|
|
33876
34008
|
{
|
|
33877
34009
|
hints: [
|
|
@@ -33893,12 +34025,12 @@ var init_screen11 = __esm({
|
|
|
33893
34025
|
});
|
|
33894
34026
|
|
|
33895
34027
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
33896
|
-
import { useEffect as
|
|
33897
|
-
import { Box as Box50, Text as
|
|
33898
|
-
import { jsx as
|
|
34028
|
+
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
34029
|
+
import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
|
|
34030
|
+
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
33899
34031
|
function UpgradeScreen({ onDone }) {
|
|
33900
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
33901
|
-
|
|
34032
|
+
const [upgradeCheck, setUpgradeCheck] = useState35();
|
|
34033
|
+
useEffect26(() => {
|
|
33902
34034
|
startDebugRun({
|
|
33903
34035
|
flow: "upgrade",
|
|
33904
34036
|
step: "01-upgrade",
|
|
@@ -33907,7 +34039,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
33907
34039
|
});
|
|
33908
34040
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
33909
34041
|
}, []);
|
|
33910
|
-
|
|
34042
|
+
useInput16((_input, key) => {
|
|
33911
34043
|
if (key.return) {
|
|
33912
34044
|
void finishDebugRun({
|
|
33913
34045
|
outputs: upgradeCheck ?? {},
|
|
@@ -33919,11 +34051,11 @@ function UpgradeScreen({ onDone }) {
|
|
|
33919
34051
|
}
|
|
33920
34052
|
});
|
|
33921
34053
|
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33922
|
-
/* @__PURE__ */
|
|
33923
|
-
/* @__PURE__ */
|
|
34054
|
+
/* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
|
|
34055
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
33924
34056
|
renderBody(upgradeCheck),
|
|
33925
|
-
/* @__PURE__ */
|
|
33926
|
-
/* @__PURE__ */ jsxs51(
|
|
34057
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34058
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
|
|
33927
34059
|
FOCUS_MARKER,
|
|
33928
34060
|
" Go Back"
|
|
33929
34061
|
] })
|
|
@@ -33931,34 +34063,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
33931
34063
|
}
|
|
33932
34064
|
function renderBody(upgradeCheck) {
|
|
33933
34065
|
if (!upgradeCheck) {
|
|
33934
|
-
return /* @__PURE__ */
|
|
34066
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
33935
34067
|
}
|
|
33936
34068
|
if (upgradeCheck.status === "error") {
|
|
33937
|
-
return /* @__PURE__ */
|
|
34069
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
33938
34070
|
}
|
|
33939
34071
|
if (upgradeCheck.status === "up-to-date") {
|
|
33940
|
-
return /* @__PURE__ */ jsxs51(
|
|
34072
|
+
return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
|
|
33941
34073
|
"You're already on the latest version (v",
|
|
33942
34074
|
upgradeCheck.current,
|
|
33943
34075
|
")."
|
|
33944
34076
|
] });
|
|
33945
34077
|
}
|
|
33946
34078
|
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
|
|
33947
|
-
/* @__PURE__ */ jsxs51(
|
|
33948
|
-
/* @__PURE__ */ jsxs51(
|
|
34079
|
+
/* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
|
|
34080
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
|
|
33949
34081
|
"v",
|
|
33950
34082
|
upgradeCheck.latest
|
|
33951
34083
|
] }),
|
|
33952
34084
|
" ",
|
|
33953
34085
|
"is available (you're on ",
|
|
33954
|
-
/* @__PURE__ */ jsxs51(
|
|
34086
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
|
|
33955
34087
|
"v",
|
|
33956
34088
|
upgradeCheck.current
|
|
33957
34089
|
] }),
|
|
33958
34090
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
33959
34091
|
] }),
|
|
33960
|
-
/* @__PURE__ */
|
|
33961
|
-
/* @__PURE__ */
|
|
34092
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34093
|
+
/* @__PURE__ */ jsx62(Box50, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx62(Text53, { bold: true, children: cmd }, cmd)) })
|
|
33962
34094
|
] });
|
|
33963
34095
|
}
|
|
33964
34096
|
var UPGRADE_COMMANDS;
|
|
@@ -33973,13 +34105,13 @@ var init_PageContainer4 = __esm({
|
|
|
33973
34105
|
});
|
|
33974
34106
|
|
|
33975
34107
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
33976
|
-
import { useEffect as
|
|
33977
|
-
import { Box as Box51, Text as
|
|
33978
|
-
import { jsx as
|
|
34108
|
+
import { useEffect as useEffect27, useState as useState36 } from "react";
|
|
34109
|
+
import { Box as Box51, Text as Text54, useInput as useInput17 } from "ink";
|
|
34110
|
+
import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
33979
34111
|
function DebugModeScreen({ onDone }) {
|
|
33980
|
-
const [loading, setLoading] =
|
|
33981
|
-
const [enabled, setEnabled] =
|
|
33982
|
-
|
|
34112
|
+
const [loading, setLoading] = useState36(true);
|
|
34113
|
+
const [enabled, setEnabled] = useState36(true);
|
|
34114
|
+
useEffect27(() => {
|
|
33983
34115
|
readDebugModeSetting().then((setting) => {
|
|
33984
34116
|
setEnabled(setting.enabled);
|
|
33985
34117
|
setLoading(false);
|
|
@@ -33991,7 +34123,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
33991
34123
|
});
|
|
33992
34124
|
});
|
|
33993
34125
|
}, []);
|
|
33994
|
-
|
|
34126
|
+
useInput17((input, key) => {
|
|
33995
34127
|
if (loading) return;
|
|
33996
34128
|
if (key.return || input === " ") {
|
|
33997
34129
|
setEnabled((current) => {
|
|
@@ -34007,15 +34139,15 @@ function DebugModeScreen({ onDone }) {
|
|
|
34007
34139
|
}
|
|
34008
34140
|
});
|
|
34009
34141
|
return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
34010
|
-
/* @__PURE__ */
|
|
34011
|
-
/* @__PURE__ */
|
|
34012
|
-
loading ? /* @__PURE__ */
|
|
34142
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
34143
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
34144
|
+
loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
|
|
34013
34145
|
"Debug logging:",
|
|
34014
34146
|
" ",
|
|
34015
|
-
/* @__PURE__ */
|
|
34147
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
34016
34148
|
] }),
|
|
34017
|
-
/* @__PURE__ */
|
|
34018
|
-
/* @__PURE__ */
|
|
34149
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
34150
|
+
/* @__PURE__ */ jsx63(
|
|
34019
34151
|
ControlHints,
|
|
34020
34152
|
{
|
|
34021
34153
|
hints: [
|
|
@@ -34042,19 +34174,19 @@ __export(app_exports, {
|
|
|
34042
34174
|
runApp: () => runApp
|
|
34043
34175
|
});
|
|
34044
34176
|
import { join as join28 } from "node:path";
|
|
34045
|
-
import { useEffect as
|
|
34046
|
-
import { Fragment as
|
|
34177
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
34178
|
+
import { Fragment as Fragment21, jsx as jsx64 } from "react/jsx-runtime";
|
|
34047
34179
|
function App({ importOptions, inkClear }) {
|
|
34048
|
-
const [screen, setScreen] =
|
|
34049
|
-
const [importExitCode, setImportExitCode] =
|
|
34180
|
+
const [screen, setScreen] = useState37("start");
|
|
34181
|
+
const [importExitCode, setImportExitCode] = useState37();
|
|
34050
34182
|
const showImportResult = importExitCode !== void 0;
|
|
34051
|
-
const [projectPath, setProjectPath] =
|
|
34052
|
-
const [tokensPath, setTokensPath] =
|
|
34053
|
-
const [scannedFiles, setScannedFiles] =
|
|
34054
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
34055
|
-
const [extractionRun, setExtractionRun] =
|
|
34183
|
+
const [projectPath, setProjectPath] = useState37();
|
|
34184
|
+
const [tokensPath, setTokensPath] = useState37();
|
|
34185
|
+
const [scannedFiles, setScannedFiles] = useState37();
|
|
34186
|
+
const [pendingLaunch, setPendingLaunch] = useState37();
|
|
34187
|
+
const [extractionRun, setExtractionRun] = useState37();
|
|
34056
34188
|
const extraction = useExtraction(extractionRun?.input);
|
|
34057
|
-
const [scopeRun, setScopeRun] =
|
|
34189
|
+
const [scopeRun, setScopeRun] = useState37();
|
|
34058
34190
|
const scopeFlow = useScopeGateFlow(
|
|
34059
34191
|
scopeRun && {
|
|
34060
34192
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -34069,12 +34201,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34069
34201
|
}
|
|
34070
34202
|
}
|
|
34071
34203
|
);
|
|
34072
|
-
const [generationInput, setGenerationInput] =
|
|
34204
|
+
const [generationInput, setGenerationInput] = useState37();
|
|
34073
34205
|
const generation = useGeneration(generationInput);
|
|
34074
|
-
const [flowStart, setFlowStart] =
|
|
34206
|
+
const [flowStart, setFlowStart] = useState37();
|
|
34075
34207
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34076
|
-
const [importDefaults, setImportDefaults] =
|
|
34077
|
-
|
|
34208
|
+
const [importDefaults, setImportDefaults] = useState37();
|
|
34209
|
+
useEffect28(() => {
|
|
34078
34210
|
if (screen !== "import") {
|
|
34079
34211
|
setImportDefaults(void 0);
|
|
34080
34212
|
return;
|
|
@@ -34134,12 +34266,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34134
34266
|
}
|
|
34135
34267
|
});
|
|
34136
34268
|
};
|
|
34137
|
-
|
|
34269
|
+
useEffect28(() => {
|
|
34138
34270
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34139
34271
|
setExtractionRun(void 0);
|
|
34140
34272
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34141
34273
|
}, [extraction, extractionRun]);
|
|
34142
|
-
|
|
34274
|
+
useEffect28(() => {
|
|
34143
34275
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34144
34276
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34145
34277
|
setGenerationInput({
|
|
@@ -34157,7 +34289,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34157
34289
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34158
34290
|
});
|
|
34159
34291
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34160
|
-
|
|
34292
|
+
useEffect28(() => {
|
|
34161
34293
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34162
34294
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34163
34295
|
inkClear();
|
|
@@ -34200,9 +34332,9 @@ function App({ importOptions, inkClear }) {
|
|
|
34200
34332
|
};
|
|
34201
34333
|
switch (screen) {
|
|
34202
34334
|
case "import":
|
|
34203
|
-
if (showImportResult) return /* @__PURE__ */
|
|
34335
|
+
if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
34204
34336
|
if (flow && flowStart) {
|
|
34205
|
-
return /* @__PURE__ */
|
|
34337
|
+
return /* @__PURE__ */ jsx64(
|
|
34206
34338
|
FlowScreen,
|
|
34207
34339
|
{
|
|
34208
34340
|
state: flow.state,
|
|
@@ -34212,12 +34344,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34212
34344
|
}
|
|
34213
34345
|
);
|
|
34214
34346
|
}
|
|
34215
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
34347
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
34216
34348
|
if (projectPath === void 0) {
|
|
34217
|
-
return /* @__PURE__ */
|
|
34349
|
+
return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
34218
34350
|
}
|
|
34219
34351
|
if (tokensPath === void 0) {
|
|
34220
|
-
return /* @__PURE__ */
|
|
34352
|
+
return /* @__PURE__ */ jsx64(
|
|
34221
34353
|
TokenInputScreen,
|
|
34222
34354
|
{
|
|
34223
34355
|
initialPath: importDefaults.tokenFile,
|
|
@@ -34227,7 +34359,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34227
34359
|
);
|
|
34228
34360
|
}
|
|
34229
34361
|
if (scannedFiles === void 0) {
|
|
34230
|
-
return /* @__PURE__ */
|
|
34362
|
+
return /* @__PURE__ */ jsx64(
|
|
34231
34363
|
PathValidationScreen,
|
|
34232
34364
|
{
|
|
34233
34365
|
projectPath,
|
|
@@ -34239,10 +34371,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34239
34371
|
}
|
|
34240
34372
|
if (extractionRun) {
|
|
34241
34373
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
34242
|
-
return /* @__PURE__ */
|
|
34374
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
34243
34375
|
}
|
|
34244
34376
|
if (extraction?.status === "running") {
|
|
34245
|
-
return /* @__PURE__ */
|
|
34377
|
+
return /* @__PURE__ */ jsx64(
|
|
34246
34378
|
ExtractionScreen,
|
|
34247
34379
|
{
|
|
34248
34380
|
progress: extraction.progress,
|
|
@@ -34251,14 +34383,14 @@ function App({ importOptions, inkClear }) {
|
|
|
34251
34383
|
}
|
|
34252
34384
|
);
|
|
34253
34385
|
}
|
|
34254
|
-
return /* @__PURE__ */
|
|
34386
|
+
return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
34255
34387
|
}
|
|
34256
34388
|
if (scopeRun && scopeFlow) {
|
|
34257
34389
|
if (scopeFlow.status === "failed") {
|
|
34258
|
-
return /* @__PURE__ */
|
|
34390
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
34259
34391
|
}
|
|
34260
34392
|
if (scopeFlow.status === "deciding") {
|
|
34261
|
-
return /* @__PURE__ */
|
|
34393
|
+
return /* @__PURE__ */ jsx64(
|
|
34262
34394
|
ScopeGateScreen,
|
|
34263
34395
|
{
|
|
34264
34396
|
components: scopeFlow.load.components,
|
|
@@ -34268,7 +34400,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34268
34400
|
);
|
|
34269
34401
|
}
|
|
34270
34402
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
34271
|
-
return /* @__PURE__ */
|
|
34403
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
34272
34404
|
}
|
|
34273
34405
|
if (generation?.status === "running") {
|
|
34274
34406
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -34276,7 +34408,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34276
34408
|
hasRawTokens,
|
|
34277
34409
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
34278
34410
|
});
|
|
34279
|
-
return /* @__PURE__ */
|
|
34411
|
+
return /* @__PURE__ */ jsx64(
|
|
34280
34412
|
GenerationScreen,
|
|
34281
34413
|
{
|
|
34282
34414
|
progress: generation.progress,
|
|
@@ -34288,10 +34420,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34288
34420
|
}
|
|
34289
34421
|
);
|
|
34290
34422
|
}
|
|
34291
|
-
return /* @__PURE__ */
|
|
34423
|
+
return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
34292
34424
|
}
|
|
34293
34425
|
if (pendingLaunch?.cached) {
|
|
34294
|
-
return /* @__PURE__ */
|
|
34426
|
+
return /* @__PURE__ */ jsx64(
|
|
34295
34427
|
TokenReuseScreen,
|
|
34296
34428
|
{
|
|
34297
34429
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -34302,7 +34434,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34302
34434
|
}
|
|
34303
34435
|
);
|
|
34304
34436
|
}
|
|
34305
|
-
return /* @__PURE__ */
|
|
34437
|
+
return /* @__PURE__ */ jsx64(
|
|
34306
34438
|
CredentialsScreen,
|
|
34307
34439
|
{
|
|
34308
34440
|
initial: importDefaults.credentials,
|
|
@@ -34311,19 +34443,19 @@ function App({ importOptions, inkClear }) {
|
|
|
34311
34443
|
}
|
|
34312
34444
|
);
|
|
34313
34445
|
case "help":
|
|
34314
|
-
return /* @__PURE__ */
|
|
34446
|
+
return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
|
|
34315
34447
|
case "upgrade":
|
|
34316
|
-
return /* @__PURE__ */
|
|
34448
|
+
return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
|
|
34317
34449
|
case "settings":
|
|
34318
|
-
return /* @__PURE__ */
|
|
34450
|
+
return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
34319
34451
|
case "settings-configuration":
|
|
34320
|
-
return /* @__PURE__ */
|
|
34452
|
+
return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
|
|
34321
34453
|
case "settings-opt-in-analytics":
|
|
34322
|
-
return /* @__PURE__ */
|
|
34454
|
+
return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
34323
34455
|
case "settings-debug-mode":
|
|
34324
|
-
return /* @__PURE__ */
|
|
34456
|
+
return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
|
|
34325
34457
|
case "start":
|
|
34326
|
-
return /* @__PURE__ */
|
|
34458
|
+
return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
|
|
34327
34459
|
}
|
|
34328
34460
|
}
|
|
34329
34461
|
async function runApp(renderApp, importOptions) {
|
|
@@ -34331,7 +34463,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
34331
34463
|
instance.clear?.();
|
|
34332
34464
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
34333
34465
|
};
|
|
34334
|
-
const instance = renderApp(/* @__PURE__ */
|
|
34466
|
+
const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
|
|
34335
34467
|
await instance.waitUntilExit();
|
|
34336
34468
|
}
|
|
34337
34469
|
var init_app = __esm({
|