@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/app.js
CHANGED
|
@@ -2330,7 +2330,7 @@ var init_debug_store = __esm({
|
|
|
2330
2330
|
|
|
2331
2331
|
// packages/experience-design-system-cli/app.tsx
|
|
2332
2332
|
import { join as join26 } from "node:path";
|
|
2333
|
-
import { useEffect as
|
|
2333
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
2334
2334
|
|
|
2335
2335
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2336
2336
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -4286,9 +4286,9 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
4286
4286
|
async function resolveImportSpecifiers(sourceText, fromDir) {
|
|
4287
4287
|
const resolvedPaths = [];
|
|
4288
4288
|
for (const specifier of extractRelativeImportPaths(sourceText)) {
|
|
4289
|
-
const
|
|
4290
|
-
if (
|
|
4291
|
-
resolvedPaths.push(
|
|
4289
|
+
const resolvedPath2 = await resolveRelativeImport(specifier, fromDir);
|
|
4290
|
+
if (resolvedPath2)
|
|
4291
|
+
resolvedPaths.push(resolvedPath2);
|
|
4292
4292
|
}
|
|
4293
4293
|
return resolvedPaths;
|
|
4294
4294
|
}
|
|
@@ -4302,20 +4302,20 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
4302
4302
|
if (discovered.length >= MAX_SIBLING_CANDIDATES_EXPLORED)
|
|
4303
4303
|
break;
|
|
4304
4304
|
const resolvedPaths = await resolveImportSpecifiers(node.text, node.dir);
|
|
4305
|
-
for (const
|
|
4306
|
-
if (visited.has(
|
|
4305
|
+
for (const resolvedPath2 of resolvedPaths) {
|
|
4306
|
+
if (visited.has(resolvedPath2))
|
|
4307
4307
|
continue;
|
|
4308
|
-
visited.add(
|
|
4308
|
+
visited.add(resolvedPath2);
|
|
4309
4309
|
if (discovered.length >= MAX_SIBLING_CANDIDATES_EXPLORED)
|
|
4310
4310
|
break;
|
|
4311
4311
|
let content;
|
|
4312
4312
|
try {
|
|
4313
|
-
content = await readFile4(
|
|
4313
|
+
content = await readFile4(resolvedPath2, "utf8");
|
|
4314
4314
|
} catch {
|
|
4315
4315
|
continue;
|
|
4316
4316
|
}
|
|
4317
|
-
discovered.push({ path:
|
|
4318
|
-
nextFrontier.push({ text: content, dir: dirname4(
|
|
4317
|
+
discovered.push({ path: resolvedPath2, content });
|
|
4318
|
+
nextFrontier.push({ text: content, dir: dirname4(resolvedPath2) });
|
|
4319
4319
|
}
|
|
4320
4320
|
}
|
|
4321
4321
|
frontier = nextFrontier;
|
|
@@ -5280,11 +5280,11 @@ function isBareModuleSpecifier(moduleSpecifier) {
|
|
|
5280
5280
|
return !moduleSpecifier.startsWith(".") && !moduleSpecifier.startsWith("/");
|
|
5281
5281
|
}
|
|
5282
5282
|
function findRepoLocalAliasSourceFile(originSourceFile, moduleSpecifier) {
|
|
5283
|
-
const
|
|
5284
|
-
if (!
|
|
5283
|
+
const resolvedPath2 = resolveRepoLocalAliasImportPath(originSourceFile.getFilePath(), moduleSpecifier);
|
|
5284
|
+
if (!resolvedPath2)
|
|
5285
5285
|
return void 0;
|
|
5286
5286
|
const project = originSourceFile.getProject();
|
|
5287
|
-
return findProjectSourceFileByImportPath(project,
|
|
5287
|
+
return findProjectSourceFileByImportPath(project, resolvedPath2);
|
|
5288
5288
|
}
|
|
5289
5289
|
function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
|
|
5290
5290
|
const nearestTsConfigPath = findNearestTsConfigPath(importingFilePath);
|
|
@@ -5299,8 +5299,8 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
|
|
|
5299
5299
|
continue;
|
|
5300
5300
|
for (const targetPattern of targets) {
|
|
5301
5301
|
const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
|
|
5302
|
-
const
|
|
5303
|
-
const sourceFilePath = resolveImportSourcePath(
|
|
5302
|
+
const resolvedPath2 = resolve7(tsConfigPaths.baseUrl, substitutedTarget);
|
|
5303
|
+
const sourceFilePath = resolveImportSourcePath(resolvedPath2);
|
|
5304
5304
|
if (sourceFilePath)
|
|
5305
5305
|
return sourceFilePath;
|
|
5306
5306
|
}
|
|
@@ -5378,17 +5378,17 @@ function resolveImportSourcePath(basePath) {
|
|
|
5378
5378
|
];
|
|
5379
5379
|
return candidates.find((candidatePath) => existsSync3(candidatePath));
|
|
5380
5380
|
}
|
|
5381
|
-
function findProjectSourceFileByImportPath(project,
|
|
5381
|
+
function findProjectSourceFileByImportPath(project, resolvedPath2) {
|
|
5382
5382
|
const candidatePaths = [
|
|
5383
|
-
|
|
5384
|
-
`${
|
|
5385
|
-
`${
|
|
5386
|
-
`${
|
|
5387
|
-
`${
|
|
5388
|
-
join5(
|
|
5389
|
-
join5(
|
|
5390
|
-
join5(
|
|
5391
|
-
join5(
|
|
5383
|
+
resolvedPath2,
|
|
5384
|
+
`${resolvedPath2}.ts`,
|
|
5385
|
+
`${resolvedPath2}.tsx`,
|
|
5386
|
+
`${resolvedPath2}.js`,
|
|
5387
|
+
`${resolvedPath2}.jsx`,
|
|
5388
|
+
join5(resolvedPath2, "index.ts"),
|
|
5389
|
+
join5(resolvedPath2, "index.tsx"),
|
|
5390
|
+
join5(resolvedPath2, "index.js"),
|
|
5391
|
+
join5(resolvedPath2, "index.jsx")
|
|
5392
5392
|
];
|
|
5393
5393
|
for (const candidatePath of candidatePaths) {
|
|
5394
5394
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -9899,11 +9899,11 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
|
|
|
9899
9899
|
}
|
|
9900
9900
|
function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
9901
9901
|
if (specifier.startsWith(".")) {
|
|
9902
|
-
const
|
|
9903
|
-
if (
|
|
9904
|
-
return `${
|
|
9902
|
+
const resolvedPath2 = resolve10(dirname8(fromFilePath), specifier);
|
|
9903
|
+
if (resolvedPath2.endsWith(".js")) {
|
|
9904
|
+
return `${resolvedPath2.slice(0, -3)}.ts`;
|
|
9905
9905
|
}
|
|
9906
|
-
return
|
|
9906
|
+
return resolvedPath2;
|
|
9907
9907
|
}
|
|
9908
9908
|
const spectrumPrefix = "@spectrum-web-components/core/components/";
|
|
9909
9909
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
@@ -17126,15 +17126,15 @@ function PathValidationScreen({
|
|
|
17126
17126
|
onChangePath,
|
|
17127
17127
|
onBack
|
|
17128
17128
|
}) {
|
|
17129
|
-
const
|
|
17129
|
+
const resolvedPath2 = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
17130
17130
|
const [scan, setScan] = useState5();
|
|
17131
17131
|
useEffect3(() => {
|
|
17132
|
-
setScan(scanFiles(
|
|
17133
|
-
}, [
|
|
17132
|
+
setScan(scanFiles(resolvedPath2));
|
|
17133
|
+
}, [resolvedPath2]);
|
|
17134
17134
|
const phase = phaseOf(scan);
|
|
17135
17135
|
usePathValidationControls(phase, {
|
|
17136
17136
|
onConfirm: () => {
|
|
17137
|
-
if (scan?.ok) onConfirm({ projectPath:
|
|
17137
|
+
if (scan?.ok) onConfirm({ projectPath: resolvedPath2, filePaths: scan.filePaths });
|
|
17138
17138
|
},
|
|
17139
17139
|
onChangePath,
|
|
17140
17140
|
onBack
|
|
@@ -17142,11 +17142,11 @@ function PathValidationScreen({
|
|
|
17142
17142
|
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
17143
17143
|
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
17144
17144
|
"Scanning ",
|
|
17145
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children:
|
|
17145
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath2 }),
|
|
17146
17146
|
"..."
|
|
17147
17147
|
] }),
|
|
17148
|
-
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path:
|
|
17149
|
-
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path:
|
|
17148
|
+
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath2 }),
|
|
17149
|
+
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath2 }),
|
|
17150
17150
|
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
17151
17151
|
"[",
|
|
17152
17152
|
control.keys,
|
|
@@ -28580,130 +28580,14 @@ function SettingsScreen({
|
|
|
28580
28580
|
}
|
|
28581
28581
|
|
|
28582
28582
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
28583
|
-
import { useState as
|
|
28584
|
-
import { Box as Box48, Text as
|
|
28583
|
+
import { useState as useState33 } from "react";
|
|
28584
|
+
import { Box as Box48, Text as Text51, useInput as useInput14 } from "ink";
|
|
28585
28585
|
|
|
28586
28586
|
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
28587
|
-
import { useEffect as
|
|
28588
|
-
import { Box as
|
|
28587
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
28588
|
+
import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
|
|
28589
28589
|
init_debug_store();
|
|
28590
28590
|
|
|
28591
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
28592
|
-
import { useState as useState29 } from "react";
|
|
28593
|
-
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
28594
|
-
import TextInput4 from "ink-text-input";
|
|
28595
|
-
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28596
|
-
function FieldForm({
|
|
28597
|
-
title,
|
|
28598
|
-
subtitle,
|
|
28599
|
-
fields,
|
|
28600
|
-
values,
|
|
28601
|
-
onChange,
|
|
28602
|
-
onSave,
|
|
28603
|
-
onQuit,
|
|
28604
|
-
notice,
|
|
28605
|
-
busy = false,
|
|
28606
|
-
footer,
|
|
28607
|
-
actions = []
|
|
28608
|
-
}) {
|
|
28609
|
-
const [active, setActive] = useState29(0);
|
|
28610
|
-
const [editing, setEditing] = useState29(false);
|
|
28611
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28612
|
-
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
28613
|
-
const current = fields[active];
|
|
28614
|
-
useInput11((input, key) => {
|
|
28615
|
-
if (busy) return;
|
|
28616
|
-
if (editing) {
|
|
28617
|
-
if (key.escape) {
|
|
28618
|
-
onChange(current.key, valueBeforeEdit);
|
|
28619
|
-
setEditing(false);
|
|
28620
|
-
}
|
|
28621
|
-
return;
|
|
28622
|
-
}
|
|
28623
|
-
if (key.escape || input === "q") {
|
|
28624
|
-
onQuit();
|
|
28625
|
-
return;
|
|
28626
|
-
}
|
|
28627
|
-
if (input === "s") {
|
|
28628
|
-
onSave();
|
|
28629
|
-
return;
|
|
28630
|
-
}
|
|
28631
|
-
if (input === "c") {
|
|
28632
|
-
onChange(current.key, "");
|
|
28633
|
-
return;
|
|
28634
|
-
}
|
|
28635
|
-
const action = actions.find((candidate) => candidate.key === input);
|
|
28636
|
-
if (action) {
|
|
28637
|
-
action.run();
|
|
28638
|
-
return;
|
|
28639
|
-
}
|
|
28640
|
-
if (key.tab || key.downArrow) {
|
|
28641
|
-
setActive((i) => (i + 1) % fields.length);
|
|
28642
|
-
return;
|
|
28643
|
-
}
|
|
28644
|
-
if (key.upArrow) {
|
|
28645
|
-
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
28646
|
-
return;
|
|
28647
|
-
}
|
|
28648
|
-
if (key.return) {
|
|
28649
|
-
setValueBeforeEdit(values[current.key]);
|
|
28650
|
-
setEditing(true);
|
|
28651
|
-
}
|
|
28652
|
-
});
|
|
28653
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28654
|
-
/* @__PURE__ */ jsx55(Text46, { bold: true, children: title }),
|
|
28655
|
-
subtitle && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: subtitle }),
|
|
28656
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28657
|
-
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: fields.map((field, index) => {
|
|
28658
|
-
const isActive = index === active;
|
|
28659
|
-
const value = values[field.key];
|
|
28660
|
-
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
28661
|
-
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28662
|
-
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
28663
|
-
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
28664
|
-
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
28665
|
-
TextInput4,
|
|
28666
|
-
{
|
|
28667
|
-
value,
|
|
28668
|
-
onChange: (next) => onChange(field.key, next),
|
|
28669
|
-
onSubmit: () => setEditing(false),
|
|
28670
|
-
mask: field.masked ? "\u2022" : void 0
|
|
28671
|
-
}
|
|
28672
|
-
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
28673
|
-
field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
28674
|
-
] }, field.key);
|
|
28675
|
-
}) }),
|
|
28676
|
-
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
28677
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28678
|
-
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
28679
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
28680
|
-
" ",
|
|
28681
|
-
notice.text
|
|
28682
|
-
] })
|
|
28683
|
-
] }),
|
|
28684
|
-
footer,
|
|
28685
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28686
|
-
/* @__PURE__ */ jsx55(
|
|
28687
|
-
ControlHints,
|
|
28688
|
-
{
|
|
28689
|
-
hints: editing ? [
|
|
28690
|
-
{ keys: "type", label: "edit" },
|
|
28691
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
28692
|
-
{ keys: "\u23CE", label: "done" },
|
|
28693
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
28694
|
-
] : [
|
|
28695
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
28696
|
-
{ keys: "\u23CE", label: "edit" },
|
|
28697
|
-
{ keys: "c", label: "clear" },
|
|
28698
|
-
{ keys: "s", label: "save" },
|
|
28699
|
-
...actions.map(({ key, label }) => ({ keys: key, label })),
|
|
28700
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
28701
|
-
]
|
|
28702
|
-
}
|
|
28703
|
-
)
|
|
28704
|
-
] });
|
|
28705
|
-
}
|
|
28706
|
-
|
|
28707
28591
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
28708
28592
|
init_config();
|
|
28709
28593
|
var readV1Store = readSettings2;
|
|
@@ -28858,9 +28742,11 @@ async function testAgent(name, binary, model) {
|
|
|
28858
28742
|
}
|
|
28859
28743
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
28860
28744
|
}
|
|
28861
|
-
function statusFromChecks(name, checks) {
|
|
28745
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
28862
28746
|
if (checks.length === 0) return "checking";
|
|
28863
|
-
if (checks.some((check) => check.step === "path" && !check.ok))
|
|
28747
|
+
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
28748
|
+
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
28749
|
+
}
|
|
28864
28750
|
const login = checks.find((check) => check.step === "login");
|
|
28865
28751
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
28866
28752
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -28868,11 +28754,49 @@ function statusFromChecks(name, checks) {
|
|
|
28868
28754
|
return name === "claude" ? "ready" : "unknown";
|
|
28869
28755
|
}
|
|
28870
28756
|
function nextStepHint(name, status) {
|
|
28871
|
-
if (status === "not-
|
|
28757
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set the command path below`;
|
|
28758
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or fix the command path`;
|
|
28872
28759
|
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
28873
28760
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
28874
28761
|
return "";
|
|
28875
28762
|
}
|
|
28763
|
+
function resolvedPath(checks) {
|
|
28764
|
+
const path5 = checks?.find((check) => check.step === "path");
|
|
28765
|
+
return path5?.ok ? path5.detail : "";
|
|
28766
|
+
}
|
|
28767
|
+
function statusRows(_name, checks, savedBinary) {
|
|
28768
|
+
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
28769
|
+
const find = (step) => checks.find((check) => check.step === step);
|
|
28770
|
+
const path5 = find("path");
|
|
28771
|
+
if (!path5?.ok) {
|
|
28772
|
+
if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
|
|
28773
|
+
return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
|
|
28774
|
+
}
|
|
28775
|
+
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
28776
|
+
const version = find("version");
|
|
28777
|
+
if (version) {
|
|
28778
|
+
rows.push({
|
|
28779
|
+
label: "Version",
|
|
28780
|
+
value: version.ok ? version.detail : "could not be read",
|
|
28781
|
+
tone: version.ok ? "ok" : "muted"
|
|
28782
|
+
});
|
|
28783
|
+
}
|
|
28784
|
+
const login = find("login");
|
|
28785
|
+
const prompt = find("prompt");
|
|
28786
|
+
if (login) {
|
|
28787
|
+
rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
|
|
28788
|
+
} else if (prompt) {
|
|
28789
|
+
rows.push({
|
|
28790
|
+
label: "Login",
|
|
28791
|
+
value: prompt.ok ? "confirmed by the test" : "see the test result",
|
|
28792
|
+
tone: prompt.ok ? "ok" : "bad"
|
|
28793
|
+
});
|
|
28794
|
+
} else {
|
|
28795
|
+
rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
|
|
28796
|
+
}
|
|
28797
|
+
if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
|
|
28798
|
+
return rows;
|
|
28799
|
+
}
|
|
28876
28800
|
async function withBinaryEnv(name, binary, run) {
|
|
28877
28801
|
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
28878
28802
|
const previous = process.env[key];
|
|
@@ -28885,57 +28809,10 @@ async function withBinaryEnv(name, binary, run) {
|
|
|
28885
28809
|
}
|
|
28886
28810
|
}
|
|
28887
28811
|
|
|
28888
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/
|
|
28889
|
-
import {
|
|
28890
|
-
import {
|
|
28891
|
-
|
|
28892
|
-
checking: "checking...",
|
|
28893
|
-
ready: "ready",
|
|
28894
|
-
"not-found": "not found",
|
|
28895
|
-
"not-logged-in": "not logged in",
|
|
28896
|
-
unknown: "found, login not checked"
|
|
28897
|
-
};
|
|
28898
|
-
var STATUS_COLOR = {
|
|
28899
|
-
checking: PALETTE.muted,
|
|
28900
|
-
ready: PALETTE.success,
|
|
28901
|
-
"not-found": PALETTE.error,
|
|
28902
|
-
"not-logged-in": PALETTE.error,
|
|
28903
|
-
unknown: PALETTE.muted
|
|
28904
|
-
};
|
|
28905
|
-
function AgentStatusBadge({
|
|
28906
|
-
name,
|
|
28907
|
-
checks
|
|
28908
|
-
}) {
|
|
28909
|
-
const status = checks ? statusFromChecks(name, checks) : "checking";
|
|
28910
|
-
return /* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] });
|
|
28911
|
-
}
|
|
28912
|
-
function AgentChecks({
|
|
28913
|
-
name,
|
|
28914
|
-
checks
|
|
28915
|
-
}) {
|
|
28916
|
-
if (!checks) {
|
|
28917
|
-
return /* @__PURE__ */ jsx56(Box45, { marginTop: 1, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Checking..." }) });
|
|
28918
|
-
}
|
|
28919
|
-
const status = statusFromChecks(name, checks);
|
|
28920
|
-
const hint = nextStepHint(name, status);
|
|
28921
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
28922
|
-
/* @__PURE__ */ jsxs46(Text47, { bold: true, children: [
|
|
28923
|
-
"Status: ",
|
|
28924
|
-
/* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] })
|
|
28925
|
-
] }),
|
|
28926
|
-
checks.map((check) => /* @__PURE__ */ jsxs46(Text47, { color: check.ok ? PALETTE.success : PALETTE.muted, children: [
|
|
28927
|
-
check.ok ? "\u2713" : "\xB7",
|
|
28928
|
-
" ",
|
|
28929
|
-
check.step,
|
|
28930
|
-
": ",
|
|
28931
|
-
check.detail
|
|
28932
|
-
] }, check.step)),
|
|
28933
|
-
hint && /* @__PURE__ */ jsxs46(Text47, { color: PALETTE.muted, children: [
|
|
28934
|
-
"Next: ",
|
|
28935
|
-
hint
|
|
28936
|
-
] })
|
|
28937
|
-
] });
|
|
28938
|
-
}
|
|
28812
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
28813
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
28814
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
28815
|
+
import TextInput4 from "ink-text-input";
|
|
28939
28816
|
|
|
28940
28817
|
// packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts
|
|
28941
28818
|
var shellValues = /* @__PURE__ */ new Map();
|
|
@@ -28955,32 +28832,50 @@ function applyBinaryOverrides(config) {
|
|
|
28955
28832
|
}
|
|
28956
28833
|
}
|
|
28957
28834
|
|
|
28958
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/
|
|
28959
|
-
import { Fragment as
|
|
28960
|
-
var
|
|
28961
|
-
|
|
28962
|
-
|
|
28963
|
-
|
|
28964
|
-
var
|
|
28965
|
-
|
|
28835
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
28836
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28837
|
+
var FOCUS_ORDER = ["binary", "model", "test"];
|
|
28838
|
+
var FIELDS2 = ["binary", "model"];
|
|
28839
|
+
var FIELD_LABEL = { binary: "Command path", model: "Model" };
|
|
28840
|
+
var LABEL_WIDTH = "Command path".length;
|
|
28841
|
+
var TONE_COLOR = {
|
|
28842
|
+
ok: PALETTE.success,
|
|
28843
|
+
bad: PALETTE.error,
|
|
28844
|
+
muted: PALETTE.muted
|
|
28845
|
+
};
|
|
28846
|
+
var fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
|
|
28847
|
+
function Section2({ title, children }) {
|
|
28848
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
|
|
28849
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, color: PALETTE.muted, children: title }),
|
|
28850
|
+
children
|
|
28851
|
+
] });
|
|
28852
|
+
}
|
|
28853
|
+
function AgentDetail({
|
|
28966
28854
|
name,
|
|
28967
28855
|
config,
|
|
28968
28856
|
setConfig,
|
|
28969
28857
|
onBack
|
|
28970
28858
|
}) {
|
|
28971
|
-
const [saving, setSaving] = useState30(false);
|
|
28972
|
-
const [testing, setTesting] = useState30(false);
|
|
28973
|
-
const [notice, setNotice] = useState30(null);
|
|
28974
|
-
const [checks, setChecks] = useState30(void 0);
|
|
28975
28859
|
const settings = config.agents[name];
|
|
28860
|
+
const [focusIndex, setFocusIndex] = useState29(0);
|
|
28861
|
+
const [editing, setEditing] = useState29(false);
|
|
28862
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28863
|
+
const [saving, setSaving] = useState29(false);
|
|
28864
|
+
const [testing, setTesting] = useState29(false);
|
|
28865
|
+
const [notice, setNotice] = useState29(null);
|
|
28866
|
+
const [checks, setChecks] = useState29(void 0);
|
|
28976
28867
|
useEffect22(() => {
|
|
28977
|
-
let
|
|
28868
|
+
let active = true;
|
|
28978
28869
|
setChecks(void 0);
|
|
28979
|
-
void inspectAgent(name, settings.binary).then((result) =>
|
|
28870
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
28980
28871
|
return () => {
|
|
28981
|
-
|
|
28872
|
+
active = false;
|
|
28982
28873
|
};
|
|
28983
28874
|
}, [name, settings.binary]);
|
|
28875
|
+
const setField = (field, value) => {
|
|
28876
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
|
|
28877
|
+
setNotice(null);
|
|
28878
|
+
};
|
|
28984
28879
|
const save = () => {
|
|
28985
28880
|
setSaving(true);
|
|
28986
28881
|
setNotice(null);
|
|
@@ -28991,7 +28886,7 @@ function AgentForm({
|
|
|
28991
28886
|
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
|
|
28992
28887
|
).finally(() => setSaving(false));
|
|
28993
28888
|
};
|
|
28994
|
-
const
|
|
28889
|
+
const runTest = () => {
|
|
28995
28890
|
setTesting(true);
|
|
28996
28891
|
setNotice(null);
|
|
28997
28892
|
setChecks(void 0);
|
|
@@ -28999,26 +28894,146 @@ function AgentForm({
|
|
|
28999
28894
|
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "The test could not run" })
|
|
29000
28895
|
).finally(() => setTesting(false));
|
|
29001
28896
|
};
|
|
29002
|
-
|
|
29003
|
-
|
|
29004
|
-
|
|
29005
|
-
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29010
|
-
|
|
29011
|
-
|
|
29012
|
-
},
|
|
29013
|
-
onSave: save,
|
|
29014
|
-
onQuit: onBack,
|
|
29015
|
-
notice,
|
|
29016
|
-
busy: saving || testing,
|
|
29017
|
-
footer: /* @__PURE__ */ jsx57(AgentChecks, { name, checks }),
|
|
29018
|
-
actions: [{ key: "t", label: "full test (uses a few tokens)", run: runFullTest }]
|
|
28897
|
+
const focused = FOCUS_ORDER[focusIndex];
|
|
28898
|
+
const focusedField = focused === "test" ? null : focused;
|
|
28899
|
+
useInput11((input, key) => {
|
|
28900
|
+
if (saving || testing) return;
|
|
28901
|
+
if (editing) {
|
|
28902
|
+
if (key.escape && focusedField) {
|
|
28903
|
+
setField(focusedField, valueBeforeEdit);
|
|
28904
|
+
setEditing(false);
|
|
28905
|
+
}
|
|
28906
|
+
return;
|
|
29019
28907
|
}
|
|
29020
|
-
|
|
28908
|
+
if (key.escape || input === "q") {
|
|
28909
|
+
onBack();
|
|
28910
|
+
return;
|
|
28911
|
+
}
|
|
28912
|
+
if (input === "s") {
|
|
28913
|
+
save();
|
|
28914
|
+
return;
|
|
28915
|
+
}
|
|
28916
|
+
if (key.upArrow) {
|
|
28917
|
+
setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
|
|
28918
|
+
return;
|
|
28919
|
+
}
|
|
28920
|
+
if (key.downArrow || key.tab) {
|
|
28921
|
+
setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
|
|
28922
|
+
return;
|
|
28923
|
+
}
|
|
28924
|
+
if (input === "c" && focusedField) {
|
|
28925
|
+
setField(focusedField, "");
|
|
28926
|
+
return;
|
|
28927
|
+
}
|
|
28928
|
+
if (key.return) {
|
|
28929
|
+
if (focusedField) {
|
|
28930
|
+
setValueBeforeEdit(settings[focusedField]);
|
|
28931
|
+
setEditing(true);
|
|
28932
|
+
} else {
|
|
28933
|
+
runTest();
|
|
28934
|
+
}
|
|
28935
|
+
}
|
|
28936
|
+
});
|
|
28937
|
+
const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
|
|
28938
|
+
const hint = nextStepHint(name, status);
|
|
28939
|
+
const pointer = (isFocused) => /* @__PURE__ */ jsx55(Text46, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
28940
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28941
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: AGENT_LABELS[name] }),
|
|
28942
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
|
|
28943
|
+
/* @__PURE__ */ jsxs45(Section2, { title: "STATUS", children: [
|
|
28944
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsxs45(Box44, { gap: 1, paddingLeft: 2, children: [
|
|
28945
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: row.label }) }),
|
|
28946
|
+
/* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[row.tone], children: row.value })
|
|
28947
|
+
] }, row.label)),
|
|
28948
|
+
hint && /* @__PURE__ */ jsx55(Box44, { paddingLeft: 2, children: /* @__PURE__ */ jsxs45(Text46, { color: PALETTE.muted, children: [
|
|
28949
|
+
"Next: ",
|
|
28950
|
+
hint
|
|
28951
|
+
] }) })
|
|
28952
|
+
] }),
|
|
28953
|
+
/* @__PURE__ */ jsx55(Section2, { title: "SETTINGS", children: FIELDS2.map((field) => {
|
|
28954
|
+
const isFocused = focused === field;
|
|
28955
|
+
const value = settings[field];
|
|
28956
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28957
|
+
pointer(isFocused),
|
|
28958
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: FIELD_LABEL[field] }) }),
|
|
28959
|
+
isFocused && editing ? /* @__PURE__ */ jsx55(
|
|
28960
|
+
TextInput4,
|
|
28961
|
+
{
|
|
28962
|
+
value,
|
|
28963
|
+
onChange: (next) => setField(field, next),
|
|
28964
|
+
onSubmit: () => setEditing(false)
|
|
28965
|
+
}
|
|
28966
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: true, children: value }),
|
|
28967
|
+
!value && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: fieldHint(name, field) })
|
|
28968
|
+
] }, field);
|
|
28969
|
+
}) }),
|
|
28970
|
+
/* @__PURE__ */ jsx55(Section2, { title: "ACTIONS", children: /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28971
|
+
pointer(focused === "test"),
|
|
28972
|
+
/* @__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" }) }),
|
|
28973
|
+
/* @__PURE__ */ jsx55(Text46, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
|
|
28974
|
+
] }) }),
|
|
28975
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
28976
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28977
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
28978
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
28979
|
+
" ",
|
|
28980
|
+
notice.text
|
|
28981
|
+
] })
|
|
28982
|
+
] }),
|
|
28983
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28984
|
+
/* @__PURE__ */ jsx55(
|
|
28985
|
+
ControlHints,
|
|
28986
|
+
{
|
|
28987
|
+
hints: editing ? [
|
|
28988
|
+
{ keys: "type", label: "edit" },
|
|
28989
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
28990
|
+
{ keys: "\u23CE", label: "done" },
|
|
28991
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
28992
|
+
] : [
|
|
28993
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
28994
|
+
{ keys: "\u23CE", label: focusedField ? "edit" : "run test" },
|
|
28995
|
+
...focusedField ? [{ keys: "c", label: "clear" }] : [],
|
|
28996
|
+
{ keys: "s", label: "save" },
|
|
28997
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
28998
|
+
]
|
|
28999
|
+
}
|
|
29000
|
+
)
|
|
29001
|
+
] });
|
|
29002
|
+
}
|
|
29003
|
+
|
|
29004
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
|
|
29005
|
+
import { Text as Text47 } from "ink";
|
|
29006
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
29007
|
+
var STATUS_TEXT = {
|
|
29008
|
+
checking: "checking...",
|
|
29009
|
+
ready: "ready",
|
|
29010
|
+
"not-configured": "not configured",
|
|
29011
|
+
"not-found": "not found",
|
|
29012
|
+
"not-logged-in": "not logged in",
|
|
29013
|
+
unknown: "found, login not checked"
|
|
29014
|
+
};
|
|
29015
|
+
var STATUS_COLOR = {
|
|
29016
|
+
checking: PALETTE.muted,
|
|
29017
|
+
ready: PALETTE.success,
|
|
29018
|
+
"not-configured": PALETTE.muted,
|
|
29019
|
+
"not-found": PALETTE.error,
|
|
29020
|
+
"not-logged-in": PALETTE.error,
|
|
29021
|
+
unknown: PALETTE.muted
|
|
29022
|
+
};
|
|
29023
|
+
function AgentStatusBadge({
|
|
29024
|
+
name,
|
|
29025
|
+
checks,
|
|
29026
|
+
binary
|
|
29027
|
+
}) {
|
|
29028
|
+
const status = checks ? statusFromChecks(name, checks, binary) : "checking";
|
|
29029
|
+
return /* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] });
|
|
29021
29030
|
}
|
|
29031
|
+
|
|
29032
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
29033
|
+
import { Fragment as Fragment18, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
29034
|
+
var ROWS = [{ kind: "default" }, ...AGENT_NAMES.map((name) => ({ kind: "agent", name }))];
|
|
29035
|
+
var MAX_PATH_WIDTH = 44;
|
|
29036
|
+
var shortenPath = (path5) => path5.length > MAX_PATH_WIDTH ? `\u2026${path5.slice(-(MAX_PATH_WIDTH - 1))}` : path5;
|
|
29022
29037
|
function AgentsScreen({ onDone }) {
|
|
29023
29038
|
const [config, setConfig] = useState30(null);
|
|
29024
29039
|
const [focus, setFocus] = useState30(0);
|
|
@@ -29032,7 +29047,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29032
29047
|
);
|
|
29033
29048
|
}
|
|
29034
29049
|
};
|
|
29035
|
-
|
|
29050
|
+
useEffect23(() => {
|
|
29036
29051
|
void readAgentConfig().then((loaded) => {
|
|
29037
29052
|
setConfig(loaded);
|
|
29038
29053
|
inspectAll(loaded);
|
|
@@ -29083,7 +29098,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29083
29098
|
}
|
|
29084
29099
|
});
|
|
29085
29100
|
if (!config) {
|
|
29086
|
-
return /* @__PURE__ */
|
|
29101
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29087
29102
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
29088
29103
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29089
29104
|
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
@@ -29091,7 +29106,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29091
29106
|
}
|
|
29092
29107
|
if (open) {
|
|
29093
29108
|
return /* @__PURE__ */ jsx57(
|
|
29094
|
-
|
|
29109
|
+
AgentDetail,
|
|
29095
29110
|
{
|
|
29096
29111
|
name: open,
|
|
29097
29112
|
config,
|
|
@@ -29106,32 +29121,32 @@ function AgentsScreen({ onDone }) {
|
|
|
29106
29121
|
}
|
|
29107
29122
|
);
|
|
29108
29123
|
}
|
|
29109
|
-
return /* @__PURE__ */
|
|
29124
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29110
29125
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
29111
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and
|
|
29126
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
|
|
29112
29127
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29113
29128
|
ROWS.map((row, index) => {
|
|
29114
29129
|
const isFocused = index === focus;
|
|
29115
29130
|
const pointer = /* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
29116
29131
|
if (row.kind === "default") {
|
|
29117
|
-
return /* @__PURE__ */ jsx57(
|
|
29132
|
+
return /* @__PURE__ */ jsx57(Box45, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29118
29133
|
pointer,
|
|
29119
29134
|
/* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: "Default agent" }),
|
|
29120
29135
|
/* @__PURE__ */ jsx57(Text48, { bold: true, children: `\u2039 ${AGENT_LABELS[config.defaultAgent]} \u203A` })
|
|
29121
29136
|
] }) }, "default");
|
|
29122
29137
|
}
|
|
29123
|
-
const
|
|
29124
|
-
return /* @__PURE__ */
|
|
29138
|
+
const saved = config.agents[row.name].binary;
|
|
29139
|
+
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29125
29140
|
pointer,
|
|
29126
|
-
/* @__PURE__ */ jsx57(
|
|
29127
|
-
/* @__PURE__ */ jsx57(
|
|
29128
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children:
|
|
29141
|
+
/* @__PURE__ */ jsx57(Box45, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[row.name] }) }),
|
|
29142
|
+
/* @__PURE__ */ jsx57(Box45, { width: 26, flexShrink: 0, children: /* @__PURE__ */ jsx57(AgentStatusBadge, { name: row.name, checks: checks[row.name], binary: saved }) }),
|
|
29143
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: shortenPath(resolvedPath(checks[row.name]) || saved) }),
|
|
29129
29144
|
row.name === config.defaultAgent && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: "(default)" })
|
|
29130
29145
|
] }, row.name);
|
|
29131
29146
|
}),
|
|
29132
|
-
notice && /* @__PURE__ */
|
|
29147
|
+
notice && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
29133
29148
|
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29134
|
-
/* @__PURE__ */
|
|
29149
|
+
/* @__PURE__ */ jsxs46(Text48, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
29135
29150
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
29136
29151
|
" ",
|
|
29137
29152
|
notice.text
|
|
@@ -29156,10 +29171,119 @@ function AgentsScreen({ onDone }) {
|
|
|
29156
29171
|
}
|
|
29157
29172
|
|
|
29158
29173
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
29159
|
-
import { useEffect as
|
|
29160
|
-
import { Box as Box47, Text as
|
|
29174
|
+
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
29175
|
+
import { Box as Box47, Text as Text50 } from "ink";
|
|
29161
29176
|
init_debug_store();
|
|
29162
29177
|
|
|
29178
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
29179
|
+
import { useState as useState31 } from "react";
|
|
29180
|
+
import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
|
|
29181
|
+
import TextInput5 from "ink-text-input";
|
|
29182
|
+
import { Fragment as Fragment19, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
29183
|
+
function FieldForm({
|
|
29184
|
+
title,
|
|
29185
|
+
subtitle,
|
|
29186
|
+
fields,
|
|
29187
|
+
values,
|
|
29188
|
+
onChange,
|
|
29189
|
+
onSave,
|
|
29190
|
+
onQuit,
|
|
29191
|
+
notice,
|
|
29192
|
+
busy = false,
|
|
29193
|
+
footer
|
|
29194
|
+
}) {
|
|
29195
|
+
const [active, setActive] = useState31(0);
|
|
29196
|
+
const [editing, setEditing] = useState31(false);
|
|
29197
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
|
|
29198
|
+
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
29199
|
+
const current = fields[active];
|
|
29200
|
+
useInput13((input, key) => {
|
|
29201
|
+
if (busy) return;
|
|
29202
|
+
if (editing) {
|
|
29203
|
+
if (key.escape) {
|
|
29204
|
+
onChange(current.key, valueBeforeEdit);
|
|
29205
|
+
setEditing(false);
|
|
29206
|
+
}
|
|
29207
|
+
return;
|
|
29208
|
+
}
|
|
29209
|
+
if (key.escape || input === "q") {
|
|
29210
|
+
onQuit();
|
|
29211
|
+
return;
|
|
29212
|
+
}
|
|
29213
|
+
if (input === "s") {
|
|
29214
|
+
onSave();
|
|
29215
|
+
return;
|
|
29216
|
+
}
|
|
29217
|
+
if (input === "c") {
|
|
29218
|
+
onChange(current.key, "");
|
|
29219
|
+
return;
|
|
29220
|
+
}
|
|
29221
|
+
if (key.tab || key.downArrow) {
|
|
29222
|
+
setActive((i) => (i + 1) % fields.length);
|
|
29223
|
+
return;
|
|
29224
|
+
}
|
|
29225
|
+
if (key.upArrow) {
|
|
29226
|
+
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
29227
|
+
return;
|
|
29228
|
+
}
|
|
29229
|
+
if (key.return) {
|
|
29230
|
+
setValueBeforeEdit(values[current.key]);
|
|
29231
|
+
setEditing(true);
|
|
29232
|
+
}
|
|
29233
|
+
});
|
|
29234
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29235
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
|
|
29236
|
+
subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
|
|
29237
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29238
|
+
/* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
|
|
29239
|
+
const isActive = index === active;
|
|
29240
|
+
const value = values[field.key];
|
|
29241
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
29242
|
+
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
29243
|
+
/* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
29244
|
+
/* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
29245
|
+
isActive && editing ? /* @__PURE__ */ jsx58(
|
|
29246
|
+
TextInput5,
|
|
29247
|
+
{
|
|
29248
|
+
value,
|
|
29249
|
+
onChange: (next) => onChange(field.key, next),
|
|
29250
|
+
onSubmit: () => setEditing(false),
|
|
29251
|
+
mask: field.masked ? "\u2022" : void 0
|
|
29252
|
+
}
|
|
29253
|
+
) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
29254
|
+
field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
|
|
29255
|
+
] }, field.key);
|
|
29256
|
+
}) }),
|
|
29257
|
+
notice && /* @__PURE__ */ jsxs47(Fragment19, { children: [
|
|
29258
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29259
|
+
/* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
29260
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
29261
|
+
" ",
|
|
29262
|
+
notice.text
|
|
29263
|
+
] })
|
|
29264
|
+
] }),
|
|
29265
|
+
footer,
|
|
29266
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29267
|
+
/* @__PURE__ */ jsx58(
|
|
29268
|
+
ControlHints,
|
|
29269
|
+
{
|
|
29270
|
+
hints: editing ? [
|
|
29271
|
+
{ keys: "type", label: "edit" },
|
|
29272
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
29273
|
+
{ keys: "\u23CE", label: "done" },
|
|
29274
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
29275
|
+
] : [
|
|
29276
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
29277
|
+
{ keys: "\u23CE", label: "edit" },
|
|
29278
|
+
{ keys: "c", label: "clear" },
|
|
29279
|
+
{ keys: "s", label: "save" },
|
|
29280
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
29281
|
+
]
|
|
29282
|
+
}
|
|
29283
|
+
)
|
|
29284
|
+
] });
|
|
29285
|
+
}
|
|
29286
|
+
|
|
29163
29287
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
29164
29288
|
async function readCredentials() {
|
|
29165
29289
|
const store = await readV1Store();
|
|
@@ -29186,8 +29310,8 @@ async function writeCredentials(config) {
|
|
|
29186
29310
|
}
|
|
29187
29311
|
|
|
29188
29312
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
29189
|
-
import { jsx as
|
|
29190
|
-
var
|
|
29313
|
+
import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
29314
|
+
var FIELDS3 = [
|
|
29191
29315
|
{ key: "spaceId", label: "Space ID" },
|
|
29192
29316
|
{ key: "environmentId", label: "Environment ID" },
|
|
29193
29317
|
{ key: "cmaToken", label: "CMA Token", masked: true },
|
|
@@ -29207,13 +29331,13 @@ function debugFields(config) {
|
|
|
29207
29331
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
29208
29332
|
};
|
|
29209
29333
|
}
|
|
29210
|
-
var valuesOf = (config) => Object.fromEntries(
|
|
29334
|
+
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
29211
29335
|
function ProjectConfigScreen({ onDone }) {
|
|
29212
|
-
const [config, setConfig] =
|
|
29213
|
-
const [saving, setSaving] =
|
|
29214
|
-
const [notice, setNotice] =
|
|
29215
|
-
const [lastSaved, setLastSaved] =
|
|
29216
|
-
|
|
29336
|
+
const [config, setConfig] = useState32(null);
|
|
29337
|
+
const [saving, setSaving] = useState32(false);
|
|
29338
|
+
const [notice, setNotice] = useState32(null);
|
|
29339
|
+
const [lastSaved, setLastSaved] = useState32(null);
|
|
29340
|
+
useEffect24(() => {
|
|
29217
29341
|
void readCredentials().then((cfg) => {
|
|
29218
29342
|
setConfig(cfg);
|
|
29219
29343
|
startDebugRun({
|
|
@@ -29226,9 +29350,9 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
29226
29350
|
}, []);
|
|
29227
29351
|
if (!config) {
|
|
29228
29352
|
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29229
|
-
/* @__PURE__ */
|
|
29230
|
-
/* @__PURE__ */
|
|
29231
|
-
/* @__PURE__ */
|
|
29353
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
|
|
29354
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
29355
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
|
|
29232
29356
|
] });
|
|
29233
29357
|
}
|
|
29234
29358
|
const save = () => {
|
|
@@ -29248,12 +29372,12 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
29248
29372
|
);
|
|
29249
29373
|
onDone();
|
|
29250
29374
|
};
|
|
29251
|
-
return /* @__PURE__ */
|
|
29375
|
+
return /* @__PURE__ */ jsx59(
|
|
29252
29376
|
FieldForm,
|
|
29253
29377
|
{
|
|
29254
29378
|
title: "Project",
|
|
29255
29379
|
subtitle: "The Contentful space and where the CLI keeps its files.",
|
|
29256
|
-
fields:
|
|
29380
|
+
fields: FIELDS3,
|
|
29257
29381
|
values: valuesOf(config),
|
|
29258
29382
|
onChange: (key, value) => {
|
|
29259
29383
|
setConfig({ ...config, [key]: value });
|
|
@@ -29268,7 +29392,7 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
29268
29392
|
}
|
|
29269
29393
|
|
|
29270
29394
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
29271
|
-
import { jsx as
|
|
29395
|
+
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
29272
29396
|
var SECTIONS = [
|
|
29273
29397
|
{
|
|
29274
29398
|
id: "project",
|
|
@@ -29278,10 +29402,10 @@ var SECTIONS = [
|
|
|
29278
29402
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
29279
29403
|
];
|
|
29280
29404
|
function ConfigurationScreen({ onDone }) {
|
|
29281
|
-
const [focus, setFocus] =
|
|
29282
|
-
const [open, setOpen] =
|
|
29405
|
+
const [focus, setFocus] = useState33(0);
|
|
29406
|
+
const [open, setOpen] = useState33(null);
|
|
29283
29407
|
const close = () => setOpen(null);
|
|
29284
|
-
|
|
29408
|
+
useInput14((input, key) => {
|
|
29285
29409
|
if (open) return;
|
|
29286
29410
|
if (key.upArrow) {
|
|
29287
29411
|
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
@@ -29297,18 +29421,18 @@ function ConfigurationScreen({ onDone }) {
|
|
|
29297
29421
|
}
|
|
29298
29422
|
if (key.escape || input === "q") onDone();
|
|
29299
29423
|
});
|
|
29300
|
-
if (open === "project") return /* @__PURE__ */
|
|
29301
|
-
if (open === "agents") return /* @__PURE__ */
|
|
29424
|
+
if (open === "project") return /* @__PURE__ */ jsx60(ProjectConfigScreen, { onDone: close });
|
|
29425
|
+
if (open === "agents") return /* @__PURE__ */ jsx60(AgentsScreen, { onDone: close });
|
|
29302
29426
|
return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29303
|
-
/* @__PURE__ */
|
|
29304
|
-
/* @__PURE__ */
|
|
29427
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, children: "Configuration" }),
|
|
29428
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
29305
29429
|
SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
|
|
29306
|
-
/* @__PURE__ */
|
|
29307
|
-
/* @__PURE__ */
|
|
29308
|
-
/* @__PURE__ */
|
|
29430
|
+
/* @__PURE__ */ jsx60(Text51, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
|
|
29431
|
+
/* @__PURE__ */ jsx60(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx60(Text51, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
|
|
29432
|
+
/* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: section.description })
|
|
29309
29433
|
] }, section.id)),
|
|
29310
|
-
/* @__PURE__ */
|
|
29311
|
-
/* @__PURE__ */
|
|
29434
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
29435
|
+
/* @__PURE__ */ jsx60(
|
|
29312
29436
|
ControlHints,
|
|
29313
29437
|
{
|
|
29314
29438
|
hints: [
|
|
@@ -29322,8 +29446,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
29322
29446
|
}
|
|
29323
29447
|
|
|
29324
29448
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
29325
|
-
import { useEffect as
|
|
29326
|
-
import { Box as Box49, Text as
|
|
29449
|
+
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
29450
|
+
import { Box as Box49, Text as Text52, useInput as useInput15 } from "ink";
|
|
29327
29451
|
|
|
29328
29452
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
29329
29453
|
async function readAnalyticsSetting() {
|
|
@@ -29342,11 +29466,11 @@ async function writeAnalyticsSetting(setting) {
|
|
|
29342
29466
|
|
|
29343
29467
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
29344
29468
|
init_debug_store();
|
|
29345
|
-
import { Fragment as
|
|
29469
|
+
import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
29346
29470
|
function OptInAnalyticsScreen({ onDone }) {
|
|
29347
|
-
const [loading, setLoading] =
|
|
29348
|
-
const [enabled, setEnabled] =
|
|
29349
|
-
|
|
29471
|
+
const [loading, setLoading] = useState34(true);
|
|
29472
|
+
const [enabled, setEnabled] = useState34(true);
|
|
29473
|
+
useEffect25(() => {
|
|
29350
29474
|
readAnalyticsSetting().then((setting) => {
|
|
29351
29475
|
setEnabled(setting.enabled);
|
|
29352
29476
|
setLoading(false);
|
|
@@ -29358,7 +29482,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29358
29482
|
});
|
|
29359
29483
|
});
|
|
29360
29484
|
}, []);
|
|
29361
|
-
|
|
29485
|
+
useInput15((input, key) => {
|
|
29362
29486
|
if (loading) return;
|
|
29363
29487
|
if (key.return || input === " ") {
|
|
29364
29488
|
setEnabled((current) => {
|
|
@@ -29374,20 +29498,20 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29374
29498
|
}
|
|
29375
29499
|
});
|
|
29376
29500
|
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29377
|
-
/* @__PURE__ */
|
|
29378
|
-
/* @__PURE__ */
|
|
29379
|
-
loading ? /* @__PURE__ */
|
|
29380
|
-
/* @__PURE__ */ jsxs50(
|
|
29501
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
29502
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
29503
|
+
loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment20, { children: [
|
|
29504
|
+
/* @__PURE__ */ jsxs50(Text52, { children: [
|
|
29381
29505
|
"Share anonymous usage data:",
|
|
29382
29506
|
" ",
|
|
29383
|
-
/* @__PURE__ */
|
|
29507
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
29384
29508
|
] }),
|
|
29385
|
-
/* @__PURE__ */
|
|
29386
|
-
/* @__PURE__ */
|
|
29387
|
-
/* @__PURE__ */
|
|
29509
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
29510
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
29511
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
29388
29512
|
] }),
|
|
29389
|
-
/* @__PURE__ */
|
|
29390
|
-
/* @__PURE__ */
|
|
29513
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
29514
|
+
/* @__PURE__ */ jsx61(
|
|
29391
29515
|
ControlHints,
|
|
29392
29516
|
{
|
|
29393
29517
|
hints: [
|
|
@@ -29400,15 +29524,15 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29400
29524
|
}
|
|
29401
29525
|
|
|
29402
29526
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
29403
|
-
import { useEffect as
|
|
29404
|
-
import { Box as Box50, Text as
|
|
29527
|
+
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
29528
|
+
import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
|
|
29405
29529
|
init_version();
|
|
29406
29530
|
init_debug_store();
|
|
29407
|
-
import { jsx as
|
|
29531
|
+
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
29408
29532
|
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
29409
29533
|
function UpgradeScreen({ onDone }) {
|
|
29410
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
29411
|
-
|
|
29534
|
+
const [upgradeCheck, setUpgradeCheck] = useState35();
|
|
29535
|
+
useEffect26(() => {
|
|
29412
29536
|
startDebugRun({
|
|
29413
29537
|
flow: "upgrade",
|
|
29414
29538
|
step: "01-upgrade",
|
|
@@ -29417,7 +29541,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
29417
29541
|
});
|
|
29418
29542
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
29419
29543
|
}, []);
|
|
29420
|
-
|
|
29544
|
+
useInput16((_input, key) => {
|
|
29421
29545
|
if (key.return) {
|
|
29422
29546
|
void finishDebugRun({
|
|
29423
29547
|
outputs: upgradeCheck ?? {},
|
|
@@ -29429,11 +29553,11 @@ function UpgradeScreen({ onDone }) {
|
|
|
29429
29553
|
}
|
|
29430
29554
|
});
|
|
29431
29555
|
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29432
|
-
/* @__PURE__ */
|
|
29433
|
-
/* @__PURE__ */
|
|
29556
|
+
/* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
|
|
29557
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29434
29558
|
renderBody(upgradeCheck),
|
|
29435
|
-
/* @__PURE__ */
|
|
29436
|
-
/* @__PURE__ */ jsxs51(
|
|
29559
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29560
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
|
|
29437
29561
|
FOCUS_MARKER,
|
|
29438
29562
|
" Go Back"
|
|
29439
29563
|
] })
|
|
@@ -29441,47 +29565,47 @@ function UpgradeScreen({ onDone }) {
|
|
|
29441
29565
|
}
|
|
29442
29566
|
function renderBody(upgradeCheck) {
|
|
29443
29567
|
if (!upgradeCheck) {
|
|
29444
|
-
return /* @__PURE__ */
|
|
29568
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
29445
29569
|
}
|
|
29446
29570
|
if (upgradeCheck.status === "error") {
|
|
29447
|
-
return /* @__PURE__ */
|
|
29571
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
29448
29572
|
}
|
|
29449
29573
|
if (upgradeCheck.status === "up-to-date") {
|
|
29450
|
-
return /* @__PURE__ */ jsxs51(
|
|
29574
|
+
return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
|
|
29451
29575
|
"You're already on the latest version (v",
|
|
29452
29576
|
upgradeCheck.current,
|
|
29453
29577
|
")."
|
|
29454
29578
|
] });
|
|
29455
29579
|
}
|
|
29456
29580
|
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
|
|
29457
|
-
/* @__PURE__ */ jsxs51(
|
|
29458
|
-
/* @__PURE__ */ jsxs51(
|
|
29581
|
+
/* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
|
|
29582
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
|
|
29459
29583
|
"v",
|
|
29460
29584
|
upgradeCheck.latest
|
|
29461
29585
|
] }),
|
|
29462
29586
|
" ",
|
|
29463
29587
|
"is available (you're on ",
|
|
29464
|
-
/* @__PURE__ */ jsxs51(
|
|
29588
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
|
|
29465
29589
|
"v",
|
|
29466
29590
|
upgradeCheck.current
|
|
29467
29591
|
] }),
|
|
29468
29592
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
29469
29593
|
] }),
|
|
29470
|
-
/* @__PURE__ */
|
|
29471
|
-
/* @__PURE__ */
|
|
29594
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29595
|
+
/* @__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)) })
|
|
29472
29596
|
] });
|
|
29473
29597
|
}
|
|
29474
29598
|
|
|
29475
29599
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
29476
|
-
import { useEffect as
|
|
29477
|
-
import { Box as Box51, Text as
|
|
29600
|
+
import { useEffect as useEffect27, useState as useState36 } from "react";
|
|
29601
|
+
import { Box as Box51, Text as Text54, useInput as useInput17 } from "ink";
|
|
29478
29602
|
init_debug_mode_store();
|
|
29479
29603
|
init_debug_store();
|
|
29480
|
-
import { jsx as
|
|
29604
|
+
import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
29481
29605
|
function DebugModeScreen({ onDone }) {
|
|
29482
|
-
const [loading, setLoading] =
|
|
29483
|
-
const [enabled, setEnabled] =
|
|
29484
|
-
|
|
29606
|
+
const [loading, setLoading] = useState36(true);
|
|
29607
|
+
const [enabled, setEnabled] = useState36(true);
|
|
29608
|
+
useEffect27(() => {
|
|
29485
29609
|
readDebugModeSetting().then((setting) => {
|
|
29486
29610
|
setEnabled(setting.enabled);
|
|
29487
29611
|
setLoading(false);
|
|
@@ -29493,7 +29617,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
29493
29617
|
});
|
|
29494
29618
|
});
|
|
29495
29619
|
}, []);
|
|
29496
|
-
|
|
29620
|
+
useInput17((input, key) => {
|
|
29497
29621
|
if (loading) return;
|
|
29498
29622
|
if (key.return || input === " ") {
|
|
29499
29623
|
setEnabled((current) => {
|
|
@@ -29509,15 +29633,15 @@ function DebugModeScreen({ onDone }) {
|
|
|
29509
29633
|
}
|
|
29510
29634
|
});
|
|
29511
29635
|
return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29512
|
-
/* @__PURE__ */
|
|
29513
|
-
/* @__PURE__ */
|
|
29514
|
-
loading ? /* @__PURE__ */
|
|
29636
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
29637
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
29638
|
+
loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
|
|
29515
29639
|
"Debug logging:",
|
|
29516
29640
|
" ",
|
|
29517
|
-
/* @__PURE__ */
|
|
29641
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
29518
29642
|
] }),
|
|
29519
|
-
/* @__PURE__ */
|
|
29520
|
-
/* @__PURE__ */
|
|
29643
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
29644
|
+
/* @__PURE__ */ jsx63(
|
|
29521
29645
|
ControlHints,
|
|
29522
29646
|
{
|
|
29523
29647
|
hints: [
|
|
@@ -29530,18 +29654,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
29530
29654
|
}
|
|
29531
29655
|
|
|
29532
29656
|
// packages/experience-design-system-cli/app.tsx
|
|
29533
|
-
import { Fragment as
|
|
29657
|
+
import { Fragment as Fragment21, jsx as jsx64 } from "react/jsx-runtime";
|
|
29534
29658
|
function App({ importOptions, inkClear }) {
|
|
29535
|
-
const [screen, setScreen] =
|
|
29536
|
-
const [importExitCode, setImportExitCode] =
|
|
29659
|
+
const [screen, setScreen] = useState37("start");
|
|
29660
|
+
const [importExitCode, setImportExitCode] = useState37();
|
|
29537
29661
|
const showImportResult = importExitCode !== void 0;
|
|
29538
|
-
const [projectPath, setProjectPath] =
|
|
29539
|
-
const [tokensPath, setTokensPath] =
|
|
29540
|
-
const [scannedFiles, setScannedFiles] =
|
|
29541
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
29542
|
-
const [extractionRun, setExtractionRun] =
|
|
29662
|
+
const [projectPath, setProjectPath] = useState37();
|
|
29663
|
+
const [tokensPath, setTokensPath] = useState37();
|
|
29664
|
+
const [scannedFiles, setScannedFiles] = useState37();
|
|
29665
|
+
const [pendingLaunch, setPendingLaunch] = useState37();
|
|
29666
|
+
const [extractionRun, setExtractionRun] = useState37();
|
|
29543
29667
|
const extraction = useExtraction(extractionRun?.input);
|
|
29544
|
-
const [scopeRun, setScopeRun] =
|
|
29668
|
+
const [scopeRun, setScopeRun] = useState37();
|
|
29545
29669
|
const scopeFlow = useScopeGateFlow(
|
|
29546
29670
|
scopeRun && {
|
|
29547
29671
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -29556,12 +29680,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29556
29680
|
}
|
|
29557
29681
|
}
|
|
29558
29682
|
);
|
|
29559
|
-
const [generationInput, setGenerationInput] =
|
|
29683
|
+
const [generationInput, setGenerationInput] = useState37();
|
|
29560
29684
|
const generation = useGeneration(generationInput);
|
|
29561
|
-
const [flowStart, setFlowStart] =
|
|
29685
|
+
const [flowStart, setFlowStart] = useState37();
|
|
29562
29686
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
29563
|
-
const [importDefaults, setImportDefaults] =
|
|
29564
|
-
|
|
29687
|
+
const [importDefaults, setImportDefaults] = useState37();
|
|
29688
|
+
useEffect28(() => {
|
|
29565
29689
|
if (screen !== "import") {
|
|
29566
29690
|
setImportDefaults(void 0);
|
|
29567
29691
|
return;
|
|
@@ -29621,12 +29745,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29621
29745
|
}
|
|
29622
29746
|
});
|
|
29623
29747
|
};
|
|
29624
|
-
|
|
29748
|
+
useEffect28(() => {
|
|
29625
29749
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
29626
29750
|
setExtractionRun(void 0);
|
|
29627
29751
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
29628
29752
|
}, [extraction, extractionRun]);
|
|
29629
|
-
|
|
29753
|
+
useEffect28(() => {
|
|
29630
29754
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
29631
29755
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
29632
29756
|
setGenerationInput({
|
|
@@ -29644,7 +29768,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29644
29768
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
29645
29769
|
});
|
|
29646
29770
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
29647
|
-
|
|
29771
|
+
useEffect28(() => {
|
|
29648
29772
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
29649
29773
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
29650
29774
|
inkClear();
|
|
@@ -29687,9 +29811,9 @@ function App({ importOptions, inkClear }) {
|
|
|
29687
29811
|
};
|
|
29688
29812
|
switch (screen) {
|
|
29689
29813
|
case "import":
|
|
29690
|
-
if (showImportResult) return /* @__PURE__ */
|
|
29814
|
+
if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
29691
29815
|
if (flow && flowStart) {
|
|
29692
|
-
return /* @__PURE__ */
|
|
29816
|
+
return /* @__PURE__ */ jsx64(
|
|
29693
29817
|
FlowScreen,
|
|
29694
29818
|
{
|
|
29695
29819
|
state: flow.state,
|
|
@@ -29699,12 +29823,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29699
29823
|
}
|
|
29700
29824
|
);
|
|
29701
29825
|
}
|
|
29702
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
29826
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
29703
29827
|
if (projectPath === void 0) {
|
|
29704
|
-
return /* @__PURE__ */
|
|
29828
|
+
return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
29705
29829
|
}
|
|
29706
29830
|
if (tokensPath === void 0) {
|
|
29707
|
-
return /* @__PURE__ */
|
|
29831
|
+
return /* @__PURE__ */ jsx64(
|
|
29708
29832
|
TokenInputScreen,
|
|
29709
29833
|
{
|
|
29710
29834
|
initialPath: importDefaults.tokenFile,
|
|
@@ -29714,7 +29838,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29714
29838
|
);
|
|
29715
29839
|
}
|
|
29716
29840
|
if (scannedFiles === void 0) {
|
|
29717
|
-
return /* @__PURE__ */
|
|
29841
|
+
return /* @__PURE__ */ jsx64(
|
|
29718
29842
|
PathValidationScreen,
|
|
29719
29843
|
{
|
|
29720
29844
|
projectPath,
|
|
@@ -29726,10 +29850,10 @@ function App({ importOptions, inkClear }) {
|
|
|
29726
29850
|
}
|
|
29727
29851
|
if (extractionRun) {
|
|
29728
29852
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
29729
|
-
return /* @__PURE__ */
|
|
29853
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
29730
29854
|
}
|
|
29731
29855
|
if (extraction?.status === "running") {
|
|
29732
|
-
return /* @__PURE__ */
|
|
29856
|
+
return /* @__PURE__ */ jsx64(
|
|
29733
29857
|
ExtractionScreen,
|
|
29734
29858
|
{
|
|
29735
29859
|
progress: extraction.progress,
|
|
@@ -29738,14 +29862,14 @@ function App({ importOptions, inkClear }) {
|
|
|
29738
29862
|
}
|
|
29739
29863
|
);
|
|
29740
29864
|
}
|
|
29741
|
-
return /* @__PURE__ */
|
|
29865
|
+
return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
29742
29866
|
}
|
|
29743
29867
|
if (scopeRun && scopeFlow) {
|
|
29744
29868
|
if (scopeFlow.status === "failed") {
|
|
29745
|
-
return /* @__PURE__ */
|
|
29869
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
29746
29870
|
}
|
|
29747
29871
|
if (scopeFlow.status === "deciding") {
|
|
29748
|
-
return /* @__PURE__ */
|
|
29872
|
+
return /* @__PURE__ */ jsx64(
|
|
29749
29873
|
ScopeGateScreen,
|
|
29750
29874
|
{
|
|
29751
29875
|
components: scopeFlow.load.components,
|
|
@@ -29755,7 +29879,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29755
29879
|
);
|
|
29756
29880
|
}
|
|
29757
29881
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
29758
|
-
return /* @__PURE__ */
|
|
29882
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
29759
29883
|
}
|
|
29760
29884
|
if (generation?.status === "running") {
|
|
29761
29885
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -29763,7 +29887,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29763
29887
|
hasRawTokens,
|
|
29764
29888
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
29765
29889
|
});
|
|
29766
|
-
return /* @__PURE__ */
|
|
29890
|
+
return /* @__PURE__ */ jsx64(
|
|
29767
29891
|
GenerationScreen,
|
|
29768
29892
|
{
|
|
29769
29893
|
progress: generation.progress,
|
|
@@ -29775,10 +29899,10 @@ function App({ importOptions, inkClear }) {
|
|
|
29775
29899
|
}
|
|
29776
29900
|
);
|
|
29777
29901
|
}
|
|
29778
|
-
return /* @__PURE__ */
|
|
29902
|
+
return /* @__PURE__ */ jsx64(Fragment21, {});
|
|
29779
29903
|
}
|
|
29780
29904
|
if (pendingLaunch?.cached) {
|
|
29781
|
-
return /* @__PURE__ */
|
|
29905
|
+
return /* @__PURE__ */ jsx64(
|
|
29782
29906
|
TokenReuseScreen,
|
|
29783
29907
|
{
|
|
29784
29908
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -29789,7 +29913,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29789
29913
|
}
|
|
29790
29914
|
);
|
|
29791
29915
|
}
|
|
29792
|
-
return /* @__PURE__ */
|
|
29916
|
+
return /* @__PURE__ */ jsx64(
|
|
29793
29917
|
CredentialsScreen,
|
|
29794
29918
|
{
|
|
29795
29919
|
initial: importDefaults.credentials,
|
|
@@ -29798,19 +29922,19 @@ function App({ importOptions, inkClear }) {
|
|
|
29798
29922
|
}
|
|
29799
29923
|
);
|
|
29800
29924
|
case "help":
|
|
29801
|
-
return /* @__PURE__ */
|
|
29925
|
+
return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
|
|
29802
29926
|
case "upgrade":
|
|
29803
|
-
return /* @__PURE__ */
|
|
29927
|
+
return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
|
|
29804
29928
|
case "settings":
|
|
29805
|
-
return /* @__PURE__ */
|
|
29929
|
+
return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
29806
29930
|
case "settings-configuration":
|
|
29807
|
-
return /* @__PURE__ */
|
|
29931
|
+
return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
|
|
29808
29932
|
case "settings-opt-in-analytics":
|
|
29809
|
-
return /* @__PURE__ */
|
|
29933
|
+
return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
29810
29934
|
case "settings-debug-mode":
|
|
29811
|
-
return /* @__PURE__ */
|
|
29935
|
+
return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
|
|
29812
29936
|
case "start":
|
|
29813
|
-
return /* @__PURE__ */
|
|
29937
|
+
return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
|
|
29814
29938
|
}
|
|
29815
29939
|
}
|
|
29816
29940
|
async function runApp(renderApp, importOptions) {
|
|
@@ -29818,7 +29942,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
29818
29942
|
instance.clear?.();
|
|
29819
29943
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
29820
29944
|
};
|
|
29821
|
-
const instance = renderApp(/* @__PURE__ */
|
|
29945
|
+
const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
|
|
29822
29946
|
await instance.waitUntilExit();
|
|
29823
29947
|
}
|
|
29824
29948
|
export {
|