@contentful/experience-design-system-cli 2.37.1-dev-build-be7b0e35.0 → 2.37.1-dev-build-2eb3abd8.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.d.ts +1 -1
- package/dist/app.js +237 -1075
- package/dist/index.js +248 -1168
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/contentful-configuration/ContentfulConfigScreen.d.ts +0 -1
- package/package.json +3 -3
- package/dist/src/tui/help/file-locations.d.ts +0 -23
- package/dist/src/tui/settings/agents/AgentDetail.d.ts +0 -13
- package/dist/src/tui/settings/agents/AgentScreens.d.ts +0 -11
- package/dist/src/tui/settings/agents/AgentStatusBadge.d.ts +0 -10
- package/dist/src/tui/settings/agents/agent-status.d.ts +0 -80
- package/dist/src/tui/settings/agents/agent-store.d.ts +0 -17
- package/dist/src/tui/settings/agents/apply-binary-overrides.d.ts +0 -13
- package/dist/src/tui/settings/contentful-configuration/ProjectConfigScreen.d.ts +0 -5
- package/dist/src/tui/settings/shared/FieldForm.d.ts +0 -35
- package/dist/src/tui/upgrade/PageContainer.d.ts +0 -4
package/dist/app.js
CHANGED
|
@@ -837,7 +837,7 @@ async function runAgent(options) {
|
|
|
837
837
|
promptLen: prompt.length,
|
|
838
838
|
promptHead: prompt.slice(0, 500)
|
|
839
839
|
});
|
|
840
|
-
return new Promise((
|
|
840
|
+
return new Promise((resolve27) => {
|
|
841
841
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
842
842
|
const child = spawn(binary, args, {
|
|
843
843
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -886,7 +886,7 @@ async function runAgent(options) {
|
|
|
886
886
|
stderrLen: stderr.length,
|
|
887
887
|
stderrTail: stderr.slice(-1e3)
|
|
888
888
|
});
|
|
889
|
-
|
|
889
|
+
resolve27(result);
|
|
890
890
|
});
|
|
891
891
|
});
|
|
892
892
|
}
|
|
@@ -908,7 +908,7 @@ async function checkAgentAuth(agent) {
|
|
|
908
908
|
return "not-found";
|
|
909
909
|
if (agent !== "claude")
|
|
910
910
|
return "ok";
|
|
911
|
-
return new Promise((
|
|
911
|
+
return new Promise((resolve27) => {
|
|
912
912
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
913
913
|
let stdout = "";
|
|
914
914
|
let done = false;
|
|
@@ -917,7 +917,7 @@ async function checkAgentAuth(agent) {
|
|
|
917
917
|
return;
|
|
918
918
|
done = true;
|
|
919
919
|
child.kill("SIGTERM");
|
|
920
|
-
|
|
920
|
+
resolve27("unauthenticated");
|
|
921
921
|
}, 5e3);
|
|
922
922
|
child.stdout?.on("data", (chunk) => {
|
|
923
923
|
stdout += chunk.toString();
|
|
@@ -928,14 +928,14 @@ async function checkAgentAuth(agent) {
|
|
|
928
928
|
done = true;
|
|
929
929
|
clearTimeout(timer);
|
|
930
930
|
if (code !== 0) {
|
|
931
|
-
|
|
931
|
+
resolve27("unauthenticated");
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
934
|
try {
|
|
935
935
|
const status = JSON.parse(stdout);
|
|
936
|
-
|
|
936
|
+
resolve27(status.loggedIn ? "ok" : "unauthenticated");
|
|
937
937
|
} catch {
|
|
938
|
-
|
|
938
|
+
resolve27("unauthenticated");
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
941
|
});
|
|
@@ -945,9 +945,9 @@ async function binaryIsOnPath(binary) {
|
|
|
945
945
|
const fs = await import("node:fs/promises");
|
|
946
946
|
return fs.access(binary).then(() => true, () => false);
|
|
947
947
|
}
|
|
948
|
-
return new Promise((
|
|
948
|
+
return new Promise((resolve27) => {
|
|
949
949
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
950
|
-
child.on("close", (code) =>
|
|
950
|
+
child.on("close", (code) => resolve27(code === 0));
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
953
|
var init_check_agent_auth = __esm({
|
|
@@ -2329,8 +2329,8 @@ var init_debug_store = __esm({
|
|
|
2329
2329
|
});
|
|
2330
2330
|
|
|
2331
2331
|
// packages/experience-design-system-cli/app.tsx
|
|
2332
|
-
import { join as
|
|
2333
|
-
import { useEffect as
|
|
2332
|
+
import { join as join25 } from "node:path";
|
|
2333
|
+
import { useEffect as useEffect25, useState as useState32 } 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";
|
|
@@ -2431,18 +2431,17 @@ var SUBTITLE = "Let's import your design system into Contentful";
|
|
|
2431
2431
|
var MIN_TERMINAL_WIDTH = 164;
|
|
2432
2432
|
var START_ITEMS = [
|
|
2433
2433
|
{ label: "Import", screen: "import" },
|
|
2434
|
-
{ label: "Upgrade Version", screen: "upgrade" },
|
|
2435
2434
|
{ label: "Settings", screen: "settings" },
|
|
2436
2435
|
{ label: "Help", screen: "help" }
|
|
2437
2436
|
];
|
|
2438
|
-
function
|
|
2437
|
+
function versionStatus(upgradeCheck) {
|
|
2439
2438
|
if (upgradeCheck?.status === "update-available") {
|
|
2440
|
-
return {
|
|
2439
|
+
return { text: ` (upgrade available v${upgradeCheck.latest})`, color: PALETTE.warning };
|
|
2441
2440
|
}
|
|
2442
2441
|
if (upgradeCheck?.status === "up-to-date") {
|
|
2443
|
-
return {
|
|
2442
|
+
return { text: " (up to date)", color: PALETTE.muted };
|
|
2444
2443
|
}
|
|
2445
|
-
return
|
|
2444
|
+
return void 0;
|
|
2446
2445
|
}
|
|
2447
2446
|
function HomeScreen({ onNavigate }) {
|
|
2448
2447
|
const [focusIdx, setFocusIdx] = useState2(0);
|
|
@@ -2450,7 +2449,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
2450
2449
|
const { exit } = useApp();
|
|
2451
2450
|
const terminalWidth = useTerminalWidth();
|
|
2452
2451
|
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
2453
|
-
const
|
|
2452
|
+
const status = versionStatus(upgradeCheck);
|
|
2454
2453
|
useEffect2(() => {
|
|
2455
2454
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
2456
2455
|
}, []);
|
|
@@ -2470,7 +2469,6 @@ function HomeScreen({ onNavigate }) {
|
|
|
2470
2469
|
}
|
|
2471
2470
|
if (key.return) {
|
|
2472
2471
|
const item = START_ITEMS[focusIdx];
|
|
2473
|
-
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
2474
2472
|
onNavigate(item.screen);
|
|
2475
2473
|
return;
|
|
2476
2474
|
}
|
|
@@ -2488,26 +2486,16 @@ function HomeScreen({ onNavigate }) {
|
|
|
2488
2486
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
2489
2487
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
2490
2488
|
"v",
|
|
2491
|
-
VERSION
|
|
2489
|
+
VERSION,
|
|
2490
|
+
status && /* @__PURE__ */ jsx2(Text2, { color: status.color, children: status.text })
|
|
2492
2491
|
] })
|
|
2493
2492
|
] }),
|
|
2494
2493
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
2495
2494
|
const focused = i === focusIdx;
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
2499
|
-
return /* @__PURE__ */ jsxs(
|
|
2500
|
-
Text2,
|
|
2501
|
-
{
|
|
2502
|
-
bold: focused && !dimmed,
|
|
2503
|
-
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
2504
|
-
children: [
|
|
2505
|
-
focused ? `${FOCUS_MARKER} ` : " ",
|
|
2506
|
-
display.label
|
|
2507
|
-
]
|
|
2508
|
-
},
|
|
2495
|
+
return /* @__PURE__ */ jsxs(Text2, { bold: focused, color: focused ? PALETTE.accent : void 0, children: [
|
|
2496
|
+
focused ? `${FOCUS_MARKER} ` : " ",
|
|
2509
2497
|
item.label
|
|
2510
|
-
);
|
|
2498
|
+
] }, item.label);
|
|
2511
2499
|
}) }) }),
|
|
2512
2500
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
2513
2501
|
ControlHints,
|
|
@@ -8453,10 +8441,10 @@ function extractVueSlotsFromSetup(options) {
|
|
|
8453
8441
|
if (!body)
|
|
8454
8442
|
return [];
|
|
8455
8443
|
const slotsByName = /* @__PURE__ */ new Map();
|
|
8456
|
-
for (const
|
|
8457
|
-
if (
|
|
8444
|
+
for (const access6 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
|
|
8445
|
+
if (access6.getExpression().getText() !== slotsName)
|
|
8458
8446
|
continue;
|
|
8459
|
-
const slotName =
|
|
8447
|
+
const slotName = access6.getName();
|
|
8460
8448
|
if (!slotsByName.has(slotName)) {
|
|
8461
8449
|
slotsByName.set(slotName, {
|
|
8462
8450
|
name: slotName,
|
|
@@ -13846,7 +13834,7 @@ function errorMessage(error) {
|
|
|
13846
13834
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
13847
13835
|
}
|
|
13848
13836
|
function defaultSleep(delayMs) {
|
|
13849
|
-
return new Promise((
|
|
13837
|
+
return new Promise((resolve27) => setTimeout(resolve27, delayMs));
|
|
13850
13838
|
}
|
|
13851
13839
|
|
|
13852
13840
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
|
|
@@ -14087,7 +14075,7 @@ var ApiClient = class {
|
|
|
14087
14075
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14088
14076
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14089
14077
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14090
|
-
await new Promise((
|
|
14078
|
+
await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
|
|
14091
14079
|
}
|
|
14092
14080
|
}
|
|
14093
14081
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -14572,7 +14560,6 @@ function readTokensFromPath2(request) {
|
|
|
14572
14560
|
init_agents();
|
|
14573
14561
|
init_agent_name();
|
|
14574
14562
|
init_models();
|
|
14575
|
-
init_binaries();
|
|
14576
14563
|
init_is_agent_name();
|
|
14577
14564
|
init_agent_supports_bedrock();
|
|
14578
14565
|
init_check_agent_auth();
|
|
@@ -16397,7 +16384,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
16397
16384
|
const message = error instanceof Error ? error.message : String(error);
|
|
16398
16385
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
16399
16386
|
throw error;
|
|
16400
|
-
await new Promise((
|
|
16387
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
|
|
16401
16388
|
}
|
|
16402
16389
|
}
|
|
16403
16390
|
}
|
|
@@ -28031,7 +28018,7 @@ var realSaveDeps = () => ({
|
|
|
28031
28018
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
28032
28019
|
appendRun,
|
|
28033
28020
|
buildSourceFingerprint,
|
|
28034
|
-
sleep: (ms) => new Promise((
|
|
28021
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
28035
28022
|
warn: (message) => process.stderr.write(message)
|
|
28036
28023
|
});
|
|
28037
28024
|
async function runPrintFiles(input, deps, onPatch) {
|
|
@@ -28421,44 +28408,12 @@ init_config();
|
|
|
28421
28408
|
init_debug_store();
|
|
28422
28409
|
init_debug_mode_store();
|
|
28423
28410
|
init_version();
|
|
28424
|
-
|
|
28425
|
-
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
28426
|
-
import { join as join25, resolve as resolve27 } from "node:path";
|
|
28427
|
-
function describeFileLocations({
|
|
28428
|
-
contentfulBaseDir,
|
|
28429
|
-
debugModeEnabled,
|
|
28430
|
-
currentSessionDir: currentSessionDir2
|
|
28431
|
-
}) {
|
|
28432
|
-
if (!debugModeEnabled) {
|
|
28433
|
-
return {
|
|
28434
|
-
debugLogs: "none while Debug Mode is off",
|
|
28435
|
-
importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
28436
|
-
};
|
|
28437
|
-
}
|
|
28438
|
-
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
28439
|
-
const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
|
|
28440
|
-
return {
|
|
28441
|
-
debugLogs: join25(session, "debug"),
|
|
28442
|
-
importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
28443
|
-
};
|
|
28444
|
-
}
|
|
28445
|
-
|
|
28446
|
-
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
28447
28411
|
async function readHelpInfo() {
|
|
28448
|
-
const
|
|
28449
|
-
const base = settings["contentfulBaseDir"];
|
|
28450
|
-
const locations = describeFileLocations({
|
|
28451
|
-
contentfulBaseDir: typeof base === "string" ? base : "",
|
|
28452
|
-
debugModeEnabled: debugMode.enabled,
|
|
28453
|
-
currentSessionDir: currentSessionDir()
|
|
28454
|
-
});
|
|
28412
|
+
const debugMode = await readDebugModeSetting();
|
|
28455
28413
|
return {
|
|
28456
28414
|
storage: [
|
|
28457
28415
|
{ label: "Config folder", value: configRoot2() },
|
|
28458
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
28459
|
-
{ label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
|
|
28460
|
-
{ label: "Debug logs", value: locations.debugLogs },
|
|
28461
|
-
{ label: "Import files", value: locations.importFiles }
|
|
28416
|
+
{ label: "Settings file", value: configFilePath2() }
|
|
28462
28417
|
],
|
|
28463
28418
|
troubleshooting: [
|
|
28464
28419
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -28479,7 +28434,7 @@ function Section({ title, rows }) {
|
|
|
28479
28434
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
28480
28435
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
28481
28436
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
28482
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
28437
|
+
/* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
28483
28438
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
28484
28439
|
] }, row.label))
|
|
28485
28440
|
] });
|
|
@@ -28579,776 +28534,15 @@ function SettingsScreen({
|
|
|
28579
28534
|
}
|
|
28580
28535
|
|
|
28581
28536
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
28582
|
-
import { useState as
|
|
28583
|
-
import { Box as
|
|
28584
|
-
|
|
28585
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
28586
|
-
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
28587
|
-
import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
|
|
28588
|
-
init_debug_store();
|
|
28537
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
28538
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
28539
|
+
import TextInput4 from "ink-text-input";
|
|
28589
28540
|
|
|
28590
28541
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
28591
28542
|
init_config();
|
|
28592
28543
|
var readV1Store = readSettings2;
|
|
28593
28544
|
var writeV1Store = writeSettings2;
|
|
28594
28545
|
|
|
28595
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
|
|
28596
|
-
var DEFAULT_AGENT3 = "claude";
|
|
28597
|
-
var AGENT_LABELS = {
|
|
28598
|
-
claude: "Claude Code",
|
|
28599
|
-
codex: "OpenAI Codex",
|
|
28600
|
-
opencode: "OpenCode",
|
|
28601
|
-
cursor: "Cursor",
|
|
28602
|
-
copilot: "GitHub Copilot"
|
|
28603
|
-
};
|
|
28604
|
-
var AGENT_HINTS = {
|
|
28605
|
-
claude: "claude",
|
|
28606
|
-
codex: "codex",
|
|
28607
|
-
opencode: "opencode",
|
|
28608
|
-
cursor: "cursor-agent",
|
|
28609
|
-
copilot: "copilot"
|
|
28610
|
-
};
|
|
28611
|
-
var asString = (value) => typeof value === "string" ? value : "";
|
|
28612
|
-
function emptyAgents() {
|
|
28613
|
-
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
28614
|
-
}
|
|
28615
|
-
async function readAgentConfig() {
|
|
28616
|
-
const store = await readV1Store();
|
|
28617
|
-
const stored = asString(store["agent"]);
|
|
28618
|
-
const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
|
|
28619
|
-
const agents = emptyAgents();
|
|
28620
|
-
const saved = store["agents"];
|
|
28621
|
-
if (saved && typeof saved === "object") {
|
|
28622
|
-
for (const name of AGENT_NAMES) {
|
|
28623
|
-
const entry = saved[name];
|
|
28624
|
-
if (entry && typeof entry === "object") {
|
|
28625
|
-
const fields = entry;
|
|
28626
|
-
agents[name] = { model: asString(fields["model"]), binary: asString(fields["binary"]) };
|
|
28627
|
-
}
|
|
28628
|
-
}
|
|
28629
|
-
}
|
|
28630
|
-
const legacyModel = asString(store["agentModel"]);
|
|
28631
|
-
if (legacyModel && !agents[defaultAgent].model)
|
|
28632
|
-
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
28633
|
-
return { defaultAgent, agents };
|
|
28634
|
-
}
|
|
28635
|
-
async function writeAgentConfig(config) {
|
|
28636
|
-
const existing = await readV1Store();
|
|
28637
|
-
const merged = { ...existing };
|
|
28638
|
-
const agents = {};
|
|
28639
|
-
for (const name of AGENT_NAMES) {
|
|
28640
|
-
const model = config.agents[name].model.trim();
|
|
28641
|
-
const binary = config.agents[name].binary.trim();
|
|
28642
|
-
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
28643
|
-
}
|
|
28644
|
-
merged["agent"] = config.defaultAgent;
|
|
28645
|
-
const defaultModel = agents[config.defaultAgent]?.model;
|
|
28646
|
-
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
28647
|
-
else delete merged["agentModel"];
|
|
28648
|
-
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
28649
|
-
else delete merged["agents"];
|
|
28650
|
-
await writeV1Store(merged);
|
|
28651
|
-
}
|
|
28652
|
-
|
|
28653
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
|
|
28654
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
28655
|
-
import { access as access6, constants } from "node:fs/promises";
|
|
28656
|
-
var VERSION_TIMEOUT_MS = 5e3;
|
|
28657
|
-
var PROMPT_TIMEOUT_MS = 6e4;
|
|
28658
|
-
var TEST_PROMPT = "Reply with the single word: ok";
|
|
28659
|
-
var INSTALL_HINTS = {
|
|
28660
|
-
claude: "npm install -g @anthropic-ai/claude-code",
|
|
28661
|
-
codex: "npm install -g @openai/codex",
|
|
28662
|
-
opencode: "npm install -g opencode-ai",
|
|
28663
|
-
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
28664
|
-
copilot: "npm install -g @github/copilot"
|
|
28665
|
-
};
|
|
28666
|
-
var LOGIN_HINTS = {
|
|
28667
|
-
claude: "run `claude login`",
|
|
28668
|
-
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
28669
|
-
opencode: "run `opencode auth`",
|
|
28670
|
-
cursor: "sign in from Cursor",
|
|
28671
|
-
copilot: "run `copilot` and sign in"
|
|
28672
|
-
};
|
|
28673
|
-
function effectiveBinary(name, savedBinary) {
|
|
28674
|
-
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
28675
|
-
}
|
|
28676
|
-
function defaultModelLabel(name) {
|
|
28677
|
-
const model = DEFAULT_MODELS[name];
|
|
28678
|
-
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
28679
|
-
}
|
|
28680
|
-
var fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
28681
|
-
var pass = (step, detail) => ({ step, ok: true, detail });
|
|
28682
|
-
function resolveOnPath(binary) {
|
|
28683
|
-
if (binary.includes("/")) {
|
|
28684
|
-
return access6(binary, constants.X_OK).then(
|
|
28685
|
-
() => binary,
|
|
28686
|
-
() => null
|
|
28687
|
-
);
|
|
28688
|
-
}
|
|
28689
|
-
return new Promise((resolve28) => {
|
|
28690
|
-
execFile2(
|
|
28691
|
-
process.platform === "win32" ? "where" : "which",
|
|
28692
|
-
[binary],
|
|
28693
|
-
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
28694
|
-
);
|
|
28695
|
-
});
|
|
28696
|
-
}
|
|
28697
|
-
function readVersion(binary) {
|
|
28698
|
-
return new Promise((resolve28) => {
|
|
28699
|
-
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
28700
|
-
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
28701
|
-
if (!error && line) resolve28(pass("version", line));
|
|
28702
|
-
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
28703
|
-
});
|
|
28704
|
-
});
|
|
28705
|
-
}
|
|
28706
|
-
async function inspectAgent(name, binary) {
|
|
28707
|
-
const target = effectiveBinary(name, binary);
|
|
28708
|
-
const found = await resolveOnPath(target);
|
|
28709
|
-
if (!found) return [fail3("path", `\`${target}\` was not found or is not executable`)];
|
|
28710
|
-
const checks = [pass("path", found)];
|
|
28711
|
-
checks.push(await readVersion(found));
|
|
28712
|
-
if (name === "claude") {
|
|
28713
|
-
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
28714
|
-
checks.push(
|
|
28715
|
-
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
28716
|
-
);
|
|
28717
|
-
}
|
|
28718
|
-
return checks;
|
|
28719
|
-
}
|
|
28720
|
-
async function testAgent(name, binary, model) {
|
|
28721
|
-
const checks = await inspectAgent(name, binary);
|
|
28722
|
-
if (!checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
28723
|
-
const target = effectiveBinary(name, binary);
|
|
28724
|
-
const found = await resolveOnPath(target) ?? target;
|
|
28725
|
-
const started = Date.now();
|
|
28726
|
-
const result = await withBinaryEnv(
|
|
28727
|
-
name,
|
|
28728
|
-
found,
|
|
28729
|
-
() => createLocalCliAgentInvoker().invoke({
|
|
28730
|
-
agent: name,
|
|
28731
|
-
...model.trim() ? { model: model.trim() } : {},
|
|
28732
|
-
prompt: TEST_PROMPT,
|
|
28733
|
-
timeoutMs: PROMPT_TIMEOUT_MS
|
|
28734
|
-
})
|
|
28735
|
-
);
|
|
28736
|
-
const seconds = ((Date.now() - started) / 1e3).toFixed(1);
|
|
28737
|
-
if (result.timedOut) {
|
|
28738
|
-
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
28739
|
-
}
|
|
28740
|
-
if (result.exitCode !== 0) {
|
|
28741
|
-
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
28742
|
-
return [...checks, fail3("prompt", reason)];
|
|
28743
|
-
}
|
|
28744
|
-
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
28745
|
-
}
|
|
28746
|
-
function statusFromChecks(name, checks, savedBinary) {
|
|
28747
|
-
if (checks.length === 0) return "checking";
|
|
28748
|
-
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
28749
|
-
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
28750
|
-
}
|
|
28751
|
-
const prompt = checks.find((check) => check.step === "prompt");
|
|
28752
|
-
if (prompt) {
|
|
28753
|
-
if (prompt.ok) return "ready";
|
|
28754
|
-
return prompt.timedOut ? "timed-out" : "test-failed";
|
|
28755
|
-
}
|
|
28756
|
-
const login = checks.find((check) => check.step === "login");
|
|
28757
|
-
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
28758
|
-
return name === "claude" ? "ready" : "unknown";
|
|
28759
|
-
}
|
|
28760
|
-
function setupHint(name, status) {
|
|
28761
|
-
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
28762
|
-
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
28763
|
-
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
28764
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
28765
|
-
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
28766
|
-
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
28767
|
-
return "";
|
|
28768
|
-
}
|
|
28769
|
-
function testOutcome(checks) {
|
|
28770
|
-
const prompt = checks?.find((check) => check.step === "prompt");
|
|
28771
|
-
if (!prompt) return void 0;
|
|
28772
|
-
if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
|
|
28773
|
-
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
28774
|
-
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
28775
|
-
}
|
|
28776
|
-
var LIST_STATUS = {
|
|
28777
|
-
checking: { symbol: "\u2026", text: "checking", tone: "muted" },
|
|
28778
|
-
ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
|
|
28779
|
-
"not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
|
|
28780
|
-
"not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
|
|
28781
|
-
"not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
|
|
28782
|
-
"test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
|
|
28783
|
-
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
28784
|
-
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
28785
|
-
};
|
|
28786
|
-
function modelLine(name, savedModel) {
|
|
28787
|
-
const model = savedModel.trim();
|
|
28788
|
-
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
28789
|
-
}
|
|
28790
|
-
function panelRows(name, checks, settings) {
|
|
28791
|
-
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
28792
|
-
const status = statusFromChecks(name, checks, settings.binary);
|
|
28793
|
-
const path5 = checks.find((check) => check.step === "path");
|
|
28794
|
-
if (!path5?.ok) {
|
|
28795
|
-
const rows2 = [
|
|
28796
|
-
{
|
|
28797
|
-
label: "Command",
|
|
28798
|
-
value: settings.binary.trim() ? path5?.detail ?? "not found" : "not found on your PATH",
|
|
28799
|
-
tone: settings.binary.trim() ? "bad" : "muted"
|
|
28800
|
-
}
|
|
28801
|
-
];
|
|
28802
|
-
const hint2 = setupHint(name, status);
|
|
28803
|
-
if (hint2) rows2.push({ label: "Setup", value: hint2, tone: "muted" });
|
|
28804
|
-
return rows2;
|
|
28805
|
-
}
|
|
28806
|
-
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
28807
|
-
const version = checks.find((check) => check.step === "version");
|
|
28808
|
-
if (version?.ok) rows.push({ label: "Version", value: version.detail, tone: "ok" });
|
|
28809
|
-
rows.push({ label: "Model", value: modelLine(name, settings.model), tone: "muted" });
|
|
28810
|
-
const hint = setupHint(name, status);
|
|
28811
|
-
if (hint) rows.push({ label: "Setup", value: hint, tone: "muted" });
|
|
28812
|
-
return rows;
|
|
28813
|
-
}
|
|
28814
|
-
function statusRows(_name, checks, savedBinary) {
|
|
28815
|
-
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
28816
|
-
const find = (step) => checks.find((check) => check.step === step);
|
|
28817
|
-
const path5 = find("path");
|
|
28818
|
-
if (!path5?.ok) {
|
|
28819
|
-
if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
|
|
28820
|
-
return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
|
|
28821
|
-
}
|
|
28822
|
-
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
28823
|
-
const version = find("version");
|
|
28824
|
-
if (version) {
|
|
28825
|
-
rows.push({
|
|
28826
|
-
label: "Version",
|
|
28827
|
-
value: version.ok ? version.detail : "could not be read",
|
|
28828
|
-
tone: version.ok ? "ok" : "muted"
|
|
28829
|
-
});
|
|
28830
|
-
}
|
|
28831
|
-
const login = find("login");
|
|
28832
|
-
const prompt = find("prompt");
|
|
28833
|
-
if (login) {
|
|
28834
|
-
rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
|
|
28835
|
-
} else if (prompt) {
|
|
28836
|
-
rows.push({
|
|
28837
|
-
label: "Login",
|
|
28838
|
-
value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
|
|
28839
|
-
tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
|
|
28840
|
-
});
|
|
28841
|
-
} else {
|
|
28842
|
-
rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
|
|
28843
|
-
}
|
|
28844
|
-
if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
|
|
28845
|
-
return rows;
|
|
28846
|
-
}
|
|
28847
|
-
async function withBinaryEnv(name, binary, run) {
|
|
28848
|
-
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
28849
|
-
const previous = process.env[key];
|
|
28850
|
-
process.env[key] = binary;
|
|
28851
|
-
try {
|
|
28852
|
-
return await run();
|
|
28853
|
-
} finally {
|
|
28854
|
-
if (previous === void 0) delete process.env[key];
|
|
28855
|
-
else process.env[key] = previous;
|
|
28856
|
-
}
|
|
28857
|
-
}
|
|
28858
|
-
|
|
28859
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
28860
|
-
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
28861
|
-
import { Box as Box44, Text as Text47, useInput as useInput11 } from "ink";
|
|
28862
|
-
import TextInput4 from "ink-text-input";
|
|
28863
|
-
|
|
28864
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
|
|
28865
|
-
import { Text as Text46 } from "ink";
|
|
28866
|
-
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
28867
|
-
var TONE_COLOR = {
|
|
28868
|
-
ok: PALETTE.success,
|
|
28869
|
-
bad: PALETTE.error,
|
|
28870
|
-
muted: PALETTE.muted
|
|
28871
|
-
};
|
|
28872
|
-
function AgentStatusBadge({
|
|
28873
|
-
name,
|
|
28874
|
-
checks,
|
|
28875
|
-
binary
|
|
28876
|
-
}) {
|
|
28877
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
28878
|
-
return /* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
28879
|
-
}
|
|
28880
|
-
|
|
28881
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts
|
|
28882
|
-
var shellValues = /* @__PURE__ */ new Map();
|
|
28883
|
-
function applyBinaryOverrides(config) {
|
|
28884
|
-
for (const name of AGENT_NAMES) {
|
|
28885
|
-
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
28886
|
-
const binary = config.agents[name].binary.trim();
|
|
28887
|
-
if (binary) {
|
|
28888
|
-
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
28889
|
-
process.env[key] = binary;
|
|
28890
|
-
} else if (shellValues.has(key)) {
|
|
28891
|
-
const shellValue = shellValues.get(key);
|
|
28892
|
-
if (shellValue === void 0) delete process.env[key];
|
|
28893
|
-
else process.env[key] = shellValue;
|
|
28894
|
-
shellValues.delete(key);
|
|
28895
|
-
}
|
|
28896
|
-
}
|
|
28897
|
-
}
|
|
28898
|
-
|
|
28899
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
28900
|
-
import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28901
|
-
var FOCUS_ORDER = ["binary", "model", "test"];
|
|
28902
|
-
var FIELDS2 = ["binary", "model"];
|
|
28903
|
-
var FIELD_LABEL = { binary: "Command path", model: "Model" };
|
|
28904
|
-
var LABEL_WIDTH = "Command path".length;
|
|
28905
|
-
var LABEL_GAP = 2;
|
|
28906
|
-
var POINTER_WIDTH = 2;
|
|
28907
|
-
var fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
|
|
28908
|
-
function Row2({
|
|
28909
|
-
pointer,
|
|
28910
|
-
label,
|
|
28911
|
-
labelProps,
|
|
28912
|
-
children
|
|
28913
|
-
}) {
|
|
28914
|
-
return /* @__PURE__ */ jsxs45(Box44, { children: [
|
|
28915
|
-
/* @__PURE__ */ jsx56(Box44, { width: POINTER_WIDTH, flexShrink: 0, children: pointer }),
|
|
28916
|
-
/* @__PURE__ */ jsx56(Box44, { width: LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, ...labelProps, children: label }) }),
|
|
28917
|
-
children
|
|
28918
|
-
] });
|
|
28919
|
-
}
|
|
28920
|
-
function Section2({
|
|
28921
|
-
title,
|
|
28922
|
-
note,
|
|
28923
|
-
interactive = false,
|
|
28924
|
-
children
|
|
28925
|
-
}) {
|
|
28926
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
|
|
28927
|
-
/* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28928
|
-
/* @__PURE__ */ jsx56(Text47, { bold: true, color: interactive ? PALETTE.accent : PALETTE.muted, children: title }),
|
|
28929
|
-
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: `\xB7 ${note}` })
|
|
28930
|
-
] }),
|
|
28931
|
-
children
|
|
28932
|
-
] });
|
|
28933
|
-
}
|
|
28934
|
-
function AgentDetail({
|
|
28935
|
-
name,
|
|
28936
|
-
config,
|
|
28937
|
-
setConfig,
|
|
28938
|
-
onBack
|
|
28939
|
-
}) {
|
|
28940
|
-
const settings = config.agents[name];
|
|
28941
|
-
const [focusIndex, setFocusIndex] = useState29(0);
|
|
28942
|
-
const [editing, setEditing] = useState29(false);
|
|
28943
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28944
|
-
const [saving, setSaving] = useState29(false);
|
|
28945
|
-
const [testing, setTesting] = useState29(false);
|
|
28946
|
-
const [notice, setNotice] = useState29(null);
|
|
28947
|
-
const [checks, setChecks] = useState29(void 0);
|
|
28948
|
-
useEffect22(() => {
|
|
28949
|
-
let active = true;
|
|
28950
|
-
setChecks(void 0);
|
|
28951
|
-
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
28952
|
-
return () => {
|
|
28953
|
-
active = false;
|
|
28954
|
-
};
|
|
28955
|
-
}, [name, settings.binary]);
|
|
28956
|
-
const setField = (field, value) => {
|
|
28957
|
-
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
|
|
28958
|
-
setNotice(null);
|
|
28959
|
-
};
|
|
28960
|
-
const save = () => {
|
|
28961
|
-
setSaving(true);
|
|
28962
|
-
setNotice(null);
|
|
28963
|
-
writeAgentConfig(config).then(() => {
|
|
28964
|
-
applyBinaryOverrides(config);
|
|
28965
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
28966
|
-
}).catch(
|
|
28967
|
-
(err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
|
|
28968
|
-
).finally(() => setSaving(false));
|
|
28969
|
-
};
|
|
28970
|
-
const runTest = () => {
|
|
28971
|
-
setTesting(true);
|
|
28972
|
-
setNotice(null);
|
|
28973
|
-
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
28974
|
-
setChecks(result);
|
|
28975
|
-
const outcome = testOutcome(result);
|
|
28976
|
-
setNotice(
|
|
28977
|
-
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
28978
|
-
);
|
|
28979
|
-
}).catch(
|
|
28980
|
-
(err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
|
|
28981
|
-
).finally(() => setTesting(false));
|
|
28982
|
-
};
|
|
28983
|
-
const focused = FOCUS_ORDER[focusIndex];
|
|
28984
|
-
const focusedField = focused === "test" ? null : focused;
|
|
28985
|
-
useInput11((input, key) => {
|
|
28986
|
-
if (saving || testing) return;
|
|
28987
|
-
if (editing) {
|
|
28988
|
-
if (key.escape && focusedField) {
|
|
28989
|
-
setField(focusedField, valueBeforeEdit);
|
|
28990
|
-
setEditing(false);
|
|
28991
|
-
}
|
|
28992
|
-
return;
|
|
28993
|
-
}
|
|
28994
|
-
if (key.escape || input === "q") {
|
|
28995
|
-
onBack();
|
|
28996
|
-
return;
|
|
28997
|
-
}
|
|
28998
|
-
if (input === "s") {
|
|
28999
|
-
save();
|
|
29000
|
-
return;
|
|
29001
|
-
}
|
|
29002
|
-
if (key.upArrow) {
|
|
29003
|
-
setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
|
|
29004
|
-
return;
|
|
29005
|
-
}
|
|
29006
|
-
if (key.downArrow || key.tab) {
|
|
29007
|
-
setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
|
|
29008
|
-
return;
|
|
29009
|
-
}
|
|
29010
|
-
if (input === "c" && focusedField) {
|
|
29011
|
-
setField(focusedField, "");
|
|
29012
|
-
return;
|
|
29013
|
-
}
|
|
29014
|
-
if (key.return) {
|
|
29015
|
-
if (focusedField) {
|
|
29016
|
-
setValueBeforeEdit(settings[focusedField]);
|
|
29017
|
-
setEditing(true);
|
|
29018
|
-
} else {
|
|
29019
|
-
runTest();
|
|
29020
|
-
}
|
|
29021
|
-
}
|
|
29022
|
-
});
|
|
29023
|
-
const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
|
|
29024
|
-
const hint = setupHint(name, status);
|
|
29025
|
-
const pointer = (isFocused) => /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
29026
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29027
|
-
/* @__PURE__ */ jsx56(Text47, { bold: true, children: AGENT_LABELS[name] }),
|
|
29028
|
-
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
|
|
29029
|
-
(notice || testing || saving) && /* @__PURE__ */ jsx56(Box44, { marginTop: 1, children: testing || saving ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: testing ? "\u2026 Running the test (up to 60s)" : "\u2026 Saving" }) : notice && /* @__PURE__ */ jsxs45(Text47, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
29030
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
29031
|
-
" ",
|
|
29032
|
-
notice.text
|
|
29033
|
-
] }) }),
|
|
29034
|
-
/* @__PURE__ */ jsxs45(Section2, { title: "CONFIGURE", note: "you can change these", interactive: true, children: [
|
|
29035
|
-
FIELDS2.map((field) => {
|
|
29036
|
-
const isFocused = focused === field;
|
|
29037
|
-
const value = settings[field];
|
|
29038
|
-
const display = isFocused && editing ? /* @__PURE__ */ jsx56(TextInput4, { value, onChange: (next) => setField(field, next), onSubmit: () => setEditing(false) }) : value ? /* @__PURE__ */ jsx56(Text47, { bold: true, children: value }) : /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: fieldHint(name, field) });
|
|
29039
|
-
return /* @__PURE__ */ jsx56(
|
|
29040
|
-
Row2,
|
|
29041
|
-
{
|
|
29042
|
-
pointer: pointer(isFocused),
|
|
29043
|
-
label: FIELD_LABEL[field],
|
|
29044
|
-
labelProps: { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted },
|
|
29045
|
-
children: display
|
|
29046
|
-
},
|
|
29047
|
-
field
|
|
29048
|
-
);
|
|
29049
|
-
}),
|
|
29050
|
-
/* @__PURE__ */ jsx56(
|
|
29051
|
-
Row2,
|
|
29052
|
-
{
|
|
29053
|
-
pointer: pointer(focused === "test"),
|
|
29054
|
-
label: "Run test",
|
|
29055
|
-
labelProps: { bold: focused === "test", color: focused === "test" ? PALETTE.accent : PALETTE.muted },
|
|
29056
|
-
children: /* @__PURE__ */ jsx56(Text47, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
|
|
29057
|
-
}
|
|
29058
|
-
)
|
|
29059
|
-
] }),
|
|
29060
|
-
/* @__PURE__ */ jsxs45(Section2, { title: "STATUS", note: "read only", children: [
|
|
29061
|
-
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx56(Row2, { pointer: null, label: row.label, children: /* @__PURE__ */ jsx56(Text47, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label)),
|
|
29062
|
-
hint && /* @__PURE__ */ jsx56(Row2, { pointer: null, label: "Setup", children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: hint }) })
|
|
29063
|
-
] }),
|
|
29064
|
-
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
29065
|
-
/* @__PURE__ */ jsx56(
|
|
29066
|
-
ControlHints,
|
|
29067
|
-
{
|
|
29068
|
-
hints: editing ? [
|
|
29069
|
-
{ keys: "type", label: "edit" },
|
|
29070
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
29071
|
-
{ keys: "\u23CE", label: "done" },
|
|
29072
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
29073
|
-
] : [
|
|
29074
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
29075
|
-
{ keys: "\u23CE", label: focusedField ? "edit" : "run test" },
|
|
29076
|
-
...focusedField ? [{ keys: "c", label: "clear" }] : [],
|
|
29077
|
-
{ keys: "s", label: "save" },
|
|
29078
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
29079
|
-
]
|
|
29080
|
-
}
|
|
29081
|
-
)
|
|
29082
|
-
] });
|
|
29083
|
-
}
|
|
29084
|
-
|
|
29085
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
29086
|
-
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
29087
|
-
var NAME_WIDTH = 16;
|
|
29088
|
-
var PANEL_LABEL_WIDTH = "Command".length;
|
|
29089
|
-
function AgentsScreen({ onDone }) {
|
|
29090
|
-
const [config, setConfig] = useState30(null);
|
|
29091
|
-
const [focus, setFocus] = useState30(0);
|
|
29092
|
-
const [open, setOpen] = useState30(null);
|
|
29093
|
-
const [notice, setNotice] = useState30(null);
|
|
29094
|
-
const [saving, setSaving] = useState30(false);
|
|
29095
|
-
const [checks, setChecks] = useState30({});
|
|
29096
|
-
const inspectAll = (loaded) => {
|
|
29097
|
-
for (const name of AGENT_NAMES) {
|
|
29098
|
-
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
29099
|
-
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
29100
|
-
);
|
|
29101
|
-
}
|
|
29102
|
-
};
|
|
29103
|
-
useEffect23(() => {
|
|
29104
|
-
void readAgentConfig().then((loaded) => {
|
|
29105
|
-
setConfig(loaded);
|
|
29106
|
-
inspectAll(loaded);
|
|
29107
|
-
startDebugRun({
|
|
29108
|
-
flow: "settings/agents",
|
|
29109
|
-
step: "01-agents",
|
|
29110
|
-
menuOption: "Configuration > Agents",
|
|
29111
|
-
inputs: { default_agent: loaded.defaultAgent }
|
|
29112
|
-
});
|
|
29113
|
-
});
|
|
29114
|
-
}, []);
|
|
29115
|
-
const makeDefault = (name) => {
|
|
29116
|
-
if (!config || saving) return;
|
|
29117
|
-
if (name === config.defaultAgent) {
|
|
29118
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
29119
|
-
return;
|
|
29120
|
-
}
|
|
29121
|
-
setSaving(true);
|
|
29122
|
-
setNotice(null);
|
|
29123
|
-
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
29124
|
-
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
29125
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
29126
|
-
}).catch(
|
|
29127
|
-
(err) => setNotice({
|
|
29128
|
-
kind: "error",
|
|
29129
|
-
text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
|
|
29130
|
-
})
|
|
29131
|
-
).finally(() => setSaving(false));
|
|
29132
|
-
};
|
|
29133
|
-
useInput12((input, key) => {
|
|
29134
|
-
if (!config || open || saving) return;
|
|
29135
|
-
const focused = AGENT_NAMES[focus];
|
|
29136
|
-
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
29137
|
-
if (key.upArrow) {
|
|
29138
|
-
setFocus((i) => (i - 1 + AGENT_NAMES.length) % AGENT_NAMES.length);
|
|
29139
|
-
return;
|
|
29140
|
-
}
|
|
29141
|
-
if (key.downArrow || key.tab) {
|
|
29142
|
-
setFocus((i) => (i + 1) % AGENT_NAMES.length);
|
|
29143
|
-
return;
|
|
29144
|
-
}
|
|
29145
|
-
if (key.return) {
|
|
29146
|
-
makeDefault(focused);
|
|
29147
|
-
return;
|
|
29148
|
-
}
|
|
29149
|
-
if (key.rightArrow) {
|
|
29150
|
-
setNotice(null);
|
|
29151
|
-
setOpen(focused);
|
|
29152
|
-
return;
|
|
29153
|
-
}
|
|
29154
|
-
if (key.escape || input === "q") {
|
|
29155
|
-
void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
|
|
29156
|
-
onDone();
|
|
29157
|
-
}
|
|
29158
|
-
});
|
|
29159
|
-
if (!config) {
|
|
29160
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29161
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
29162
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29163
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
29164
|
-
] });
|
|
29165
|
-
}
|
|
29166
|
-
if (open) {
|
|
29167
|
-
return /* @__PURE__ */ jsx57(
|
|
29168
|
-
AgentDetail,
|
|
29169
|
-
{
|
|
29170
|
-
name: open,
|
|
29171
|
-
config,
|
|
29172
|
-
setConfig,
|
|
29173
|
-
onBack: () => {
|
|
29174
|
-
setOpen(null);
|
|
29175
|
-
void readAgentConfig().then((saved) => {
|
|
29176
|
-
setConfig(saved);
|
|
29177
|
-
inspectAll(saved);
|
|
29178
|
-
});
|
|
29179
|
-
}
|
|
29180
|
-
}
|
|
29181
|
-
);
|
|
29182
|
-
}
|
|
29183
|
-
const focusedAgent = AGENT_NAMES[focus];
|
|
29184
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29185
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
29186
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
|
|
29187
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29188
|
-
/* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29189
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Default agent" }),
|
|
29190
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: AGENT_LABELS[config.defaultAgent] }),
|
|
29191
|
-
saving && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "\u2026 saving" })
|
|
29192
|
-
] }),
|
|
29193
|
-
/* @__PURE__ */ jsxs46(Box45, { marginTop: 1, gap: 1, children: [
|
|
29194
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29195
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29196
|
-
/* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
29197
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "STATUS" })
|
|
29198
|
-
] }),
|
|
29199
|
-
AGENT_NAMES.map((name) => {
|
|
29200
|
-
const isFocused = focusedAgent === name;
|
|
29201
|
-
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29202
|
-
/* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
29203
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
29204
|
-
/* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
29205
|
-
/* @__PURE__ */ jsx57(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
29206
|
-
] }, name);
|
|
29207
|
-
}),
|
|
29208
|
-
/* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
29209
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|
|
29210
|
-
panelRows(focusedAgent, checks[focusedAgent], config.agents[focusedAgent]).map((row) => /* @__PURE__ */ jsxs46(Box45, { gap: 1, paddingLeft: 1, children: [
|
|
29211
|
-
/* @__PURE__ */ jsx57(Box45, { width: PANEL_LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: row.label }) }),
|
|
29212
|
-
/* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value })
|
|
29213
|
-
] }, row.label))
|
|
29214
|
-
] }),
|
|
29215
|
-
notice && /* @__PURE__ */ jsxs46(Fragment17, { children: [
|
|
29216
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29217
|
-
/* @__PURE__ */ jsxs46(Text48, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
29218
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
29219
|
-
" ",
|
|
29220
|
-
notice.text
|
|
29221
|
-
] })
|
|
29222
|
-
] }),
|
|
29223
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
29224
|
-
/* @__PURE__ */ jsx57(
|
|
29225
|
-
ControlHints,
|
|
29226
|
-
{
|
|
29227
|
-
hints: [
|
|
29228
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
29229
|
-
{ keys: "\u23CE", label: "make default" },
|
|
29230
|
-
{ keys: "\u2192", label: "settings and test" },
|
|
29231
|
-
{ keys: "Esc/q", label: "back" }
|
|
29232
|
-
]
|
|
29233
|
-
}
|
|
29234
|
-
)
|
|
29235
|
-
] });
|
|
29236
|
-
}
|
|
29237
|
-
|
|
29238
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
29239
|
-
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
29240
|
-
import { Box as Box47, Text as Text50 } from "ink";
|
|
29241
|
-
init_debug_store();
|
|
29242
|
-
|
|
29243
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
29244
|
-
import { useState as useState31 } from "react";
|
|
29245
|
-
import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
|
|
29246
|
-
import TextInput5 from "ink-text-input";
|
|
29247
|
-
import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
29248
|
-
function FieldForm({
|
|
29249
|
-
title,
|
|
29250
|
-
subtitle,
|
|
29251
|
-
fields,
|
|
29252
|
-
values,
|
|
29253
|
-
onChange,
|
|
29254
|
-
onSave,
|
|
29255
|
-
onQuit,
|
|
29256
|
-
notice,
|
|
29257
|
-
busy = false,
|
|
29258
|
-
footer
|
|
29259
|
-
}) {
|
|
29260
|
-
const [active, setActive] = useState31(0);
|
|
29261
|
-
const [editing, setEditing] = useState31(false);
|
|
29262
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
|
|
29263
|
-
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
29264
|
-
const current = fields[active];
|
|
29265
|
-
useInput13((input, key) => {
|
|
29266
|
-
if (busy) return;
|
|
29267
|
-
if (editing) {
|
|
29268
|
-
if (key.escape) {
|
|
29269
|
-
onChange(current.key, valueBeforeEdit);
|
|
29270
|
-
setEditing(false);
|
|
29271
|
-
}
|
|
29272
|
-
return;
|
|
29273
|
-
}
|
|
29274
|
-
if (key.escape || input === "q") {
|
|
29275
|
-
onQuit();
|
|
29276
|
-
return;
|
|
29277
|
-
}
|
|
29278
|
-
if (input === "s") {
|
|
29279
|
-
onSave();
|
|
29280
|
-
return;
|
|
29281
|
-
}
|
|
29282
|
-
if (input === "c") {
|
|
29283
|
-
onChange(current.key, "");
|
|
29284
|
-
return;
|
|
29285
|
-
}
|
|
29286
|
-
if (key.tab || key.downArrow) {
|
|
29287
|
-
setActive((i) => (i + 1) % fields.length);
|
|
29288
|
-
return;
|
|
29289
|
-
}
|
|
29290
|
-
if (key.upArrow) {
|
|
29291
|
-
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
29292
|
-
return;
|
|
29293
|
-
}
|
|
29294
|
-
if (key.return) {
|
|
29295
|
-
setValueBeforeEdit(values[current.key]);
|
|
29296
|
-
setEditing(true);
|
|
29297
|
-
}
|
|
29298
|
-
});
|
|
29299
|
-
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29300
|
-
/* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
|
|
29301
|
-
subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
|
|
29302
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29303
|
-
/* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
|
|
29304
|
-
const isActive = index === active;
|
|
29305
|
-
const value = values[field.key];
|
|
29306
|
-
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
29307
|
-
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
29308
|
-
/* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
29309
|
-
/* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
29310
|
-
isActive && editing ? /* @__PURE__ */ jsx58(
|
|
29311
|
-
TextInput5,
|
|
29312
|
-
{
|
|
29313
|
-
value,
|
|
29314
|
-
onChange: (next) => onChange(field.key, next),
|
|
29315
|
-
onSubmit: () => setEditing(false),
|
|
29316
|
-
mask: field.masked ? "\u2022" : void 0
|
|
29317
|
-
}
|
|
29318
|
-
) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
29319
|
-
field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
|
|
29320
|
-
] }, field.key);
|
|
29321
|
-
}) }),
|
|
29322
|
-
notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
29323
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29324
|
-
/* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
29325
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
29326
|
-
" ",
|
|
29327
|
-
notice.text
|
|
29328
|
-
] })
|
|
29329
|
-
] }),
|
|
29330
|
-
footer,
|
|
29331
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29332
|
-
/* @__PURE__ */ jsx58(
|
|
29333
|
-
ControlHints,
|
|
29334
|
-
{
|
|
29335
|
-
hints: editing ? [
|
|
29336
|
-
{ keys: "type", label: "edit" },
|
|
29337
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
29338
|
-
{ keys: "\u23CE", label: "done" },
|
|
29339
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
29340
|
-
] : [
|
|
29341
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
29342
|
-
{ keys: "\u23CE", label: "edit" },
|
|
29343
|
-
{ keys: "c", label: "clear" },
|
|
29344
|
-
{ keys: "s", label: "save" },
|
|
29345
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
29346
|
-
]
|
|
29347
|
-
}
|
|
29348
|
-
)
|
|
29349
|
-
] });
|
|
29350
|
-
}
|
|
29351
|
-
|
|
29352
28546
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
29353
28547
|
async function readCredentials() {
|
|
29354
28548
|
const store = await readV1Store();
|
|
@@ -29374,16 +28568,17 @@ async function writeCredentials(config) {
|
|
|
29374
28568
|
await writeV1Store(merged);
|
|
29375
28569
|
}
|
|
29376
28570
|
|
|
29377
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
|
|
29385
|
-
|
|
29386
|
-
|
|
28571
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
28572
|
+
init_debug_store();
|
|
28573
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28574
|
+
var FIELD_ORDER = [
|
|
28575
|
+
"spaceId",
|
|
28576
|
+
"environmentId",
|
|
28577
|
+
"cmaToken",
|
|
28578
|
+
"host",
|
|
28579
|
+
"defaultComponentDir",
|
|
28580
|
+
"defaultTokenFile",
|
|
28581
|
+
"contentfulBaseDir"
|
|
29387
28582
|
];
|
|
29388
28583
|
function debugFields(config) {
|
|
29389
28584
|
return {
|
|
@@ -29396,114 +28591,156 @@ function debugFields(config) {
|
|
|
29396
28591
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
29397
28592
|
};
|
|
29398
28593
|
}
|
|
29399
|
-
var
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
|
|
28594
|
+
var FIELD_LABELS = {
|
|
28595
|
+
spaceId: "Space ID",
|
|
28596
|
+
environmentId: "Environment ID",
|
|
28597
|
+
cmaToken: "CMA Token",
|
|
28598
|
+
host: "API Host",
|
|
28599
|
+
defaultComponentDir: "Default component directory",
|
|
28600
|
+
defaultTokenFile: "Default token file",
|
|
28601
|
+
contentfulBaseDir: "Root Project Directory"
|
|
28602
|
+
};
|
|
28603
|
+
var FIELD_HINTS = {
|
|
28604
|
+
contentfulBaseDir: "(where .contentful goes)"
|
|
28605
|
+
};
|
|
28606
|
+
var LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
28607
|
+
function ConfigurationScreen({ onDone }) {
|
|
28608
|
+
const [stage, setStage] = useState29("loading");
|
|
28609
|
+
const [config, setConfig] = useState29(null);
|
|
28610
|
+
const [activeField, setActiveField] = useState29("spaceId");
|
|
28611
|
+
const [notice, setNotice] = useState29(null);
|
|
28612
|
+
const [lastSaved, setLastSaved] = useState29(null);
|
|
28613
|
+
const [editing, setEditing] = useState29(false);
|
|
28614
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28615
|
+
useEffect22(() => {
|
|
28616
|
+
readCredentials().then((cfg) => {
|
|
29407
28617
|
setConfig(cfg);
|
|
28618
|
+
setStage("form");
|
|
29408
28619
|
startDebugRun({
|
|
29409
28620
|
flow: "settings/contentful-configuration",
|
|
29410
28621
|
step: "01-configuration",
|
|
29411
|
-
menuOption: "Configuration
|
|
28622
|
+
menuOption: "Configuration",
|
|
29412
28623
|
inputs: debugFields(cfg)
|
|
29413
28624
|
});
|
|
29414
28625
|
});
|
|
29415
28626
|
}, []);
|
|
29416
|
-
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29420
|
-
|
|
29421
|
-
|
|
28627
|
+
function fieldValue(field) {
|
|
28628
|
+
if (!config) return "";
|
|
28629
|
+
return config[field] || "";
|
|
28630
|
+
}
|
|
28631
|
+
function setFieldValue(field, value) {
|
|
28632
|
+
if (!config) return;
|
|
28633
|
+
setConfig({ ...config, [field]: value });
|
|
28634
|
+
setNotice(null);
|
|
29422
28635
|
}
|
|
29423
|
-
|
|
29424
|
-
|
|
28636
|
+
function handleSave() {
|
|
28637
|
+
if (!config) return;
|
|
28638
|
+
setStage("saving");
|
|
29425
28639
|
setNotice(null);
|
|
29426
28640
|
writeCredentials(config).then(() => {
|
|
29427
28641
|
setLastSaved(config);
|
|
29428
28642
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
29429
|
-
setNotice({ kind: "success", text: "
|
|
28643
|
+
setNotice({ kind: "success", text: "Configuration saved" });
|
|
28644
|
+
setStage("form");
|
|
29430
28645
|
}).catch((err) => {
|
|
29431
28646
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
29432
|
-
|
|
29433
|
-
|
|
29434
|
-
|
|
28647
|
+
setStage("form");
|
|
28648
|
+
});
|
|
28649
|
+
}
|
|
28650
|
+
function quit() {
|
|
29435
28651
|
void finishDebugRun(
|
|
29436
28652
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
29437
28653
|
);
|
|
29438
28654
|
onDone();
|
|
29439
|
-
}
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
{
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
|
|
29448
|
-
setConfig({ ...config, [key]: value });
|
|
29449
|
-
setNotice(null);
|
|
29450
|
-
},
|
|
29451
|
-
onSave: save,
|
|
29452
|
-
onQuit: quit,
|
|
29453
|
-
notice,
|
|
29454
|
-
busy: saving
|
|
28655
|
+
}
|
|
28656
|
+
useInput11((input, key) => {
|
|
28657
|
+
if (stage === "loading" || stage === "saving") return;
|
|
28658
|
+
if (editing) {
|
|
28659
|
+
if (key.escape) {
|
|
28660
|
+
setFieldValue(activeField, valueBeforeEdit);
|
|
28661
|
+
setEditing(false);
|
|
28662
|
+
}
|
|
28663
|
+
return;
|
|
29455
28664
|
}
|
|
29456
|
-
|
|
29457
|
-
|
|
29458
|
-
|
|
29459
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
29460
|
-
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
29461
|
-
var SECTIONS = [
|
|
29462
|
-
{
|
|
29463
|
-
id: "project",
|
|
29464
|
-
label: "Project",
|
|
29465
|
-
description: "Contentful space, credentials, defaults and where .contentful goes"
|
|
29466
|
-
},
|
|
29467
|
-
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
29468
|
-
];
|
|
29469
|
-
function ConfigurationScreen({ onDone }) {
|
|
29470
|
-
const [focus, setFocus] = useState33(0);
|
|
29471
|
-
const [open, setOpen] = useState33(null);
|
|
29472
|
-
const close = () => setOpen(null);
|
|
29473
|
-
useInput14((input, key) => {
|
|
29474
|
-
if (open) return;
|
|
29475
|
-
if (key.upArrow) {
|
|
29476
|
-
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
28665
|
+
if (key.escape || input === "q") {
|
|
28666
|
+
quit();
|
|
29477
28667
|
return;
|
|
29478
28668
|
}
|
|
29479
|
-
if (
|
|
29480
|
-
|
|
28669
|
+
if (input === "s") {
|
|
28670
|
+
handleSave();
|
|
29481
28671
|
return;
|
|
29482
28672
|
}
|
|
29483
|
-
if (
|
|
29484
|
-
|
|
28673
|
+
if (input === "c") {
|
|
28674
|
+
setFieldValue(activeField, "");
|
|
28675
|
+
return;
|
|
28676
|
+
}
|
|
28677
|
+
if (key.tab || key.downArrow) {
|
|
28678
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
28679
|
+
setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
|
|
29485
28680
|
return;
|
|
29486
28681
|
}
|
|
29487
|
-
if (key.
|
|
28682
|
+
if (key.upArrow) {
|
|
28683
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
28684
|
+
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
28685
|
+
return;
|
|
28686
|
+
}
|
|
28687
|
+
if (key.return) {
|
|
28688
|
+
setValueBeforeEdit(fieldValue(activeField));
|
|
28689
|
+
setEditing(true);
|
|
28690
|
+
}
|
|
29488
28691
|
});
|
|
29489
|
-
if (
|
|
29490
|
-
|
|
29491
|
-
|
|
29492
|
-
|
|
29493
|
-
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
|
|
29497
|
-
|
|
29498
|
-
|
|
29499
|
-
/* @__PURE__ */
|
|
29500
|
-
|
|
28692
|
+
if (stage === "loading") {
|
|
28693
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28694
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
28695
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28696
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
|
|
28697
|
+
] });
|
|
28698
|
+
}
|
|
28699
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28700
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
28701
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28702
|
+
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
28703
|
+
const isActive = activeField === field;
|
|
28704
|
+
const value = fieldValue(field);
|
|
28705
|
+
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
28706
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28707
|
+
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
28708
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
28709
|
+
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
28710
|
+
TextInput4,
|
|
28711
|
+
{
|
|
28712
|
+
value,
|
|
28713
|
+
onChange: (next) => setFieldValue(field, next),
|
|
28714
|
+
onSubmit: () => setEditing(false),
|
|
28715
|
+
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
28716
|
+
}
|
|
28717
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
28718
|
+
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
28719
|
+
] }, field);
|
|
28720
|
+
}) }),
|
|
28721
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
28722
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28723
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
28724
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
28725
|
+
" ",
|
|
28726
|
+
notice.text
|
|
28727
|
+
] })
|
|
28728
|
+
] }),
|
|
28729
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28730
|
+
/* @__PURE__ */ jsx55(
|
|
29501
28731
|
ControlHints,
|
|
29502
28732
|
{
|
|
29503
|
-
hints: [
|
|
28733
|
+
hints: editing ? [
|
|
28734
|
+
{ keys: "type", label: "edit" },
|
|
28735
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
28736
|
+
{ keys: "\u23CE", label: "done" },
|
|
28737
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
28738
|
+
] : [
|
|
29504
28739
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
29505
|
-
{ keys: "\u23CE", label: "
|
|
29506
|
-
{ keys: "
|
|
28740
|
+
{ keys: "\u23CE", label: "edit" },
|
|
28741
|
+
{ keys: "c", label: "clear" },
|
|
28742
|
+
{ keys: "s", label: "save" },
|
|
28743
|
+
{ keys: "Esc/q", label: "quit without saving" }
|
|
29507
28744
|
]
|
|
29508
28745
|
}
|
|
29509
28746
|
)
|
|
@@ -29511,8 +28748,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
29511
28748
|
}
|
|
29512
28749
|
|
|
29513
28750
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
29514
|
-
import { useEffect as
|
|
29515
|
-
import { Box as
|
|
28751
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
28752
|
+
import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
|
|
29516
28753
|
|
|
29517
28754
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
29518
28755
|
async function readAnalyticsSetting() {
|
|
@@ -29531,11 +28768,11 @@ async function writeAnalyticsSetting(setting) {
|
|
|
29531
28768
|
|
|
29532
28769
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
29533
28770
|
init_debug_store();
|
|
29534
|
-
import { Fragment as
|
|
28771
|
+
import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
29535
28772
|
function OptInAnalyticsScreen({ onDone }) {
|
|
29536
|
-
const [loading, setLoading] =
|
|
29537
|
-
const [enabled, setEnabled] =
|
|
29538
|
-
|
|
28773
|
+
const [loading, setLoading] = useState30(true);
|
|
28774
|
+
const [enabled, setEnabled] = useState30(true);
|
|
28775
|
+
useEffect23(() => {
|
|
29539
28776
|
readAnalyticsSetting().then((setting) => {
|
|
29540
28777
|
setEnabled(setting.enabled);
|
|
29541
28778
|
setLoading(false);
|
|
@@ -29547,7 +28784,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29547
28784
|
});
|
|
29548
28785
|
});
|
|
29549
28786
|
}, []);
|
|
29550
|
-
|
|
28787
|
+
useInput12((input, key) => {
|
|
29551
28788
|
if (loading) return;
|
|
29552
28789
|
if (key.return || input === " ") {
|
|
29553
28790
|
setEnabled((current) => {
|
|
@@ -29562,21 +28799,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29562
28799
|
onDone();
|
|
29563
28800
|
}
|
|
29564
28801
|
});
|
|
29565
|
-
return /* @__PURE__ */
|
|
29566
|
-
/* @__PURE__ */
|
|
29567
|
-
/* @__PURE__ */
|
|
29568
|
-
loading ? /* @__PURE__ */
|
|
29569
|
-
/* @__PURE__ */
|
|
28802
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28803
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
28804
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
28805
|
+
loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
28806
|
+
/* @__PURE__ */ jsxs46(Text47, { children: [
|
|
29570
28807
|
"Share anonymous usage data:",
|
|
29571
28808
|
" ",
|
|
29572
|
-
/* @__PURE__ */
|
|
28809
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
29573
28810
|
] }),
|
|
29574
|
-
/* @__PURE__ */
|
|
29575
|
-
/* @__PURE__ */
|
|
29576
|
-
/* @__PURE__ */
|
|
28811
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
28812
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
28813
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
29577
28814
|
] }),
|
|
29578
|
-
/* @__PURE__ */
|
|
29579
|
-
/* @__PURE__ */
|
|
28815
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
28816
|
+
/* @__PURE__ */ jsx56(
|
|
29580
28817
|
ControlHints,
|
|
29581
28818
|
{
|
|
29582
28819
|
hints: [
|
|
@@ -29588,89 +28825,16 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
29588
28825
|
] });
|
|
29589
28826
|
}
|
|
29590
28827
|
|
|
29591
|
-
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
29592
|
-
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
29593
|
-
import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
|
|
29594
|
-
init_version();
|
|
29595
|
-
init_debug_store();
|
|
29596
|
-
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
29597
|
-
var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
29598
|
-
function UpgradeScreen({ onDone }) {
|
|
29599
|
-
const [upgradeCheck, setUpgradeCheck] = useState35();
|
|
29600
|
-
useEffect26(() => {
|
|
29601
|
-
startDebugRun({
|
|
29602
|
-
flow: "upgrade",
|
|
29603
|
-
step: "01-upgrade",
|
|
29604
|
-
menuOption: "Upgrade",
|
|
29605
|
-
inputs: { currentVersion: readPackageVersion() }
|
|
29606
|
-
});
|
|
29607
|
-
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
29608
|
-
}, []);
|
|
29609
|
-
useInput16((_input, key) => {
|
|
29610
|
-
if (key.return) {
|
|
29611
|
-
void finishDebugRun({
|
|
29612
|
-
outputs: upgradeCheck ?? {},
|
|
29613
|
-
status: upgradeCheck?.status === "error" ? "error" : "success",
|
|
29614
|
-
exitMethod: "saved"
|
|
29615
|
-
});
|
|
29616
|
-
onDone();
|
|
29617
|
-
return;
|
|
29618
|
-
}
|
|
29619
|
-
});
|
|
29620
|
-
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29621
|
-
/* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
|
|
29622
|
-
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29623
|
-
renderBody(upgradeCheck),
|
|
29624
|
-
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29625
|
-
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
|
|
29626
|
-
FOCUS_MARKER,
|
|
29627
|
-
" Go Back"
|
|
29628
|
-
] })
|
|
29629
|
-
] });
|
|
29630
|
-
}
|
|
29631
|
-
function renderBody(upgradeCheck) {
|
|
29632
|
-
if (!upgradeCheck) {
|
|
29633
|
-
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
29634
|
-
}
|
|
29635
|
-
if (upgradeCheck.status === "error") {
|
|
29636
|
-
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
29637
|
-
}
|
|
29638
|
-
if (upgradeCheck.status === "up-to-date") {
|
|
29639
|
-
return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
|
|
29640
|
-
"You're already on the latest version (v",
|
|
29641
|
-
upgradeCheck.current,
|
|
29642
|
-
")."
|
|
29643
|
-
] });
|
|
29644
|
-
}
|
|
29645
|
-
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
|
|
29646
|
-
/* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
|
|
29647
|
-
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
|
|
29648
|
-
"v",
|
|
29649
|
-
upgradeCheck.latest
|
|
29650
|
-
] }),
|
|
29651
|
-
" ",
|
|
29652
|
-
"is available (you're on ",
|
|
29653
|
-
/* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
|
|
29654
|
-
"v",
|
|
29655
|
-
upgradeCheck.current
|
|
29656
|
-
] }),
|
|
29657
|
-
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
29658
|
-
] }),
|
|
29659
|
-
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
29660
|
-
/* @__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)) })
|
|
29661
|
-
] });
|
|
29662
|
-
}
|
|
29663
|
-
|
|
29664
28828
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
29665
|
-
import { useEffect as
|
|
29666
|
-
import { Box as
|
|
28829
|
+
import { useEffect as useEffect24, useState as useState31 } from "react";
|
|
28830
|
+
import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
|
|
29667
28831
|
init_debug_mode_store();
|
|
29668
28832
|
init_debug_store();
|
|
29669
|
-
import { jsx as
|
|
28833
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
29670
28834
|
function DebugModeScreen({ onDone }) {
|
|
29671
|
-
const [loading, setLoading] =
|
|
29672
|
-
const [enabled, setEnabled] =
|
|
29673
|
-
|
|
28835
|
+
const [loading, setLoading] = useState31(true);
|
|
28836
|
+
const [enabled, setEnabled] = useState31(true);
|
|
28837
|
+
useEffect24(() => {
|
|
29674
28838
|
readDebugModeSetting().then((setting) => {
|
|
29675
28839
|
setEnabled(setting.enabled);
|
|
29676
28840
|
setLoading(false);
|
|
@@ -29682,7 +28846,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
29682
28846
|
});
|
|
29683
28847
|
});
|
|
29684
28848
|
}, []);
|
|
29685
|
-
|
|
28849
|
+
useInput13((input, key) => {
|
|
29686
28850
|
if (loading) return;
|
|
29687
28851
|
if (key.return || input === " ") {
|
|
29688
28852
|
setEnabled((current) => {
|
|
@@ -29697,16 +28861,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
29697
28861
|
onDone();
|
|
29698
28862
|
}
|
|
29699
28863
|
});
|
|
29700
|
-
return /* @__PURE__ */
|
|
29701
|
-
/* @__PURE__ */
|
|
29702
|
-
/* @__PURE__ */
|
|
29703
|
-
loading ? /* @__PURE__ */
|
|
28864
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
28865
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
28866
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
28867
|
+
loading ? /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs47(Text48, { children: [
|
|
29704
28868
|
"Debug logging:",
|
|
29705
28869
|
" ",
|
|
29706
|
-
/* @__PURE__ */
|
|
28870
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
29707
28871
|
] }),
|
|
29708
|
-
/* @__PURE__ */
|
|
29709
|
-
/* @__PURE__ */
|
|
28872
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
28873
|
+
/* @__PURE__ */ jsx57(
|
|
29710
28874
|
ControlHints,
|
|
29711
28875
|
{
|
|
29712
28876
|
hints: [
|
|
@@ -29719,18 +28883,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
29719
28883
|
}
|
|
29720
28884
|
|
|
29721
28885
|
// packages/experience-design-system-cli/app.tsx
|
|
29722
|
-
import { Fragment as
|
|
28886
|
+
import { Fragment as Fragment19, jsx as jsx58 } from "react/jsx-runtime";
|
|
29723
28887
|
function App({ importOptions, inkClear }) {
|
|
29724
|
-
const [screen, setScreen] =
|
|
29725
|
-
const [importExitCode, setImportExitCode] =
|
|
28888
|
+
const [screen, setScreen] = useState32("start");
|
|
28889
|
+
const [importExitCode, setImportExitCode] = useState32();
|
|
29726
28890
|
const showImportResult = importExitCode !== void 0;
|
|
29727
|
-
const [projectPath, setProjectPath] =
|
|
29728
|
-
const [tokensPath, setTokensPath] =
|
|
29729
|
-
const [scannedFiles, setScannedFiles] =
|
|
29730
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
29731
|
-
const [extractionRun, setExtractionRun] =
|
|
28891
|
+
const [projectPath, setProjectPath] = useState32();
|
|
28892
|
+
const [tokensPath, setTokensPath] = useState32();
|
|
28893
|
+
const [scannedFiles, setScannedFiles] = useState32();
|
|
28894
|
+
const [pendingLaunch, setPendingLaunch] = useState32();
|
|
28895
|
+
const [extractionRun, setExtractionRun] = useState32();
|
|
29732
28896
|
const extraction = useExtraction(extractionRun?.input);
|
|
29733
|
-
const [scopeRun, setScopeRun] =
|
|
28897
|
+
const [scopeRun, setScopeRun] = useState32();
|
|
29734
28898
|
const scopeFlow = useScopeGateFlow(
|
|
29735
28899
|
scopeRun && {
|
|
29736
28900
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -29745,12 +28909,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29745
28909
|
}
|
|
29746
28910
|
}
|
|
29747
28911
|
);
|
|
29748
|
-
const [generationInput, setGenerationInput] =
|
|
28912
|
+
const [generationInput, setGenerationInput] = useState32();
|
|
29749
28913
|
const generation = useGeneration(generationInput);
|
|
29750
|
-
const [flowStart, setFlowStart] =
|
|
28914
|
+
const [flowStart, setFlowStart] = useState32();
|
|
29751
28915
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
29752
|
-
const [importDefaults, setImportDefaults] =
|
|
29753
|
-
|
|
28916
|
+
const [importDefaults, setImportDefaults] = useState32();
|
|
28917
|
+
useEffect25(() => {
|
|
29754
28918
|
if (screen !== "import") {
|
|
29755
28919
|
setImportDefaults(void 0);
|
|
29756
28920
|
return;
|
|
@@ -29768,7 +28932,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29768
28932
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
29769
28933
|
const state2 = await inspectTokens({
|
|
29770
28934
|
rawTokensPath: tokens,
|
|
29771
|
-
contentfulDir:
|
|
28935
|
+
contentfulDir: join25(resolveUserPath(projectPath2), ".contentful"),
|
|
29772
28936
|
cache: importOptions.cache
|
|
29773
28937
|
});
|
|
29774
28938
|
if (state2.kind === "cached") {
|
|
@@ -29810,12 +28974,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29810
28974
|
}
|
|
29811
28975
|
});
|
|
29812
28976
|
};
|
|
29813
|
-
|
|
28977
|
+
useEffect25(() => {
|
|
29814
28978
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
29815
28979
|
setExtractionRun(void 0);
|
|
29816
28980
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
29817
28981
|
}, [extraction, extractionRun]);
|
|
29818
|
-
|
|
28982
|
+
useEffect25(() => {
|
|
29819
28983
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
29820
28984
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
29821
28985
|
setGenerationInput({
|
|
@@ -29833,7 +28997,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29833
28997
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
29834
28998
|
});
|
|
29835
28999
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
29836
|
-
|
|
29000
|
+
useEffect25(() => {
|
|
29837
29001
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
29838
29002
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
29839
29003
|
inkClear();
|
|
@@ -29876,9 +29040,9 @@ function App({ importOptions, inkClear }) {
|
|
|
29876
29040
|
};
|
|
29877
29041
|
switch (screen) {
|
|
29878
29042
|
case "import":
|
|
29879
|
-
if (showImportResult) return /* @__PURE__ */
|
|
29043
|
+
if (showImportResult) return /* @__PURE__ */ jsx58(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
29880
29044
|
if (flow && flowStart) {
|
|
29881
|
-
return /* @__PURE__ */
|
|
29045
|
+
return /* @__PURE__ */ jsx58(
|
|
29882
29046
|
FlowScreen,
|
|
29883
29047
|
{
|
|
29884
29048
|
state: flow.state,
|
|
@@ -29888,12 +29052,12 @@ function App({ importOptions, inkClear }) {
|
|
|
29888
29052
|
}
|
|
29889
29053
|
);
|
|
29890
29054
|
}
|
|
29891
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
29055
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
29892
29056
|
if (projectPath === void 0) {
|
|
29893
|
-
return /* @__PURE__ */
|
|
29057
|
+
return /* @__PURE__ */ jsx58(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
29894
29058
|
}
|
|
29895
29059
|
if (tokensPath === void 0) {
|
|
29896
|
-
return /* @__PURE__ */
|
|
29060
|
+
return /* @__PURE__ */ jsx58(
|
|
29897
29061
|
TokenInputScreen,
|
|
29898
29062
|
{
|
|
29899
29063
|
initialPath: importDefaults.tokenFile,
|
|
@@ -29903,7 +29067,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29903
29067
|
);
|
|
29904
29068
|
}
|
|
29905
29069
|
if (scannedFiles === void 0) {
|
|
29906
|
-
return /* @__PURE__ */
|
|
29070
|
+
return /* @__PURE__ */ jsx58(
|
|
29907
29071
|
PathValidationScreen,
|
|
29908
29072
|
{
|
|
29909
29073
|
projectPath,
|
|
@@ -29915,10 +29079,10 @@ function App({ importOptions, inkClear }) {
|
|
|
29915
29079
|
}
|
|
29916
29080
|
if (extractionRun) {
|
|
29917
29081
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
29918
|
-
return /* @__PURE__ */
|
|
29082
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
29919
29083
|
}
|
|
29920
29084
|
if (extraction?.status === "running") {
|
|
29921
|
-
return /* @__PURE__ */
|
|
29085
|
+
return /* @__PURE__ */ jsx58(
|
|
29922
29086
|
ExtractionScreen,
|
|
29923
29087
|
{
|
|
29924
29088
|
progress: extraction.progress,
|
|
@@ -29927,14 +29091,14 @@ function App({ importOptions, inkClear }) {
|
|
|
29927
29091
|
}
|
|
29928
29092
|
);
|
|
29929
29093
|
}
|
|
29930
|
-
return /* @__PURE__ */
|
|
29094
|
+
return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
29931
29095
|
}
|
|
29932
29096
|
if (scopeRun && scopeFlow) {
|
|
29933
29097
|
if (scopeFlow.status === "failed") {
|
|
29934
|
-
return /* @__PURE__ */
|
|
29098
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
29935
29099
|
}
|
|
29936
29100
|
if (scopeFlow.status === "deciding") {
|
|
29937
|
-
return /* @__PURE__ */
|
|
29101
|
+
return /* @__PURE__ */ jsx58(
|
|
29938
29102
|
ScopeGateScreen,
|
|
29939
29103
|
{
|
|
29940
29104
|
components: scopeFlow.load.components,
|
|
@@ -29944,7 +29108,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29944
29108
|
);
|
|
29945
29109
|
}
|
|
29946
29110
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
29947
|
-
return /* @__PURE__ */
|
|
29111
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
29948
29112
|
}
|
|
29949
29113
|
if (generation?.status === "running") {
|
|
29950
29114
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -29952,7 +29116,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29952
29116
|
hasRawTokens,
|
|
29953
29117
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
29954
29118
|
});
|
|
29955
|
-
return /* @__PURE__ */
|
|
29119
|
+
return /* @__PURE__ */ jsx58(
|
|
29956
29120
|
GenerationScreen,
|
|
29957
29121
|
{
|
|
29958
29122
|
progress: generation.progress,
|
|
@@ -29964,10 +29128,10 @@ function App({ importOptions, inkClear }) {
|
|
|
29964
29128
|
}
|
|
29965
29129
|
);
|
|
29966
29130
|
}
|
|
29967
|
-
return /* @__PURE__ */
|
|
29131
|
+
return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
29968
29132
|
}
|
|
29969
29133
|
if (pendingLaunch?.cached) {
|
|
29970
|
-
return /* @__PURE__ */
|
|
29134
|
+
return /* @__PURE__ */ jsx58(
|
|
29971
29135
|
TokenReuseScreen,
|
|
29972
29136
|
{
|
|
29973
29137
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -29978,7 +29142,7 @@ function App({ importOptions, inkClear }) {
|
|
|
29978
29142
|
}
|
|
29979
29143
|
);
|
|
29980
29144
|
}
|
|
29981
|
-
return /* @__PURE__ */
|
|
29145
|
+
return /* @__PURE__ */ jsx58(
|
|
29982
29146
|
CredentialsScreen,
|
|
29983
29147
|
{
|
|
29984
29148
|
initial: importDefaults.credentials,
|
|
@@ -29987,19 +29151,17 @@ function App({ importOptions, inkClear }) {
|
|
|
29987
29151
|
}
|
|
29988
29152
|
);
|
|
29989
29153
|
case "help":
|
|
29990
|
-
return /* @__PURE__ */
|
|
29991
|
-
case "upgrade":
|
|
29992
|
-
return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
|
|
29154
|
+
return /* @__PURE__ */ jsx58(HelpScreen, { onDone: goToStart });
|
|
29993
29155
|
case "settings":
|
|
29994
|
-
return /* @__PURE__ */
|
|
29156
|
+
return /* @__PURE__ */ jsx58(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
29995
29157
|
case "settings-configuration":
|
|
29996
|
-
return /* @__PURE__ */
|
|
29158
|
+
return /* @__PURE__ */ jsx58(ConfigurationScreen, { onDone: goToSettings });
|
|
29997
29159
|
case "settings-opt-in-analytics":
|
|
29998
|
-
return /* @__PURE__ */
|
|
29160
|
+
return /* @__PURE__ */ jsx58(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
29999
29161
|
case "settings-debug-mode":
|
|
30000
|
-
return /* @__PURE__ */
|
|
29162
|
+
return /* @__PURE__ */ jsx58(DebugModeScreen, { onDone: goToSettings });
|
|
30001
29163
|
case "start":
|
|
30002
|
-
return /* @__PURE__ */
|
|
29164
|
+
return /* @__PURE__ */ jsx58(HomeScreen, { onNavigate: setScreen });
|
|
30003
29165
|
}
|
|
30004
29166
|
}
|
|
30005
29167
|
async function runApp(renderApp, importOptions) {
|
|
@@ -30007,7 +29169,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
30007
29169
|
instance.clear?.();
|
|
30008
29170
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
30009
29171
|
};
|
|
30010
|
-
const instance = renderApp(/* @__PURE__ */
|
|
29172
|
+
const instance = renderApp(/* @__PURE__ */ jsx58(App, { importOptions, inkClear }));
|
|
30011
29173
|
await instance.waitUntilExit();
|
|
30012
29174
|
}
|
|
30013
29175
|
export {
|