@contentful/experience-design-system-cli 2.37.1-dev-build-8888c7d3.0 → 2.37.1-dev-build-a2aef8c6.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 +1012 -256
- package/dist/index.js +1115 -276
- package/dist/package.json +1 -1
- package/dist/src/tui/help/file-locations.d.ts +23 -0
- package/dist/src/tui/settings/{contentful-configuration/ContentfulConfigScreen.d.ts → configuration/ConfigurationScreen.d.ts} +1 -0
- package/dist/src/tui/settings/configuration/agents/AgentDetail.d.ts +13 -0
- package/dist/src/tui/settings/configuration/agents/AgentStatusBadge.d.ts +10 -0
- package/dist/src/tui/settings/configuration/agents/AgentsScreen.d.ts +11 -0
- package/dist/src/tui/settings/configuration/agents/agent-status.d.ts +63 -0
- package/dist/src/tui/settings/configuration/agents/agent-store.d.ts +16 -0
- package/dist/src/tui/settings/configuration/agents/apply-binary-overrides.d.ts +13 -0
- package/dist/src/tui/settings/configuration/project/ProjectScreen.d.ts +5 -0
- package/dist/src/tui/settings/shared/FieldForm.d.ts +50 -0
- package/dist/src/tui/upgrade/PageContainer.d.ts +4 -0
- package/package.json +3 -3
- /package/dist/src/tui/settings/{contentful-configuration/config-store.d.ts → configuration/project/project-store.d.ts} +0 -0
- /package/dist/src/tui/settings/{utils → shared}/v1-store.d.ts +0 -0
- /package/dist/src/tui/{home → upgrade}/version.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1500,7 +1500,7 @@ async function runAgent(options) {
|
|
|
1500
1500
|
promptLen: prompt.length,
|
|
1501
1501
|
promptHead: prompt.slice(0, 500)
|
|
1502
1502
|
});
|
|
1503
|
-
return new Promise((
|
|
1503
|
+
return new Promise((resolve28) => {
|
|
1504
1504
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1505
1505
|
const child = spawn(binary, args, {
|
|
1506
1506
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1549,7 +1549,7 @@ async function runAgent(options) {
|
|
|
1549
1549
|
stderrLen: stderr.length,
|
|
1550
1550
|
stderrTail: stderr.slice(-1e3)
|
|
1551
1551
|
});
|
|
1552
|
-
|
|
1552
|
+
resolve28(result);
|
|
1553
1553
|
});
|
|
1554
1554
|
});
|
|
1555
1555
|
}
|
|
@@ -1571,7 +1571,7 @@ async function checkAgentAuth(agent) {
|
|
|
1571
1571
|
return "not-found";
|
|
1572
1572
|
if (agent !== "claude")
|
|
1573
1573
|
return "ok";
|
|
1574
|
-
return new Promise((
|
|
1574
|
+
return new Promise((resolve28) => {
|
|
1575
1575
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1576
1576
|
let stdout = "";
|
|
1577
1577
|
let done = false;
|
|
@@ -1580,7 +1580,7 @@ async function checkAgentAuth(agent) {
|
|
|
1580
1580
|
return;
|
|
1581
1581
|
done = true;
|
|
1582
1582
|
child.kill("SIGTERM");
|
|
1583
|
-
|
|
1583
|
+
resolve28("unauthenticated");
|
|
1584
1584
|
}, 5e3);
|
|
1585
1585
|
child.stdout?.on("data", (chunk) => {
|
|
1586
1586
|
stdout += chunk.toString();
|
|
@@ -1591,14 +1591,14 @@ async function checkAgentAuth(agent) {
|
|
|
1591
1591
|
done = true;
|
|
1592
1592
|
clearTimeout(timer);
|
|
1593
1593
|
if (code !== 0) {
|
|
1594
|
-
|
|
1594
|
+
resolve28("unauthenticated");
|
|
1595
1595
|
return;
|
|
1596
1596
|
}
|
|
1597
1597
|
try {
|
|
1598
1598
|
const status = JSON.parse(stdout);
|
|
1599
|
-
|
|
1599
|
+
resolve28(status.loggedIn ? "ok" : "unauthenticated");
|
|
1600
1600
|
} catch {
|
|
1601
|
-
|
|
1601
|
+
resolve28("unauthenticated");
|
|
1602
1602
|
}
|
|
1603
1603
|
});
|
|
1604
1604
|
});
|
|
@@ -1608,9 +1608,9 @@ async function binaryIsOnPath(binary) {
|
|
|
1608
1608
|
const fs = await import("node:fs/promises");
|
|
1609
1609
|
return fs.access(binary).then(() => true, () => false);
|
|
1610
1610
|
}
|
|
1611
|
-
return new Promise((
|
|
1611
|
+
return new Promise((resolve28) => {
|
|
1612
1612
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1613
|
-
child.on("close", (code) =>
|
|
1613
|
+
child.on("close", (code) => resolve28(code === 0));
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
1616
|
var init_check_agent_auth = __esm({
|
|
@@ -7916,10 +7916,10 @@ function extractVueSlotsFromSetup(options) {
|
|
|
7916
7916
|
if (!body)
|
|
7917
7917
|
return [];
|
|
7918
7918
|
const slotsByName = /* @__PURE__ */ new Map();
|
|
7919
|
-
for (const
|
|
7920
|
-
if (
|
|
7919
|
+
for (const access7 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
|
|
7920
|
+
if (access7.getExpression().getText() !== slotsName)
|
|
7921
7921
|
continue;
|
|
7922
|
-
const slotName =
|
|
7922
|
+
const slotName = access7.getName();
|
|
7923
7923
|
if (!slotsByName.has(slotName)) {
|
|
7924
7924
|
slotsByName.set(slotName, {
|
|
7925
7925
|
name: slotName,
|
|
@@ -14333,7 +14333,7 @@ function errorMessage(error) {
|
|
|
14333
14333
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14334
14334
|
}
|
|
14335
14335
|
function defaultSleep(delayMs) {
|
|
14336
|
-
return new Promise((
|
|
14336
|
+
return new Promise((resolve28) => setTimeout(resolve28, delayMs));
|
|
14337
14337
|
}
|
|
14338
14338
|
var MAX_RETRY_AFTER_MS;
|
|
14339
14339
|
var init_http_utils = __esm({
|
|
@@ -14609,7 +14609,7 @@ var init_api_client = __esm({
|
|
|
14609
14609
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14610
14610
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14611
14611
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14612
|
-
await new Promise((
|
|
14612
|
+
await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
|
|
14613
14613
|
}
|
|
14614
14614
|
}
|
|
14615
14615
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -16147,11 +16147,11 @@ function setCommandContext(context) {
|
|
|
16147
16147
|
mergeContext(state.pending.context, context);
|
|
16148
16148
|
mergeContext(state.pending.completion, context);
|
|
16149
16149
|
}
|
|
16150
|
-
function enrichCommandResult(
|
|
16150
|
+
function enrichCommandResult(fields2) {
|
|
16151
16151
|
if (!state.pending)
|
|
16152
16152
|
return;
|
|
16153
|
-
Object.assign(state.pending.completion,
|
|
16154
|
-
mergeContext(state.pending.context,
|
|
16153
|
+
Object.assign(state.pending.completion, fields2);
|
|
16154
|
+
mergeContext(state.pending.context, fields2);
|
|
16155
16155
|
}
|
|
16156
16156
|
var state;
|
|
16157
16157
|
var init_pending_command = __esm({
|
|
@@ -16235,16 +16235,16 @@ async function completeActiveCommand() {
|
|
|
16235
16235
|
duration_ms: durationMs
|
|
16236
16236
|
}, state.sessionId, { flush: true });
|
|
16237
16237
|
}
|
|
16238
|
-
async function failActiveCommand(
|
|
16238
|
+
async function failActiveCommand(fields2 = {}) {
|
|
16239
16239
|
if (!state.pending || state.pending.terminalEmitted || !state.sessionId || !state.pending.invoked)
|
|
16240
16240
|
return;
|
|
16241
16241
|
state.pending.terminalEmitted = true;
|
|
16242
16242
|
const durationMs = Date.now() - state.pending.startedAt;
|
|
16243
|
-
const outcome =
|
|
16243
|
+
const outcome = fields2.exit_code === 130 ? "interrupted" : "error";
|
|
16244
16244
|
await trackEvent("dsi_cli_command_failed", {
|
|
16245
16245
|
...buildBaseProps(state.pending.command),
|
|
16246
16246
|
...state.pending.context,
|
|
16247
|
-
...
|
|
16247
|
+
...fields2,
|
|
16248
16248
|
outcome,
|
|
16249
16249
|
duration_ms: durationMs
|
|
16250
16250
|
}, state.sessionId, { flush: true });
|
|
@@ -18527,7 +18527,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18527
18527
|
const message = error instanceof Error ? error.message : String(error);
|
|
18528
18528
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18529
18529
|
throw error;
|
|
18530
|
-
await new Promise((
|
|
18530
|
+
await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
|
|
18531
18531
|
}
|
|
18532
18532
|
}
|
|
18533
18533
|
}
|
|
@@ -19446,6 +19446,7 @@ var init_src4 = __esm({
|
|
|
19446
19446
|
init_agents();
|
|
19447
19447
|
init_agent_name();
|
|
19448
19448
|
init_models();
|
|
19449
|
+
init_binaries();
|
|
19449
19450
|
init_is_agent_name();
|
|
19450
19451
|
init_agent_supports_bedrock();
|
|
19451
19452
|
init_check_agent_auth();
|
|
@@ -19554,10 +19555,10 @@ var init_config = __esm({
|
|
|
19554
19555
|
}
|
|
19555
19556
|
});
|
|
19556
19557
|
|
|
19557
|
-
// packages/experience-design-system-cli/src/tui/settings/
|
|
19558
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
|
|
19558
19559
|
var readV1Store, writeV1Store;
|
|
19559
19560
|
var init_v1_store = __esm({
|
|
19560
|
-
"packages/experience-design-system-cli/src/tui/settings/
|
|
19561
|
+
"packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts"() {
|
|
19561
19562
|
"use strict";
|
|
19562
19563
|
init_config();
|
|
19563
19564
|
readV1Store = readSettings2;
|
|
@@ -19565,6 +19566,90 @@ var init_v1_store = __esm({
|
|
|
19565
19566
|
}
|
|
19566
19567
|
});
|
|
19567
19568
|
|
|
19569
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
|
|
19570
|
+
function emptyAgents() {
|
|
19571
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
19572
|
+
}
|
|
19573
|
+
async function readAgentConfig() {
|
|
19574
|
+
const store = await readV1Store();
|
|
19575
|
+
const stored = asString(store["agent"]);
|
|
19576
|
+
const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
|
|
19577
|
+
const agents = emptyAgents();
|
|
19578
|
+
const saved = store["agents"];
|
|
19579
|
+
if (saved && typeof saved === "object") {
|
|
19580
|
+
for (const name of AGENT_NAMES) {
|
|
19581
|
+
const entry = saved[name];
|
|
19582
|
+
if (entry && typeof entry === "object") {
|
|
19583
|
+
const fields2 = entry;
|
|
19584
|
+
agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
19585
|
+
}
|
|
19586
|
+
}
|
|
19587
|
+
}
|
|
19588
|
+
const legacyModel = asString(store["agentModel"]);
|
|
19589
|
+
if (legacyModel && !agents[defaultAgent].model)
|
|
19590
|
+
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
19591
|
+
return { defaultAgent, agents };
|
|
19592
|
+
}
|
|
19593
|
+
async function writeAgentConfig(config) {
|
|
19594
|
+
const existing = await readV1Store();
|
|
19595
|
+
const merged = { ...existing };
|
|
19596
|
+
const agents = {};
|
|
19597
|
+
for (const name of AGENT_NAMES) {
|
|
19598
|
+
const model = config.agents[name].model.trim();
|
|
19599
|
+
const binary = config.agents[name].binary.trim();
|
|
19600
|
+
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
19601
|
+
}
|
|
19602
|
+
merged["agent"] = config.defaultAgent;
|
|
19603
|
+
const defaultModel = agents[config.defaultAgent]?.model;
|
|
19604
|
+
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
19605
|
+
else delete merged["agentModel"];
|
|
19606
|
+
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
19607
|
+
else delete merged["agents"];
|
|
19608
|
+
await writeV1Store(merged);
|
|
19609
|
+
}
|
|
19610
|
+
var DEFAULT_AGENT3, AGENT_LABELS, asString;
|
|
19611
|
+
var init_agent_store = __esm({
|
|
19612
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts"() {
|
|
19613
|
+
"use strict";
|
|
19614
|
+
init_src4();
|
|
19615
|
+
init_v1_store();
|
|
19616
|
+
DEFAULT_AGENT3 = "claude";
|
|
19617
|
+
AGENT_LABELS = {
|
|
19618
|
+
claude: "Claude Code",
|
|
19619
|
+
codex: "OpenAI Codex",
|
|
19620
|
+
opencode: "OpenCode",
|
|
19621
|
+
cursor: "Cursor",
|
|
19622
|
+
copilot: "GitHub Copilot"
|
|
19623
|
+
};
|
|
19624
|
+
asString = (value) => typeof value === "string" ? value : "";
|
|
19625
|
+
}
|
|
19626
|
+
});
|
|
19627
|
+
|
|
19628
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
19629
|
+
function applyBinaryOverrides(config) {
|
|
19630
|
+
for (const name of AGENT_NAMES) {
|
|
19631
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
19632
|
+
const binary = config.agents[name].binary.trim();
|
|
19633
|
+
if (binary) {
|
|
19634
|
+
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
19635
|
+
process.env[key] = binary;
|
|
19636
|
+
} else if (shellValues.has(key)) {
|
|
19637
|
+
const shellValue = shellValues.get(key);
|
|
19638
|
+
if (shellValue === void 0) delete process.env[key];
|
|
19639
|
+
else process.env[key] = shellValue;
|
|
19640
|
+
shellValues.delete(key);
|
|
19641
|
+
}
|
|
19642
|
+
}
|
|
19643
|
+
}
|
|
19644
|
+
var shellValues;
|
|
19645
|
+
var init_apply_binary_overrides = __esm({
|
|
19646
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts"() {
|
|
19647
|
+
"use strict";
|
|
19648
|
+
init_src4();
|
|
19649
|
+
shellValues = /* @__PURE__ */ new Map();
|
|
19650
|
+
}
|
|
19651
|
+
});
|
|
19652
|
+
|
|
19568
19653
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
19569
19654
|
async function readAnalyticsSetting() {
|
|
19570
19655
|
const store = await readV1Store();
|
|
@@ -19652,7 +19737,7 @@ var init_home_theme = __esm({
|
|
|
19652
19737
|
}
|
|
19653
19738
|
});
|
|
19654
19739
|
|
|
19655
|
-
// packages/experience-design-system-cli/src/tui/
|
|
19740
|
+
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
19656
19741
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
19657
19742
|
import { join as join17 } from "node:path";
|
|
19658
19743
|
import semver from "semver";
|
|
@@ -19685,7 +19770,7 @@ async function checkForUpgrade() {
|
|
|
19685
19770
|
}
|
|
19686
19771
|
var PACKAGE_NAME2, TAGS_URL;
|
|
19687
19772
|
var init_version = __esm({
|
|
19688
|
-
"packages/experience-design-system-cli/src/tui/
|
|
19773
|
+
"packages/experience-design-system-cli/src/tui/upgrade/version.ts"() {
|
|
19689
19774
|
"use strict";
|
|
19690
19775
|
init_package_root();
|
|
19691
19776
|
PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
@@ -19739,14 +19824,14 @@ var init_control_hints = __esm({
|
|
|
19739
19824
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
19740
19825
|
import { Box, Text as Text2, useApp, useInput } from "ink";
|
|
19741
19826
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19742
|
-
function
|
|
19827
|
+
function upgradeItemDisplay(upgradeCheck) {
|
|
19743
19828
|
if (upgradeCheck?.status === "update-available") {
|
|
19744
|
-
return {
|
|
19829
|
+
return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
|
|
19745
19830
|
}
|
|
19746
19831
|
if (upgradeCheck?.status === "up-to-date") {
|
|
19747
|
-
return {
|
|
19832
|
+
return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
|
|
19748
19833
|
}
|
|
19749
|
-
return
|
|
19834
|
+
return { label: "Upgrade Version" };
|
|
19750
19835
|
}
|
|
19751
19836
|
function HomeScreen({ onNavigate }) {
|
|
19752
19837
|
const [focusIdx, setFocusIdx] = useState2(0);
|
|
@@ -19754,7 +19839,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
19754
19839
|
const { exit } = useApp();
|
|
19755
19840
|
const terminalWidth = useTerminalWidth();
|
|
19756
19841
|
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
19757
|
-
const
|
|
19842
|
+
const upgradeDisabled = upgradeCheck?.status === "up-to-date";
|
|
19758
19843
|
useEffect2(() => {
|
|
19759
19844
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
19760
19845
|
}, []);
|
|
@@ -19774,6 +19859,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
19774
19859
|
}
|
|
19775
19860
|
if (key.return) {
|
|
19776
19861
|
const item = START_ITEMS[focusIdx];
|
|
19862
|
+
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
19777
19863
|
onNavigate(item.screen);
|
|
19778
19864
|
return;
|
|
19779
19865
|
}
|
|
@@ -19791,16 +19877,26 @@ function HomeScreen({ onNavigate }) {
|
|
|
19791
19877
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
19792
19878
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
19793
19879
|
"v",
|
|
19794
|
-
VERSION
|
|
19795
|
-
status && /* @__PURE__ */ jsx2(Text2, { color: status.color, children: status.text })
|
|
19880
|
+
VERSION
|
|
19796
19881
|
] })
|
|
19797
19882
|
] }),
|
|
19798
19883
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
19799
19884
|
const focused = i === focusIdx;
|
|
19800
|
-
|
|
19801
|
-
|
|
19885
|
+
const isUpgradeItem = item.screen === "upgrade";
|
|
19886
|
+
const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
|
|
19887
|
+
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
19888
|
+
return /* @__PURE__ */ jsxs(
|
|
19889
|
+
Text2,
|
|
19890
|
+
{
|
|
19891
|
+
bold: focused && !dimmed,
|
|
19892
|
+
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
19893
|
+
children: [
|
|
19894
|
+
focused ? `${FOCUS_MARKER} ` : " ",
|
|
19895
|
+
display.label
|
|
19896
|
+
]
|
|
19897
|
+
},
|
|
19802
19898
|
item.label
|
|
19803
|
-
|
|
19899
|
+
);
|
|
19804
19900
|
}) }) }),
|
|
19805
19901
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
19806
19902
|
ControlHints,
|
|
@@ -19829,6 +19925,7 @@ var init_home = __esm({
|
|
|
19829
19925
|
MIN_TERMINAL_WIDTH = 164;
|
|
19830
19926
|
START_ITEMS = [
|
|
19831
19927
|
{ label: "Import", screen: "import" },
|
|
19928
|
+
{ label: "Upgrade Version", screen: "upgrade" },
|
|
19832
19929
|
{ label: "Settings", screen: "settings" },
|
|
19833
19930
|
{ label: "Help", screen: "help" }
|
|
19834
19931
|
];
|
|
@@ -26119,16 +26216,16 @@ function SlotRow({
|
|
|
26119
26216
|
] });
|
|
26120
26217
|
}
|
|
26121
26218
|
function propFields(prop) {
|
|
26122
|
-
const
|
|
26219
|
+
const fields2 = ["description", "required", "type"];
|
|
26123
26220
|
if (prop.type === "token") {
|
|
26124
|
-
|
|
26221
|
+
fields2.push("tokenKind");
|
|
26125
26222
|
}
|
|
26126
|
-
if (prop.type === "enum")
|
|
26223
|
+
if (prop.type === "enum") fields2.push("values");
|
|
26127
26224
|
if (prop.type !== "richtext" && prop.type !== "media" && prop.type !== "link") {
|
|
26128
|
-
|
|
26225
|
+
fields2.push("default");
|
|
26129
26226
|
}
|
|
26130
|
-
if (prop.type === "token" && prop.category === "design")
|
|
26131
|
-
return
|
|
26227
|
+
if (prop.type === "token" && prop.category === "design") fields2.push("allowed");
|
|
26228
|
+
return fields2;
|
|
26132
26229
|
}
|
|
26133
26230
|
function simulateGraphWithCandidate(projectSlotGraph, selfName, currentSlots, targetSlotName, candidate) {
|
|
26134
26231
|
const selfEntry = {
|
|
@@ -26666,8 +26763,8 @@ function FieldEditor({
|
|
|
26666
26763
|
return;
|
|
26667
26764
|
}
|
|
26668
26765
|
if (focusLevel === "field") {
|
|
26669
|
-
const
|
|
26670
|
-
const currentFieldIdx =
|
|
26766
|
+
const fields2 = inSlots ? SLOT_FIELDS : currentProp ? propFields(currentProp) : [];
|
|
26767
|
+
const currentFieldIdx = fields2.indexOf(activeField);
|
|
26671
26768
|
const isValuesNav = activeField === "values" || activeField === "allowedComponents";
|
|
26672
26769
|
const arrowUp = key.upArrow;
|
|
26673
26770
|
const arrowDown = key.downArrow;
|
|
@@ -26681,10 +26778,10 @@ function FieldEditor({
|
|
|
26681
26778
|
const navPrevious = arrowUp || arrowLeft;
|
|
26682
26779
|
const navNext = arrowDown || arrowRight || input === "j";
|
|
26683
26780
|
const navBack = navPrevious || input === "k";
|
|
26684
|
-
if ((navBack || navNext) &&
|
|
26685
|
-
const lastIdx =
|
|
26781
|
+
if ((navBack || navNext) && fields2.length > 0) {
|
|
26782
|
+
const lastIdx = fields2.length - 1;
|
|
26686
26783
|
const targetIdx = navNext ? currentFieldIdx >= lastIdx ? 0 : currentFieldIdx + 1 : currentFieldIdx <= 0 ? lastIdx : currentFieldIdx - 1;
|
|
26687
|
-
const next =
|
|
26784
|
+
const next = fields2[targetIdx];
|
|
26688
26785
|
setActiveField(next);
|
|
26689
26786
|
if (next === "description") {
|
|
26690
26787
|
const desc = inSlots ? currentSlot?.description ?? "" : currentProp?.description ?? "";
|
|
@@ -32261,7 +32358,7 @@ var init_save = __esm({
|
|
|
32261
32358
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32262
32359
|
appendRun,
|
|
32263
32360
|
buildSourceFingerprint,
|
|
32264
|
-
sleep: (ms) => new Promise((
|
|
32361
|
+
sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
|
|
32265
32362
|
warn: (message) => process.stderr.write(message)
|
|
32266
32363
|
});
|
|
32267
32364
|
}
|
|
@@ -32812,13 +32909,48 @@ var init_debug_store = __esm({
|
|
|
32812
32909
|
}
|
|
32813
32910
|
});
|
|
32814
32911
|
|
|
32912
|
+
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
32913
|
+
import { join as join26, resolve as resolve27 } from "node:path";
|
|
32914
|
+
function describeFileLocations({
|
|
32915
|
+
contentfulBaseDir,
|
|
32916
|
+
debugModeEnabled,
|
|
32917
|
+
currentSessionDir: currentSessionDir2
|
|
32918
|
+
}) {
|
|
32919
|
+
if (!debugModeEnabled) {
|
|
32920
|
+
return {
|
|
32921
|
+
debugLogs: "none while Debug Mode is off",
|
|
32922
|
+
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
32923
|
+
};
|
|
32924
|
+
}
|
|
32925
|
+
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
32926
|
+
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
32927
|
+
return {
|
|
32928
|
+
debugLogs: join26(session, "debug"),
|
|
32929
|
+
importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
32930
|
+
};
|
|
32931
|
+
}
|
|
32932
|
+
var init_file_locations = __esm({
|
|
32933
|
+
"packages/experience-design-system-cli/src/tui/help/file-locations.ts"() {
|
|
32934
|
+
"use strict";
|
|
32935
|
+
}
|
|
32936
|
+
});
|
|
32937
|
+
|
|
32815
32938
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32816
32939
|
async function readHelpInfo() {
|
|
32817
|
-
const debugMode = await readDebugModeSetting();
|
|
32940
|
+
const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
|
|
32941
|
+
const base = settings["contentfulBaseDir"];
|
|
32942
|
+
const locations = describeFileLocations({
|
|
32943
|
+
contentfulBaseDir: typeof base === "string" ? base : "",
|
|
32944
|
+
debugModeEnabled: debugMode.enabled,
|
|
32945
|
+
currentSessionDir: currentSessionDir()
|
|
32946
|
+
});
|
|
32818
32947
|
return {
|
|
32819
32948
|
storage: [
|
|
32820
32949
|
{ label: "Config folder", value: configRoot2() },
|
|
32821
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
32950
|
+
{ label: "Settings file", value: configFilePath2() },
|
|
32951
|
+
{ label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
|
|
32952
|
+
{ label: "Debug logs", value: locations.debugLogs },
|
|
32953
|
+
{ label: "Import files", value: locations.importFiles }
|
|
32822
32954
|
],
|
|
32823
32955
|
troubleshooting: [
|
|
32824
32956
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32839,6 +32971,7 @@ var init_help_info = __esm({
|
|
|
32839
32971
|
init_debug_store();
|
|
32840
32972
|
init_debug_mode_store();
|
|
32841
32973
|
init_version();
|
|
32974
|
+
init_file_locations();
|
|
32842
32975
|
}
|
|
32843
32976
|
});
|
|
32844
32977
|
|
|
@@ -32850,7 +32983,7 @@ function Section({ title, rows }) {
|
|
|
32850
32983
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
32851
32984
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
32852
32985
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
32853
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
32986
|
+
/* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
32854
32987
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
32855
32988
|
] }, row.label))
|
|
32856
32989
|
] });
|
|
@@ -32965,7 +33098,657 @@ var init_PageContainer3 = __esm({
|
|
|
32965
33098
|
}
|
|
32966
33099
|
});
|
|
32967
33100
|
|
|
32968
|
-
// packages/experience-design-system-cli/src/tui/settings/
|
|
33101
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
33102
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
33103
|
+
import { access as access6, constants } from "node:fs/promises";
|
|
33104
|
+
function effectiveBinary(name, savedBinary) {
|
|
33105
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
33106
|
+
}
|
|
33107
|
+
function defaultModelLabel(name) {
|
|
33108
|
+
const model = DEFAULT_MODELS[name];
|
|
33109
|
+
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33110
|
+
}
|
|
33111
|
+
function resolveOnPath(binary) {
|
|
33112
|
+
if (binary.includes("/")) {
|
|
33113
|
+
return access6(binary, constants.X_OK).then(
|
|
33114
|
+
() => binary,
|
|
33115
|
+
() => null
|
|
33116
|
+
);
|
|
33117
|
+
}
|
|
33118
|
+
return new Promise((resolve28) => {
|
|
33119
|
+
execFile2(
|
|
33120
|
+
process.platform === "win32" ? "where" : "which",
|
|
33121
|
+
[binary],
|
|
33122
|
+
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
33123
|
+
);
|
|
33124
|
+
});
|
|
33125
|
+
}
|
|
33126
|
+
function readVersion(binary) {
|
|
33127
|
+
return new Promise((resolve28) => {
|
|
33128
|
+
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
33129
|
+
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
33130
|
+
if (!error && line) resolve28(pass("version", line));
|
|
33131
|
+
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
33132
|
+
});
|
|
33133
|
+
});
|
|
33134
|
+
}
|
|
33135
|
+
async function inspect(name, binary) {
|
|
33136
|
+
const target = effectiveBinary(name, binary);
|
|
33137
|
+
const found = await resolveOnPath(target);
|
|
33138
|
+
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
33139
|
+
const checks = [pass("path", found)];
|
|
33140
|
+
checks.push(await readVersion(found));
|
|
33141
|
+
if (name === "claude") {
|
|
33142
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
33143
|
+
checks.push(
|
|
33144
|
+
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33145
|
+
);
|
|
33146
|
+
}
|
|
33147
|
+
return { checks, found };
|
|
33148
|
+
}
|
|
33149
|
+
async function inspectAgent(name, binary) {
|
|
33150
|
+
return (await inspect(name, binary)).checks;
|
|
33151
|
+
}
|
|
33152
|
+
async function testAgent(name, binary, model) {
|
|
33153
|
+
const { checks, found } = await inspect(name, binary);
|
|
33154
|
+
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33155
|
+
const started = Date.now();
|
|
33156
|
+
const result = await withBinaryEnv(
|
|
33157
|
+
name,
|
|
33158
|
+
found,
|
|
33159
|
+
() => createLocalCliAgentInvoker().invoke({
|
|
33160
|
+
agent: name,
|
|
33161
|
+
...model.trim() ? { model: model.trim() } : {},
|
|
33162
|
+
prompt: TEST_PROMPT,
|
|
33163
|
+
timeoutMs: PROMPT_TIMEOUT_MS
|
|
33164
|
+
})
|
|
33165
|
+
);
|
|
33166
|
+
const seconds = ((Date.now() - started) / 1e3).toFixed(1);
|
|
33167
|
+
if (result.timedOut) {
|
|
33168
|
+
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
33169
|
+
}
|
|
33170
|
+
if (result.exitCode !== 0) {
|
|
33171
|
+
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
33172
|
+
return [...checks, fail3("prompt", reason)];
|
|
33173
|
+
}
|
|
33174
|
+
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33175
|
+
}
|
|
33176
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
33177
|
+
if (checks.length === 0) return "checking";
|
|
33178
|
+
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33179
|
+
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
33180
|
+
}
|
|
33181
|
+
const prompt = checks.find((check) => check.step === "prompt");
|
|
33182
|
+
if (prompt) {
|
|
33183
|
+
if (prompt.ok) return "ready";
|
|
33184
|
+
return prompt.timedOut ? "timed-out" : "test-failed";
|
|
33185
|
+
}
|
|
33186
|
+
const login = checks.find((check) => check.step === "login");
|
|
33187
|
+
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33188
|
+
return name === "claude" ? "ready" : "unknown";
|
|
33189
|
+
}
|
|
33190
|
+
function setupHint(name, status) {
|
|
33191
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
33192
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
33193
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33194
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
33195
|
+
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
33196
|
+
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33197
|
+
return "";
|
|
33198
|
+
}
|
|
33199
|
+
function testOutcome(checks) {
|
|
33200
|
+
const prompt = checks?.find((check) => check.step === "prompt");
|
|
33201
|
+
if (!prompt) return void 0;
|
|
33202
|
+
if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
|
|
33203
|
+
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
33204
|
+
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
33205
|
+
}
|
|
33206
|
+
function modelLine(name, savedModel) {
|
|
33207
|
+
const model = savedModel.trim();
|
|
33208
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
33209
|
+
}
|
|
33210
|
+
function baseRows(name, checks, savedBinary) {
|
|
33211
|
+
const path5 = checks.find((check) => check.step === "path");
|
|
33212
|
+
const version = checks.find((check) => check.step === "version");
|
|
33213
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
33214
|
+
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
33215
|
+
if (!path5?.ok) {
|
|
33216
|
+
const saved = savedBinary.trim() !== "";
|
|
33217
|
+
const command = {
|
|
33218
|
+
label: "Command",
|
|
33219
|
+
value: saved ? path5?.detail ?? "not found" : "not configured (not on the PATH)",
|
|
33220
|
+
tone: saved ? "bad" : "muted"
|
|
33221
|
+
};
|
|
33222
|
+
return { command, version: void 0, setup, found: false };
|
|
33223
|
+
}
|
|
33224
|
+
return {
|
|
33225
|
+
command: { label: "Command", value: path5.detail, tone: "ok" },
|
|
33226
|
+
version: {
|
|
33227
|
+
label: "Version",
|
|
33228
|
+
value: version?.ok ? version.detail : "could not be read",
|
|
33229
|
+
tone: version?.ok ? "ok" : "muted"
|
|
33230
|
+
},
|
|
33231
|
+
setup,
|
|
33232
|
+
found: true
|
|
33233
|
+
};
|
|
33234
|
+
}
|
|
33235
|
+
function panelRows(name, checks, settings) {
|
|
33236
|
+
if (!checks) return checking;
|
|
33237
|
+
const { command, version, setup, found } = baseRows(name, checks, settings.binary);
|
|
33238
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
33239
|
+
return [command, ...found ? [...version?.tone === "ok" ? [version] : [], model] : [], ...setup ? [setup] : []];
|
|
33240
|
+
}
|
|
33241
|
+
function statusRows(name, checks, savedBinary) {
|
|
33242
|
+
if (!checks) return checking;
|
|
33243
|
+
const { command, version, setup, found } = baseRows(name, checks, savedBinary);
|
|
33244
|
+
if (!found) return [command];
|
|
33245
|
+
const login = checks.find((check) => check.step === "login");
|
|
33246
|
+
const prompt = checks.find((check) => check.step === "prompt");
|
|
33247
|
+
let loginRow;
|
|
33248
|
+
if (login) {
|
|
33249
|
+
loginRow = { label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" };
|
|
33250
|
+
} else if (prompt) {
|
|
33251
|
+
loginRow = {
|
|
33252
|
+
label: "Login",
|
|
33253
|
+
value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
|
|
33254
|
+
tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
|
|
33255
|
+
};
|
|
33256
|
+
} else {
|
|
33257
|
+
loginRow = { label: "Login", value: "not checked (use Run test)", tone: "muted" };
|
|
33258
|
+
}
|
|
33259
|
+
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
33260
|
+
return [command, ...version ? [version] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
33261
|
+
}
|
|
33262
|
+
async function withBinaryEnv(name, binary, run) {
|
|
33263
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33264
|
+
const previous = process.env[key];
|
|
33265
|
+
process.env[key] = binary;
|
|
33266
|
+
try {
|
|
33267
|
+
return await run();
|
|
33268
|
+
} finally {
|
|
33269
|
+
if (previous === void 0) delete process.env[key];
|
|
33270
|
+
else process.env[key] = previous;
|
|
33271
|
+
}
|
|
33272
|
+
}
|
|
33273
|
+
var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail3, pass, LIST_STATUS, checking;
|
|
33274
|
+
var init_agent_status = __esm({
|
|
33275
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts"() {
|
|
33276
|
+
"use strict";
|
|
33277
|
+
init_src4();
|
|
33278
|
+
VERSION_TIMEOUT_MS = 5e3;
|
|
33279
|
+
PROMPT_TIMEOUT_MS = 6e4;
|
|
33280
|
+
TEST_PROMPT = "Reply with the single word: ok";
|
|
33281
|
+
INSTALL_HINTS = {
|
|
33282
|
+
claude: "npm install -g @anthropic-ai/claude-code",
|
|
33283
|
+
codex: "npm install -g @openai/codex",
|
|
33284
|
+
opencode: "npm install -g opencode-ai",
|
|
33285
|
+
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
33286
|
+
copilot: "npm install -g @github/copilot"
|
|
33287
|
+
};
|
|
33288
|
+
LOGIN_HINTS = {
|
|
33289
|
+
claude: "run `claude login`",
|
|
33290
|
+
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
33291
|
+
opencode: "run `opencode auth`",
|
|
33292
|
+
cursor: "sign in from Cursor",
|
|
33293
|
+
copilot: "run `copilot` and sign in"
|
|
33294
|
+
};
|
|
33295
|
+
fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
33296
|
+
pass = (step, detail) => ({ step, ok: true, detail });
|
|
33297
|
+
LIST_STATUS = {
|
|
33298
|
+
checking: { symbol: "\u2026", text: "checking", tone: "muted" },
|
|
33299
|
+
ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
|
|
33300
|
+
"not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
|
|
33301
|
+
"not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
|
|
33302
|
+
"not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
|
|
33303
|
+
"test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
|
|
33304
|
+
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
33305
|
+
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
33306
|
+
};
|
|
33307
|
+
checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
33308
|
+
}
|
|
33309
|
+
});
|
|
33310
|
+
|
|
33311
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
33312
|
+
import { useState as useState29 } from "react";
|
|
33313
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33314
|
+
import TextInput4 from "ink-text-input";
|
|
33315
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33316
|
+
function FieldForm({
|
|
33317
|
+
title,
|
|
33318
|
+
subtitle,
|
|
33319
|
+
fields: fields2,
|
|
33320
|
+
values,
|
|
33321
|
+
onChange,
|
|
33322
|
+
onSave,
|
|
33323
|
+
onQuit,
|
|
33324
|
+
actions = [],
|
|
33325
|
+
notice,
|
|
33326
|
+
busy = false,
|
|
33327
|
+
children
|
|
33328
|
+
}) {
|
|
33329
|
+
const [active, setActive] = useState29(0);
|
|
33330
|
+
const [editing, setEditing] = useState29(false);
|
|
33331
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33332
|
+
const rowCount = fields2.length + actions.length;
|
|
33333
|
+
const labelWidth = Math.max(
|
|
33334
|
+
...fields2.map((field) => field.label.length),
|
|
33335
|
+
...actions.map((action) => action.label.length)
|
|
33336
|
+
);
|
|
33337
|
+
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
33338
|
+
const currentAction = currentField ? void 0 : actions[active - fields2.length];
|
|
33339
|
+
useInput11((input, key) => {
|
|
33340
|
+
if (busy) return;
|
|
33341
|
+
if (editing) {
|
|
33342
|
+
if (key.escape && currentField) {
|
|
33343
|
+
onChange(currentField.key, valueBeforeEdit);
|
|
33344
|
+
setEditing(false);
|
|
33345
|
+
}
|
|
33346
|
+
return;
|
|
33347
|
+
}
|
|
33348
|
+
if (key.escape || input === "q") {
|
|
33349
|
+
onQuit();
|
|
33350
|
+
return;
|
|
33351
|
+
}
|
|
33352
|
+
if (input === "s") {
|
|
33353
|
+
onSave();
|
|
33354
|
+
return;
|
|
33355
|
+
}
|
|
33356
|
+
if (input === "c" && currentField) {
|
|
33357
|
+
onChange(currentField.key, "");
|
|
33358
|
+
return;
|
|
33359
|
+
}
|
|
33360
|
+
if (key.tab || key.downArrow) {
|
|
33361
|
+
setActive((i) => (i + 1) % rowCount);
|
|
33362
|
+
return;
|
|
33363
|
+
}
|
|
33364
|
+
if (key.upArrow) {
|
|
33365
|
+
setActive((i) => (i - 1 + rowCount) % rowCount);
|
|
33366
|
+
return;
|
|
33367
|
+
}
|
|
33368
|
+
if (key.return) {
|
|
33369
|
+
if (currentField) {
|
|
33370
|
+
setValueBeforeEdit(values[currentField.key]);
|
|
33371
|
+
setEditing(true);
|
|
33372
|
+
} else {
|
|
33373
|
+
currentAction?.onRun();
|
|
33374
|
+
}
|
|
33375
|
+
}
|
|
33376
|
+
});
|
|
33377
|
+
const pointer = (isActive) => /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " });
|
|
33378
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33379
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: title }),
|
|
33380
|
+
subtitle && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: subtitle }),
|
|
33381
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33382
|
+
/* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", children: [
|
|
33383
|
+
fields2.map((field, index) => {
|
|
33384
|
+
const isActive = index === active;
|
|
33385
|
+
const value = values[field.key];
|
|
33386
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
33387
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33388
|
+
pointer(isActive),
|
|
33389
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
33390
|
+
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33391
|
+
TextInput4,
|
|
33392
|
+
{
|
|
33393
|
+
value,
|
|
33394
|
+
onChange: (next) => onChange(field.key, next),
|
|
33395
|
+
onSubmit: () => setEditing(false),
|
|
33396
|
+
mask: field.masked ? "\u2022" : void 0
|
|
33397
|
+
}
|
|
33398
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33399
|
+
field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
33400
|
+
] }, field.key);
|
|
33401
|
+
}),
|
|
33402
|
+
actions.map((action, index) => {
|
|
33403
|
+
const isActive = fields2.length + index === active;
|
|
33404
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33405
|
+
pointer(isActive),
|
|
33406
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: action.label }) }),
|
|
33407
|
+
/* @__PURE__ */ jsx55(Text46, { color: action.running ? PALETTE.accent : PALETTE.muted, children: action.running ? action.runningText ?? "running..." : action.description })
|
|
33408
|
+
] }, action.label);
|
|
33409
|
+
})
|
|
33410
|
+
] }),
|
|
33411
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33412
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33413
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33414
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33415
|
+
" ",
|
|
33416
|
+
notice.text
|
|
33417
|
+
] })
|
|
33418
|
+
] }),
|
|
33419
|
+
children,
|
|
33420
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33421
|
+
/* @__PURE__ */ jsx55(
|
|
33422
|
+
ControlHints,
|
|
33423
|
+
{
|
|
33424
|
+
hints: editing ? [
|
|
33425
|
+
{ keys: "type", label: "edit" },
|
|
33426
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33427
|
+
{ keys: "\u23CE", label: "done" },
|
|
33428
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33429
|
+
] : [
|
|
33430
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33431
|
+
{ keys: "\u23CE", label: currentAction ? currentAction.hint : "edit" },
|
|
33432
|
+
...currentField ? [{ keys: "c", label: "clear" }] : [],
|
|
33433
|
+
{ keys: "s", label: "save" },
|
|
33434
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
33435
|
+
]
|
|
33436
|
+
}
|
|
33437
|
+
)
|
|
33438
|
+
] });
|
|
33439
|
+
}
|
|
33440
|
+
var init_FieldForm = __esm({
|
|
33441
|
+
"packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
|
|
33442
|
+
"use strict";
|
|
33443
|
+
init_theme();
|
|
33444
|
+
init_control_hints();
|
|
33445
|
+
}
|
|
33446
|
+
});
|
|
33447
|
+
|
|
33448
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
33449
|
+
import { Text as Text47 } from "ink";
|
|
33450
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
33451
|
+
function AgentStatusBadge({
|
|
33452
|
+
name,
|
|
33453
|
+
checks,
|
|
33454
|
+
binary
|
|
33455
|
+
}) {
|
|
33456
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
33457
|
+
return /* @__PURE__ */ jsx56(Text47, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
33458
|
+
}
|
|
33459
|
+
var TONE_COLOR;
|
|
33460
|
+
var init_AgentStatusBadge = __esm({
|
|
33461
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx"() {
|
|
33462
|
+
"use strict";
|
|
33463
|
+
init_theme();
|
|
33464
|
+
init_agent_status();
|
|
33465
|
+
TONE_COLOR = {
|
|
33466
|
+
ok: PALETTE.success,
|
|
33467
|
+
bad: PALETTE.error,
|
|
33468
|
+
muted: PALETTE.muted
|
|
33469
|
+
};
|
|
33470
|
+
}
|
|
33471
|
+
});
|
|
33472
|
+
|
|
33473
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
33474
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
33475
|
+
import { Box as Box45, Text as Text48 } from "ink";
|
|
33476
|
+
import { jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33477
|
+
function Row2({ label, children }) {
|
|
33478
|
+
return /* @__PURE__ */ jsxs46(Box45, { children: [
|
|
33479
|
+
/* @__PURE__ */ jsx57(Box45, { width: POINTER_WIDTH + LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: label }) }),
|
|
33480
|
+
children
|
|
33481
|
+
] });
|
|
33482
|
+
}
|
|
33483
|
+
function StatusHeading() {
|
|
33484
|
+
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33485
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, color: PALETTE.muted, children: "STATUS" }),
|
|
33486
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "\xB7 read only" })
|
|
33487
|
+
] });
|
|
33488
|
+
}
|
|
33489
|
+
function AgentDetail({
|
|
33490
|
+
name,
|
|
33491
|
+
config,
|
|
33492
|
+
setConfig,
|
|
33493
|
+
onBack
|
|
33494
|
+
}) {
|
|
33495
|
+
const settings = config.agents[name];
|
|
33496
|
+
const [saving, setSaving] = useState30(false);
|
|
33497
|
+
const [testing, setTesting] = useState30(false);
|
|
33498
|
+
const [notice, setNotice] = useState30(null);
|
|
33499
|
+
const [checks, setChecks] = useState30(void 0);
|
|
33500
|
+
useEffect22(() => {
|
|
33501
|
+
let active = true;
|
|
33502
|
+
setChecks(void 0);
|
|
33503
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33504
|
+
return () => {
|
|
33505
|
+
active = false;
|
|
33506
|
+
};
|
|
33507
|
+
}, [name, settings.binary]);
|
|
33508
|
+
const save = () => {
|
|
33509
|
+
setSaving(true);
|
|
33510
|
+
setNotice(null);
|
|
33511
|
+
writeAgentConfig(config).then(() => {
|
|
33512
|
+
applyBinaryOverrides(config);
|
|
33513
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
33514
|
+
}).catch(
|
|
33515
|
+
(err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
|
|
33516
|
+
).finally(() => setSaving(false));
|
|
33517
|
+
};
|
|
33518
|
+
const runTest = () => {
|
|
33519
|
+
setTesting(true);
|
|
33520
|
+
setNotice(null);
|
|
33521
|
+
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
33522
|
+
setChecks(result);
|
|
33523
|
+
const outcome = testOutcome(result);
|
|
33524
|
+
setNotice(
|
|
33525
|
+
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
33526
|
+
);
|
|
33527
|
+
}).catch(
|
|
33528
|
+
(err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
|
|
33529
|
+
).finally(() => setTesting(false));
|
|
33530
|
+
};
|
|
33531
|
+
const action = {
|
|
33532
|
+
label: "Run test",
|
|
33533
|
+
description: "sends one small prompt (uses a few tokens)",
|
|
33534
|
+
running: testing,
|
|
33535
|
+
hint: "run test",
|
|
33536
|
+
onRun: runTest
|
|
33537
|
+
};
|
|
33538
|
+
return /* @__PURE__ */ jsx57(
|
|
33539
|
+
FieldForm,
|
|
33540
|
+
{
|
|
33541
|
+
title: AGENT_LABELS[name],
|
|
33542
|
+
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
33543
|
+
fields: fields(name),
|
|
33544
|
+
values: { binary: settings.binary, model: settings.model },
|
|
33545
|
+
onChange: (key, value) => {
|
|
33546
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
33547
|
+
setNotice(null);
|
|
33548
|
+
},
|
|
33549
|
+
onSave: save,
|
|
33550
|
+
onQuit: onBack,
|
|
33551
|
+
actions: [action],
|
|
33552
|
+
notice: testing ? null : notice,
|
|
33553
|
+
busy: saving || testing,
|
|
33554
|
+
children: /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
33555
|
+
/* @__PURE__ */ jsx57(StatusHeading, {}),
|
|
33556
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(Row2, { label: row.label, children: /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
33557
|
+
] })
|
|
33558
|
+
}
|
|
33559
|
+
);
|
|
33560
|
+
}
|
|
33561
|
+
var fields, LABEL_WIDTH, LABEL_GAP, POINTER_WIDTH;
|
|
33562
|
+
var init_AgentDetail = __esm({
|
|
33563
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx"() {
|
|
33564
|
+
"use strict";
|
|
33565
|
+
init_src4();
|
|
33566
|
+
init_theme();
|
|
33567
|
+
init_FieldForm();
|
|
33568
|
+
init_agent_store();
|
|
33569
|
+
init_agent_status();
|
|
33570
|
+
init_AgentStatusBadge();
|
|
33571
|
+
init_apply_binary_overrides();
|
|
33572
|
+
fields = (name) => [
|
|
33573
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
33574
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33575
|
+
];
|
|
33576
|
+
LABEL_WIDTH = "Command path".length;
|
|
33577
|
+
LABEL_GAP = 2;
|
|
33578
|
+
POINTER_WIDTH = 2;
|
|
33579
|
+
}
|
|
33580
|
+
});
|
|
33581
|
+
|
|
33582
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
33583
|
+
import { useEffect as useEffect23, useState as useState31 } from "react";
|
|
33584
|
+
import { Box as Box46, Text as Text49, useInput as useInput12 } from "ink";
|
|
33585
|
+
import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33586
|
+
function AgentsScreen({ onDone }) {
|
|
33587
|
+
const [config, setConfig] = useState31(null);
|
|
33588
|
+
const [focus, setFocus] = useState31(0);
|
|
33589
|
+
const [open, setOpen] = useState31(null);
|
|
33590
|
+
const [notice, setNotice] = useState31(null);
|
|
33591
|
+
const [saving, setSaving] = useState31(false);
|
|
33592
|
+
const [checks, setChecks] = useState31({});
|
|
33593
|
+
const inspectAll = (loaded) => {
|
|
33594
|
+
for (const name of AGENT_NAMES) {
|
|
33595
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
33596
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
33597
|
+
);
|
|
33598
|
+
}
|
|
33599
|
+
};
|
|
33600
|
+
useEffect23(() => {
|
|
33601
|
+
void readAgentConfig().then((loaded) => {
|
|
33602
|
+
setConfig(loaded);
|
|
33603
|
+
inspectAll(loaded);
|
|
33604
|
+
startDebugRun({
|
|
33605
|
+
flow: "settings/agents",
|
|
33606
|
+
step: "01-agents",
|
|
33607
|
+
menuOption: "Configuration > Agents",
|
|
33608
|
+
inputs: { default_agent: loaded.defaultAgent }
|
|
33609
|
+
});
|
|
33610
|
+
});
|
|
33611
|
+
}, []);
|
|
33612
|
+
const makeDefault = (name) => {
|
|
33613
|
+
if (!config || saving) return;
|
|
33614
|
+
if (name === config.defaultAgent) {
|
|
33615
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
33616
|
+
return;
|
|
33617
|
+
}
|
|
33618
|
+
setSaving(true);
|
|
33619
|
+
setNotice(null);
|
|
33620
|
+
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
33621
|
+
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
33622
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
33623
|
+
}).catch(
|
|
33624
|
+
(err) => setNotice({
|
|
33625
|
+
kind: "error",
|
|
33626
|
+
text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
|
|
33627
|
+
})
|
|
33628
|
+
).finally(() => setSaving(false));
|
|
33629
|
+
};
|
|
33630
|
+
useInput12((input, key) => {
|
|
33631
|
+
if (!config || open || saving) return;
|
|
33632
|
+
const focused = AGENT_NAMES[focus];
|
|
33633
|
+
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
33634
|
+
if (key.upArrow) {
|
|
33635
|
+
setFocus((i) => (i - 1 + AGENT_NAMES.length) % AGENT_NAMES.length);
|
|
33636
|
+
return;
|
|
33637
|
+
}
|
|
33638
|
+
if (key.downArrow || key.tab) {
|
|
33639
|
+
setFocus((i) => (i + 1) % AGENT_NAMES.length);
|
|
33640
|
+
return;
|
|
33641
|
+
}
|
|
33642
|
+
if (key.return) {
|
|
33643
|
+
makeDefault(focused);
|
|
33644
|
+
return;
|
|
33645
|
+
}
|
|
33646
|
+
if (key.rightArrow) {
|
|
33647
|
+
setNotice(null);
|
|
33648
|
+
setOpen(focused);
|
|
33649
|
+
return;
|
|
33650
|
+
}
|
|
33651
|
+
if (key.escape || input === "q") {
|
|
33652
|
+
void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
|
|
33653
|
+
onDone();
|
|
33654
|
+
}
|
|
33655
|
+
});
|
|
33656
|
+
if (!config) {
|
|
33657
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33658
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Agents" }),
|
|
33659
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33660
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "Loading..." })
|
|
33661
|
+
] });
|
|
33662
|
+
}
|
|
33663
|
+
if (open) {
|
|
33664
|
+
return /* @__PURE__ */ jsx58(
|
|
33665
|
+
AgentDetail,
|
|
33666
|
+
{
|
|
33667
|
+
name: open,
|
|
33668
|
+
config,
|
|
33669
|
+
setConfig,
|
|
33670
|
+
onBack: () => {
|
|
33671
|
+
setOpen(null);
|
|
33672
|
+
void readAgentConfig().then((saved) => {
|
|
33673
|
+
setConfig(saved);
|
|
33674
|
+
inspectAll(saved);
|
|
33675
|
+
});
|
|
33676
|
+
}
|
|
33677
|
+
}
|
|
33678
|
+
);
|
|
33679
|
+
}
|
|
33680
|
+
const focusedAgent = AGENT_NAMES[focus];
|
|
33681
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33682
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Agents" }),
|
|
33683
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
|
|
33684
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33685
|
+
/* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33686
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "Default agent" }),
|
|
33687
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: AGENT_LABELS[config.defaultAgent] }),
|
|
33688
|
+
saving && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "\u2026 saving" })
|
|
33689
|
+
] }),
|
|
33690
|
+
/* @__PURE__ */ jsxs47(Box46, { marginTop: 1, gap: 1, children: [
|
|
33691
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33692
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33693
|
+
/* @__PURE__ */ jsx58(Box46, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
33694
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "STATUS" })
|
|
33695
|
+
] }),
|
|
33696
|
+
AGENT_NAMES.map((name) => {
|
|
33697
|
+
const isFocused = focusedAgent === name;
|
|
33698
|
+
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33699
|
+
/* @__PURE__ */ jsx58(Text49, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
33700
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
33701
|
+
/* @__PURE__ */ jsx58(Box46, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
33702
|
+
/* @__PURE__ */ jsx58(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
33703
|
+
] }, name);
|
|
33704
|
+
}),
|
|
33705
|
+
/* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", marginTop: 1, children: [
|
|
33706
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|
|
33707
|
+
panelRows(focusedAgent, checks[focusedAgent], config.agents[focusedAgent]).map((row) => /* @__PURE__ */ jsxs47(Box46, { gap: 1, paddingLeft: 1, children: [
|
|
33708
|
+
/* @__PURE__ */ jsx58(Box46, { width: PANEL_LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: row.label }) }),
|
|
33709
|
+
/* @__PURE__ */ jsx58(Text49, { color: TONE_COLOR[row.tone], children: row.value })
|
|
33710
|
+
] }, row.label))
|
|
33711
|
+
] }),
|
|
33712
|
+
notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
33713
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33714
|
+
/* @__PURE__ */ jsxs47(Text49, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33715
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33716
|
+
" ",
|
|
33717
|
+
notice.text
|
|
33718
|
+
] })
|
|
33719
|
+
] }),
|
|
33720
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33721
|
+
/* @__PURE__ */ jsx58(
|
|
33722
|
+
ControlHints,
|
|
33723
|
+
{
|
|
33724
|
+
hints: [
|
|
33725
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33726
|
+
{ keys: "\u23CE", label: "make default" },
|
|
33727
|
+
{ keys: "\u2192", label: "settings and test" },
|
|
33728
|
+
{ keys: "Esc/q", label: "back" }
|
|
33729
|
+
]
|
|
33730
|
+
}
|
|
33731
|
+
)
|
|
33732
|
+
] });
|
|
33733
|
+
}
|
|
33734
|
+
var NAME_WIDTH, PANEL_LABEL_WIDTH;
|
|
33735
|
+
var init_AgentsScreen = __esm({
|
|
33736
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx"() {
|
|
33737
|
+
"use strict";
|
|
33738
|
+
init_src4();
|
|
33739
|
+
init_theme();
|
|
33740
|
+
init_control_hints();
|
|
33741
|
+
init_debug_store();
|
|
33742
|
+
init_agent_store();
|
|
33743
|
+
init_agent_status();
|
|
33744
|
+
init_AgentDetail();
|
|
33745
|
+
init_AgentStatusBadge();
|
|
33746
|
+
NAME_WIDTH = 16;
|
|
33747
|
+
PANEL_LABEL_WIDTH = "Command".length;
|
|
33748
|
+
}
|
|
33749
|
+
});
|
|
33750
|
+
|
|
33751
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/project/project-store.ts
|
|
32969
33752
|
async function readCredentials() {
|
|
32970
33753
|
const store = await readV1Store();
|
|
32971
33754
|
return {
|
|
@@ -32989,18 +33772,17 @@ async function writeCredentials(config) {
|
|
|
32989
33772
|
});
|
|
32990
33773
|
await writeV1Store(merged);
|
|
32991
33774
|
}
|
|
32992
|
-
var
|
|
32993
|
-
"packages/experience-design-system-cli/src/tui/settings/
|
|
33775
|
+
var init_project_store = __esm({
|
|
33776
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/project/project-store.ts"() {
|
|
32994
33777
|
"use strict";
|
|
32995
33778
|
init_v1_store();
|
|
32996
33779
|
}
|
|
32997
33780
|
});
|
|
32998
33781
|
|
|
32999
|
-
// packages/experience-design-system-cli/src/tui/settings/
|
|
33000
|
-
import { useEffect as
|
|
33001
|
-
import { Box as
|
|
33002
|
-
import
|
|
33003
|
-
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33782
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
33783
|
+
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
33784
|
+
import { Box as Box47, Text as Text50 } from "ink";
|
|
33785
|
+
import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33004
33786
|
function debugFields(config) {
|
|
33005
33787
|
return {
|
|
33006
33788
|
space_id: config?.spaceId ?? "",
|
|
@@ -33012,189 +33794,159 @@ function debugFields(config) {
|
|
|
33012
33794
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
33013
33795
|
};
|
|
33014
33796
|
}
|
|
33015
|
-
function
|
|
33016
|
-
const [
|
|
33017
|
-
const [
|
|
33018
|
-
const [
|
|
33019
|
-
const [
|
|
33020
|
-
|
|
33021
|
-
|
|
33022
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33023
|
-
useEffect22(() => {
|
|
33024
|
-
readCredentials().then((cfg) => {
|
|
33797
|
+
function ProjectScreen({ onDone }) {
|
|
33798
|
+
const [config, setConfig] = useState32(null);
|
|
33799
|
+
const [saving, setSaving] = useState32(false);
|
|
33800
|
+
const [notice, setNotice] = useState32(null);
|
|
33801
|
+
const [lastSaved, setLastSaved] = useState32(null);
|
|
33802
|
+
useEffect24(() => {
|
|
33803
|
+
void readCredentials().then((cfg) => {
|
|
33025
33804
|
setConfig(cfg);
|
|
33026
|
-
setStage("form");
|
|
33027
33805
|
startDebugRun({
|
|
33028
33806
|
flow: "settings/contentful-configuration",
|
|
33029
33807
|
step: "01-configuration",
|
|
33030
|
-
menuOption: "Configuration",
|
|
33808
|
+
menuOption: "Configuration > Project",
|
|
33031
33809
|
inputs: debugFields(cfg)
|
|
33032
33810
|
});
|
|
33033
33811
|
});
|
|
33034
33812
|
}, []);
|
|
33035
|
-
|
|
33036
|
-
|
|
33037
|
-
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
setConfig({ ...config, [field]: value });
|
|
33042
|
-
setNotice(null);
|
|
33813
|
+
if (!config) {
|
|
33814
|
+
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33815
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
|
|
33816
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33817
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
|
|
33818
|
+
] });
|
|
33043
33819
|
}
|
|
33044
|
-
|
|
33045
|
-
|
|
33046
|
-
setStage("saving");
|
|
33820
|
+
const save = () => {
|
|
33821
|
+
setSaving(true);
|
|
33047
33822
|
setNotice(null);
|
|
33048
33823
|
writeCredentials(config).then(() => {
|
|
33049
33824
|
setLastSaved(config);
|
|
33050
33825
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
33051
|
-
setNotice({ kind: "success", text: "
|
|
33052
|
-
setStage("form");
|
|
33826
|
+
setNotice({ kind: "success", text: "Project settings saved" });
|
|
33053
33827
|
}).catch((err) => {
|
|
33054
33828
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
function quit() {
|
|
33829
|
+
}).finally(() => setSaving(false));
|
|
33830
|
+
};
|
|
33831
|
+
const quit = () => {
|
|
33059
33832
|
void finishDebugRun(
|
|
33060
33833
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
33061
33834
|
);
|
|
33062
33835
|
onDone();
|
|
33063
|
-
}
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
|
|
33068
|
-
|
|
33069
|
-
|
|
33070
|
-
|
|
33071
|
-
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
|
|
33075
|
-
|
|
33076
|
-
|
|
33077
|
-
|
|
33078
|
-
|
|
33079
|
-
return;
|
|
33080
|
-
}
|
|
33081
|
-
if (input === "c") {
|
|
33082
|
-
setFieldValue(activeField, "");
|
|
33083
|
-
return;
|
|
33836
|
+
};
|
|
33837
|
+
return /* @__PURE__ */ jsx59(
|
|
33838
|
+
FieldForm,
|
|
33839
|
+
{
|
|
33840
|
+
title: "Project",
|
|
33841
|
+
subtitle: "The Contentful space and where the CLI keeps its files.",
|
|
33842
|
+
fields: FIELDS2,
|
|
33843
|
+
values: valuesOf(config),
|
|
33844
|
+
onChange: (key, value) => {
|
|
33845
|
+
setConfig({ ...config, [key]: value });
|
|
33846
|
+
setNotice(null);
|
|
33847
|
+
},
|
|
33848
|
+
onSave: save,
|
|
33849
|
+
onQuit: quit,
|
|
33850
|
+
notice,
|
|
33851
|
+
busy: saving
|
|
33084
33852
|
}
|
|
33085
|
-
|
|
33086
|
-
|
|
33087
|
-
|
|
33853
|
+
);
|
|
33854
|
+
}
|
|
33855
|
+
var FIELDS2, valuesOf;
|
|
33856
|
+
var init_ProjectScreen = __esm({
|
|
33857
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx"() {
|
|
33858
|
+
"use strict";
|
|
33859
|
+
init_theme();
|
|
33860
|
+
init_debug_store();
|
|
33861
|
+
init_FieldForm();
|
|
33862
|
+
init_project_store();
|
|
33863
|
+
FIELDS2 = [
|
|
33864
|
+
{ key: "spaceId", label: "Space ID" },
|
|
33865
|
+
{ key: "environmentId", label: "Environment ID" },
|
|
33866
|
+
{ key: "cmaToken", label: "CMA Token", masked: true },
|
|
33867
|
+
{ key: "host", label: "API Host" },
|
|
33868
|
+
{ key: "defaultComponentDir", label: "Default component directory" },
|
|
33869
|
+
{ key: "defaultTokenFile", label: "Default token file" },
|
|
33870
|
+
{ key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
|
|
33871
|
+
];
|
|
33872
|
+
valuesOf = (config) => Object.fromEntries(FIELDS2.map(({ key }) => [key, config[key] || ""]));
|
|
33873
|
+
}
|
|
33874
|
+
});
|
|
33875
|
+
|
|
33876
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
33877
|
+
import { useState as useState33 } from "react";
|
|
33878
|
+
import { Box as Box48, Text as Text51, useInput as useInput13 } from "ink";
|
|
33879
|
+
import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33880
|
+
function ConfigurationScreen({ onDone }) {
|
|
33881
|
+
const [focus, setFocus] = useState33(0);
|
|
33882
|
+
const [open, setOpen] = useState33(null);
|
|
33883
|
+
const close = () => setOpen(null);
|
|
33884
|
+
useInput13((input, key) => {
|
|
33885
|
+
if (open) return;
|
|
33886
|
+
if (key.upArrow) {
|
|
33887
|
+
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
33088
33888
|
return;
|
|
33089
33889
|
}
|
|
33090
|
-
if (key.
|
|
33091
|
-
|
|
33092
|
-
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
33890
|
+
if (key.downArrow || key.tab) {
|
|
33891
|
+
setFocus((i) => (i + 1) % SECTIONS.length);
|
|
33093
33892
|
return;
|
|
33094
33893
|
}
|
|
33095
33894
|
if (key.return) {
|
|
33096
|
-
|
|
33097
|
-
|
|
33895
|
+
setOpen(SECTIONS[focus].id);
|
|
33896
|
+
return;
|
|
33098
33897
|
}
|
|
33898
|
+
if (key.escape || input === "q") onDone();
|
|
33099
33899
|
});
|
|
33100
|
-
if (
|
|
33101
|
-
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
/* @__PURE__ */
|
|
33111
|
-
|
|
33112
|
-
const value = fieldValue(field);
|
|
33113
|
-
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
33114
|
-
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33115
|
-
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33116
|
-
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
33117
|
-
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33118
|
-
TextInput4,
|
|
33119
|
-
{
|
|
33120
|
-
value,
|
|
33121
|
-
onChange: (next) => setFieldValue(field, next),
|
|
33122
|
-
onSubmit: () => setEditing(false),
|
|
33123
|
-
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
33124
|
-
}
|
|
33125
|
-
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33126
|
-
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
33127
|
-
] }, field);
|
|
33128
|
-
}) }),
|
|
33129
|
-
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33130
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33131
|
-
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33132
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33133
|
-
" ",
|
|
33134
|
-
notice.text
|
|
33135
|
-
] })
|
|
33136
|
-
] }),
|
|
33137
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33138
|
-
/* @__PURE__ */ jsx55(
|
|
33900
|
+
if (open === "project") return /* @__PURE__ */ jsx60(ProjectScreen, { onDone: close });
|
|
33901
|
+
if (open === "agents") return /* @__PURE__ */ jsx60(AgentsScreen, { onDone: close });
|
|
33902
|
+
return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33903
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, children: "Configuration" }),
|
|
33904
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33905
|
+
SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
|
|
33906
|
+
/* @__PURE__ */ jsx60(Text51, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
|
|
33907
|
+
/* @__PURE__ */ jsx60(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx60(Text51, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
|
|
33908
|
+
/* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: section.description })
|
|
33909
|
+
] }, section.id)),
|
|
33910
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33911
|
+
/* @__PURE__ */ jsx60(
|
|
33139
33912
|
ControlHints,
|
|
33140
33913
|
{
|
|
33141
|
-
hints:
|
|
33142
|
-
{ keys: "type", label: "edit" },
|
|
33143
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33144
|
-
{ keys: "\u23CE", label: "done" },
|
|
33145
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33146
|
-
] : [
|
|
33914
|
+
hints: [
|
|
33147
33915
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
33148
|
-
{ keys: "\u23CE", label: "
|
|
33149
|
-
{ keys: "
|
|
33150
|
-
{ keys: "s", label: "save" },
|
|
33151
|
-
{ keys: "Esc/q", label: "quit without saving" }
|
|
33916
|
+
{ keys: "\u23CE", label: "open" },
|
|
33917
|
+
{ keys: "Esc/q", label: "back" }
|
|
33152
33918
|
]
|
|
33153
33919
|
}
|
|
33154
33920
|
)
|
|
33155
33921
|
] });
|
|
33156
33922
|
}
|
|
33157
|
-
var
|
|
33158
|
-
var
|
|
33159
|
-
"packages/experience-design-system-cli/src/tui/settings/
|
|
33923
|
+
var SECTIONS;
|
|
33924
|
+
var init_ConfigurationScreen = __esm({
|
|
33925
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx"() {
|
|
33160
33926
|
"use strict";
|
|
33161
33927
|
init_theme();
|
|
33162
|
-
init_config_store();
|
|
33163
|
-
init_debug_store();
|
|
33164
33928
|
init_control_hints();
|
|
33165
|
-
|
|
33166
|
-
|
|
33167
|
-
|
|
33168
|
-
|
|
33169
|
-
|
|
33170
|
-
|
|
33171
|
-
|
|
33172
|
-
|
|
33929
|
+
init_AgentsScreen();
|
|
33930
|
+
init_ProjectScreen();
|
|
33931
|
+
SECTIONS = [
|
|
33932
|
+
{
|
|
33933
|
+
id: "project",
|
|
33934
|
+
label: "Project",
|
|
33935
|
+
description: "Contentful space, credentials, defaults and where .contentful goes"
|
|
33936
|
+
},
|
|
33937
|
+
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
33173
33938
|
];
|
|
33174
|
-
FIELD_LABELS = {
|
|
33175
|
-
spaceId: "Space ID",
|
|
33176
|
-
environmentId: "Environment ID",
|
|
33177
|
-
cmaToken: "CMA Token",
|
|
33178
|
-
host: "API Host",
|
|
33179
|
-
defaultComponentDir: "Default component directory",
|
|
33180
|
-
defaultTokenFile: "Default token file",
|
|
33181
|
-
contentfulBaseDir: "Root Project Directory"
|
|
33182
|
-
};
|
|
33183
|
-
FIELD_HINTS = {
|
|
33184
|
-
contentfulBaseDir: "(where .contentful goes)"
|
|
33185
|
-
};
|
|
33186
|
-
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
33187
33939
|
}
|
|
33188
33940
|
});
|
|
33189
33941
|
|
|
33190
33942
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33191
|
-
import { useEffect as
|
|
33192
|
-
import { Box as
|
|
33193
|
-
import { Fragment as
|
|
33943
|
+
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
33944
|
+
import { Box as Box49, Text as Text52, useInput as useInput14 } from "ink";
|
|
33945
|
+
import { Fragment as Fragment19, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
33194
33946
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33195
|
-
const [loading, setLoading] =
|
|
33196
|
-
const [enabled, setEnabled] =
|
|
33197
|
-
|
|
33947
|
+
const [loading, setLoading] = useState34(true);
|
|
33948
|
+
const [enabled, setEnabled] = useState34(true);
|
|
33949
|
+
useEffect25(() => {
|
|
33198
33950
|
readAnalyticsSetting().then((setting) => {
|
|
33199
33951
|
setEnabled(setting.enabled);
|
|
33200
33952
|
setLoading(false);
|
|
@@ -33206,7 +33958,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33206
33958
|
});
|
|
33207
33959
|
});
|
|
33208
33960
|
}, []);
|
|
33209
|
-
|
|
33961
|
+
useInput14((input, key) => {
|
|
33210
33962
|
if (loading) return;
|
|
33211
33963
|
if (key.return || input === " ") {
|
|
33212
33964
|
setEnabled((current) => {
|
|
@@ -33221,21 +33973,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33221
33973
|
onDone();
|
|
33222
33974
|
}
|
|
33223
33975
|
});
|
|
33224
|
-
return /* @__PURE__ */
|
|
33225
|
-
/* @__PURE__ */
|
|
33226
|
-
/* @__PURE__ */
|
|
33227
|
-
loading ? /* @__PURE__ */
|
|
33228
|
-
/* @__PURE__ */
|
|
33976
|
+
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33977
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33978
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33979
|
+
loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment19, { children: [
|
|
33980
|
+
/* @__PURE__ */ jsxs50(Text52, { children: [
|
|
33229
33981
|
"Share anonymous usage data:",
|
|
33230
33982
|
" ",
|
|
33231
|
-
/* @__PURE__ */
|
|
33983
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33232
33984
|
] }),
|
|
33233
|
-
/* @__PURE__ */
|
|
33234
|
-
/* @__PURE__ */
|
|
33235
|
-
/* @__PURE__ */
|
|
33985
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33986
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
33987
|
+
/* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
33236
33988
|
] }),
|
|
33237
|
-
/* @__PURE__ */
|
|
33238
|
-
/* @__PURE__ */
|
|
33989
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33990
|
+
/* @__PURE__ */ jsx61(
|
|
33239
33991
|
ControlHints,
|
|
33240
33992
|
{
|
|
33241
33993
|
hints: [
|
|
@@ -33256,14 +34008,95 @@ var init_screen11 = __esm({
|
|
|
33256
34008
|
}
|
|
33257
34009
|
});
|
|
33258
34010
|
|
|
34011
|
+
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
34012
|
+
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
34013
|
+
import { Box as Box50, Text as Text53, useInput as useInput15 } from "ink";
|
|
34014
|
+
import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
34015
|
+
function UpgradeScreen({ onDone }) {
|
|
34016
|
+
const [upgradeCheck, setUpgradeCheck] = useState35();
|
|
34017
|
+
useEffect26(() => {
|
|
34018
|
+
startDebugRun({
|
|
34019
|
+
flow: "upgrade",
|
|
34020
|
+
step: "01-upgrade",
|
|
34021
|
+
menuOption: "Upgrade",
|
|
34022
|
+
inputs: { currentVersion: readPackageVersion() }
|
|
34023
|
+
});
|
|
34024
|
+
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
34025
|
+
}, []);
|
|
34026
|
+
useInput15((_input, key) => {
|
|
34027
|
+
if (key.return) {
|
|
34028
|
+
void finishDebugRun({
|
|
34029
|
+
outputs: upgradeCheck ?? {},
|
|
34030
|
+
status: upgradeCheck?.status === "error" ? "error" : "success",
|
|
34031
|
+
exitMethod: "saved"
|
|
34032
|
+
});
|
|
34033
|
+
onDone();
|
|
34034
|
+
return;
|
|
34035
|
+
}
|
|
34036
|
+
});
|
|
34037
|
+
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
34038
|
+
/* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
|
|
34039
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34040
|
+
renderBody(upgradeCheck),
|
|
34041
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34042
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
|
|
34043
|
+
FOCUS_MARKER,
|
|
34044
|
+
" Go Back"
|
|
34045
|
+
] })
|
|
34046
|
+
] });
|
|
34047
|
+
}
|
|
34048
|
+
function renderBody(upgradeCheck) {
|
|
34049
|
+
if (!upgradeCheck) {
|
|
34050
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
34051
|
+
}
|
|
34052
|
+
if (upgradeCheck.status === "error") {
|
|
34053
|
+
return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
34054
|
+
}
|
|
34055
|
+
if (upgradeCheck.status === "up-to-date") {
|
|
34056
|
+
return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
|
|
34057
|
+
"You're already on the latest version (v",
|
|
34058
|
+
upgradeCheck.current,
|
|
34059
|
+
")."
|
|
34060
|
+
] });
|
|
34061
|
+
}
|
|
34062
|
+
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
|
|
34063
|
+
/* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
|
|
34064
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
|
|
34065
|
+
"v",
|
|
34066
|
+
upgradeCheck.latest
|
|
34067
|
+
] }),
|
|
34068
|
+
" ",
|
|
34069
|
+
"is available (you're on ",
|
|
34070
|
+
/* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
|
|
34071
|
+
"v",
|
|
34072
|
+
upgradeCheck.current
|
|
34073
|
+
] }),
|
|
34074
|
+
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
34075
|
+
] }),
|
|
34076
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34077
|
+
/* @__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)) })
|
|
34078
|
+
] });
|
|
34079
|
+
}
|
|
34080
|
+
var UPGRADE_COMMANDS;
|
|
34081
|
+
var init_PageContainer4 = __esm({
|
|
34082
|
+
"packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx"() {
|
|
34083
|
+
"use strict";
|
|
34084
|
+
init_theme();
|
|
34085
|
+
init_home_theme();
|
|
34086
|
+
init_version();
|
|
34087
|
+
init_debug_store();
|
|
34088
|
+
UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
|
|
34089
|
+
}
|
|
34090
|
+
});
|
|
34091
|
+
|
|
33259
34092
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
33260
|
-
import { useEffect as
|
|
33261
|
-
import { Box as
|
|
33262
|
-
import { jsx as
|
|
34093
|
+
import { useEffect as useEffect27, useState as useState36 } from "react";
|
|
34094
|
+
import { Box as Box51, Text as Text54, useInput as useInput16 } from "ink";
|
|
34095
|
+
import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
33263
34096
|
function DebugModeScreen({ onDone }) {
|
|
33264
|
-
const [loading, setLoading] =
|
|
33265
|
-
const [enabled, setEnabled] =
|
|
33266
|
-
|
|
34097
|
+
const [loading, setLoading] = useState36(true);
|
|
34098
|
+
const [enabled, setEnabled] = useState36(true);
|
|
34099
|
+
useEffect27(() => {
|
|
33267
34100
|
readDebugModeSetting().then((setting) => {
|
|
33268
34101
|
setEnabled(setting.enabled);
|
|
33269
34102
|
setLoading(false);
|
|
@@ -33275,7 +34108,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
33275
34108
|
});
|
|
33276
34109
|
});
|
|
33277
34110
|
}, []);
|
|
33278
|
-
|
|
34111
|
+
useInput16((input, key) => {
|
|
33279
34112
|
if (loading) return;
|
|
33280
34113
|
if (key.return || input === " ") {
|
|
33281
34114
|
setEnabled((current) => {
|
|
@@ -33290,16 +34123,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
33290
34123
|
onDone();
|
|
33291
34124
|
}
|
|
33292
34125
|
});
|
|
33293
|
-
return /* @__PURE__ */
|
|
33294
|
-
/* @__PURE__ */
|
|
33295
|
-
/* @__PURE__ */
|
|
33296
|
-
loading ? /* @__PURE__ */
|
|
34126
|
+
return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
34127
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
34128
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
34129
|
+
loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
|
|
33297
34130
|
"Debug logging:",
|
|
33298
34131
|
" ",
|
|
33299
|
-
/* @__PURE__ */
|
|
34132
|
+
/* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33300
34133
|
] }),
|
|
33301
|
-
/* @__PURE__ */
|
|
33302
|
-
/* @__PURE__ */
|
|
34134
|
+
/* @__PURE__ */ jsx63(Text54, { children: " " }),
|
|
34135
|
+
/* @__PURE__ */ jsx63(
|
|
33303
34136
|
ControlHints,
|
|
33304
34137
|
{
|
|
33305
34138
|
hints: [
|
|
@@ -33325,20 +34158,20 @@ var app_exports = {};
|
|
|
33325
34158
|
__export(app_exports, {
|
|
33326
34159
|
runApp: () => runApp
|
|
33327
34160
|
});
|
|
33328
|
-
import { join as
|
|
33329
|
-
import { useEffect as
|
|
33330
|
-
import { Fragment as
|
|
34161
|
+
import { join as join27 } from "node:path";
|
|
34162
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
34163
|
+
import { Fragment as Fragment20, jsx as jsx64 } from "react/jsx-runtime";
|
|
33331
34164
|
function App({ importOptions, inkClear }) {
|
|
33332
|
-
const [screen, setScreen] =
|
|
33333
|
-
const [importExitCode, setImportExitCode] =
|
|
34165
|
+
const [screen, setScreen] = useState37("start");
|
|
34166
|
+
const [importExitCode, setImportExitCode] = useState37();
|
|
33334
34167
|
const showImportResult = importExitCode !== void 0;
|
|
33335
|
-
const [projectPath, setProjectPath] =
|
|
33336
|
-
const [tokensPath, setTokensPath] =
|
|
33337
|
-
const [scannedFiles, setScannedFiles] =
|
|
33338
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
33339
|
-
const [extractionRun, setExtractionRun] =
|
|
34168
|
+
const [projectPath, setProjectPath] = useState37();
|
|
34169
|
+
const [tokensPath, setTokensPath] = useState37();
|
|
34170
|
+
const [scannedFiles, setScannedFiles] = useState37();
|
|
34171
|
+
const [pendingLaunch, setPendingLaunch] = useState37();
|
|
34172
|
+
const [extractionRun, setExtractionRun] = useState37();
|
|
33340
34173
|
const extraction = useExtraction(extractionRun?.input);
|
|
33341
|
-
const [scopeRun, setScopeRun] =
|
|
34174
|
+
const [scopeRun, setScopeRun] = useState37();
|
|
33342
34175
|
const scopeFlow = useScopeGateFlow(
|
|
33343
34176
|
scopeRun && {
|
|
33344
34177
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -33353,12 +34186,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33353
34186
|
}
|
|
33354
34187
|
}
|
|
33355
34188
|
);
|
|
33356
|
-
const [generationInput, setGenerationInput] =
|
|
34189
|
+
const [generationInput, setGenerationInput] = useState37();
|
|
33357
34190
|
const generation = useGeneration(generationInput);
|
|
33358
|
-
const [flowStart, setFlowStart] =
|
|
34191
|
+
const [flowStart, setFlowStart] = useState37();
|
|
33359
34192
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
33360
|
-
const [importDefaults, setImportDefaults] =
|
|
33361
|
-
|
|
34193
|
+
const [importDefaults, setImportDefaults] = useState37();
|
|
34194
|
+
useEffect28(() => {
|
|
33362
34195
|
if (screen !== "import") {
|
|
33363
34196
|
setImportDefaults(void 0);
|
|
33364
34197
|
return;
|
|
@@ -33376,7 +34209,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33376
34209
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
33377
34210
|
const state2 = await inspectTokens({
|
|
33378
34211
|
rawTokensPath: tokens,
|
|
33379
|
-
contentfulDir:
|
|
34212
|
+
contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
|
|
33380
34213
|
cache: importOptions.cache
|
|
33381
34214
|
});
|
|
33382
34215
|
if (state2.kind === "cached") {
|
|
@@ -33418,12 +34251,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33418
34251
|
}
|
|
33419
34252
|
});
|
|
33420
34253
|
};
|
|
33421
|
-
|
|
34254
|
+
useEffect28(() => {
|
|
33422
34255
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
33423
34256
|
setExtractionRun(void 0);
|
|
33424
34257
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
33425
34258
|
}, [extraction, extractionRun]);
|
|
33426
|
-
|
|
34259
|
+
useEffect28(() => {
|
|
33427
34260
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
33428
34261
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33429
34262
|
setGenerationInput({
|
|
@@ -33441,7 +34274,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33441
34274
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
33442
34275
|
});
|
|
33443
34276
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
33444
|
-
|
|
34277
|
+
useEffect28(() => {
|
|
33445
34278
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
33446
34279
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33447
34280
|
inkClear();
|
|
@@ -33484,9 +34317,9 @@ function App({ importOptions, inkClear }) {
|
|
|
33484
34317
|
};
|
|
33485
34318
|
switch (screen) {
|
|
33486
34319
|
case "import":
|
|
33487
|
-
if (showImportResult) return /* @__PURE__ */
|
|
34320
|
+
if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
33488
34321
|
if (flow && flowStart) {
|
|
33489
|
-
return /* @__PURE__ */
|
|
34322
|
+
return /* @__PURE__ */ jsx64(
|
|
33490
34323
|
FlowScreen,
|
|
33491
34324
|
{
|
|
33492
34325
|
state: flow.state,
|
|
@@ -33496,12 +34329,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33496
34329
|
}
|
|
33497
34330
|
);
|
|
33498
34331
|
}
|
|
33499
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
34332
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment20, {});
|
|
33500
34333
|
if (projectPath === void 0) {
|
|
33501
|
-
return /* @__PURE__ */
|
|
34334
|
+
return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
33502
34335
|
}
|
|
33503
34336
|
if (tokensPath === void 0) {
|
|
33504
|
-
return /* @__PURE__ */
|
|
34337
|
+
return /* @__PURE__ */ jsx64(
|
|
33505
34338
|
TokenInputScreen,
|
|
33506
34339
|
{
|
|
33507
34340
|
initialPath: importDefaults.tokenFile,
|
|
@@ -33511,7 +34344,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33511
34344
|
);
|
|
33512
34345
|
}
|
|
33513
34346
|
if (scannedFiles === void 0) {
|
|
33514
|
-
return /* @__PURE__ */
|
|
34347
|
+
return /* @__PURE__ */ jsx64(
|
|
33515
34348
|
PathValidationScreen,
|
|
33516
34349
|
{
|
|
33517
34350
|
projectPath,
|
|
@@ -33523,10 +34356,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33523
34356
|
}
|
|
33524
34357
|
if (extractionRun) {
|
|
33525
34358
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
33526
|
-
return /* @__PURE__ */
|
|
34359
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
33527
34360
|
}
|
|
33528
34361
|
if (extraction?.status === "running") {
|
|
33529
|
-
return /* @__PURE__ */
|
|
34362
|
+
return /* @__PURE__ */ jsx64(
|
|
33530
34363
|
ExtractionScreen,
|
|
33531
34364
|
{
|
|
33532
34365
|
progress: extraction.progress,
|
|
@@ -33535,14 +34368,14 @@ function App({ importOptions, inkClear }) {
|
|
|
33535
34368
|
}
|
|
33536
34369
|
);
|
|
33537
34370
|
}
|
|
33538
|
-
return /* @__PURE__ */
|
|
34371
|
+
return /* @__PURE__ */ jsx64(Fragment20, {});
|
|
33539
34372
|
}
|
|
33540
34373
|
if (scopeRun && scopeFlow) {
|
|
33541
34374
|
if (scopeFlow.status === "failed") {
|
|
33542
|
-
return /* @__PURE__ */
|
|
34375
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
33543
34376
|
}
|
|
33544
34377
|
if (scopeFlow.status === "deciding") {
|
|
33545
|
-
return /* @__PURE__ */
|
|
34378
|
+
return /* @__PURE__ */ jsx64(
|
|
33546
34379
|
ScopeGateScreen,
|
|
33547
34380
|
{
|
|
33548
34381
|
components: scopeFlow.load.components,
|
|
@@ -33552,7 +34385,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33552
34385
|
);
|
|
33553
34386
|
}
|
|
33554
34387
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
33555
|
-
return /* @__PURE__ */
|
|
34388
|
+
return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
33556
34389
|
}
|
|
33557
34390
|
if (generation?.status === "running") {
|
|
33558
34391
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -33560,7 +34393,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33560
34393
|
hasRawTokens,
|
|
33561
34394
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
33562
34395
|
});
|
|
33563
|
-
return /* @__PURE__ */
|
|
34396
|
+
return /* @__PURE__ */ jsx64(
|
|
33564
34397
|
GenerationScreen,
|
|
33565
34398
|
{
|
|
33566
34399
|
progress: generation.progress,
|
|
@@ -33572,10 +34405,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33572
34405
|
}
|
|
33573
34406
|
);
|
|
33574
34407
|
}
|
|
33575
|
-
return /* @__PURE__ */
|
|
34408
|
+
return /* @__PURE__ */ jsx64(Fragment20, {});
|
|
33576
34409
|
}
|
|
33577
34410
|
if (pendingLaunch?.cached) {
|
|
33578
|
-
return /* @__PURE__ */
|
|
34411
|
+
return /* @__PURE__ */ jsx64(
|
|
33579
34412
|
TokenReuseScreen,
|
|
33580
34413
|
{
|
|
33581
34414
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -33586,7 +34419,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33586
34419
|
}
|
|
33587
34420
|
);
|
|
33588
34421
|
}
|
|
33589
|
-
return /* @__PURE__ */
|
|
34422
|
+
return /* @__PURE__ */ jsx64(
|
|
33590
34423
|
CredentialsScreen,
|
|
33591
34424
|
{
|
|
33592
34425
|
initial: importDefaults.credentials,
|
|
@@ -33595,17 +34428,19 @@ function App({ importOptions, inkClear }) {
|
|
|
33595
34428
|
}
|
|
33596
34429
|
);
|
|
33597
34430
|
case "help":
|
|
33598
|
-
return /* @__PURE__ */
|
|
34431
|
+
return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
|
|
34432
|
+
case "upgrade":
|
|
34433
|
+
return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
|
|
33599
34434
|
case "settings":
|
|
33600
|
-
return /* @__PURE__ */
|
|
34435
|
+
return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
33601
34436
|
case "settings-configuration":
|
|
33602
|
-
return /* @__PURE__ */
|
|
34437
|
+
return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
|
|
33603
34438
|
case "settings-opt-in-analytics":
|
|
33604
|
-
return /* @__PURE__ */
|
|
34439
|
+
return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
33605
34440
|
case "settings-debug-mode":
|
|
33606
|
-
return /* @__PURE__ */
|
|
34441
|
+
return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
|
|
33607
34442
|
case "start":
|
|
33608
|
-
return /* @__PURE__ */
|
|
34443
|
+
return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
|
|
33609
34444
|
}
|
|
33610
34445
|
}
|
|
33611
34446
|
async function runApp(renderApp, importOptions) {
|
|
@@ -33613,7 +34448,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
33613
34448
|
instance.clear?.();
|
|
33614
34449
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
33615
34450
|
};
|
|
33616
|
-
const instance = renderApp(/* @__PURE__ */
|
|
34451
|
+
const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
|
|
33617
34452
|
await instance.waitUntilExit();
|
|
33618
34453
|
}
|
|
33619
34454
|
var init_app = __esm({
|
|
@@ -33637,17 +34472,18 @@ var init_app = __esm({
|
|
|
33637
34472
|
init_use_flow();
|
|
33638
34473
|
init_PageContainer2();
|
|
33639
34474
|
init_PageContainer3();
|
|
33640
|
-
|
|
34475
|
+
init_ConfigurationScreen();
|
|
33641
34476
|
init_screen11();
|
|
34477
|
+
init_PageContainer4();
|
|
33642
34478
|
init_screen12();
|
|
33643
|
-
|
|
34479
|
+
init_project_store();
|
|
33644
34480
|
}
|
|
33645
34481
|
});
|
|
33646
34482
|
|
|
33647
34483
|
// packages/experience-design-system-cli/program.ts
|
|
33648
34484
|
init_src4();
|
|
33649
34485
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
33650
|
-
import { join as
|
|
34486
|
+
import { join as join28 } from "node:path";
|
|
33651
34487
|
import { Command } from "commander";
|
|
33652
34488
|
|
|
33653
34489
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
@@ -33675,14 +34511,14 @@ function runDevWatch(args) {
|
|
|
33675
34511
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33676
34512
|
return Promise.resolve(1);
|
|
33677
34513
|
}
|
|
33678
|
-
return new Promise((
|
|
34514
|
+
return new Promise((resolve28) => {
|
|
33679
34515
|
const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33680
34516
|
process.on("SIGINT", () => void 0);
|
|
33681
|
-
child.on("exit", (code) =>
|
|
34517
|
+
child.on("exit", (code) => resolve28(code ?? 0));
|
|
33682
34518
|
child.on("error", (err) => {
|
|
33683
34519
|
process.stderr.write(`${err.message}
|
|
33684
34520
|
`);
|
|
33685
|
-
|
|
34521
|
+
resolve28(1);
|
|
33686
34522
|
});
|
|
33687
34523
|
});
|
|
33688
34524
|
}
|
|
@@ -33707,11 +34543,13 @@ function registerImportCommand(program, openTui) {
|
|
|
33707
34543
|
}
|
|
33708
34544
|
|
|
33709
34545
|
// packages/experience-design-system-cli/program.ts
|
|
34546
|
+
init_agent_store();
|
|
34547
|
+
init_apply_binary_overrides();
|
|
33710
34548
|
init_analytics_store();
|
|
33711
34549
|
init_package_root();
|
|
33712
34550
|
var pkg = JSON.parse(
|
|
33713
34551
|
readFileSync9(
|
|
33714
|
-
|
|
34552
|
+
join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
33715
34553
|
"utf8"
|
|
33716
34554
|
)
|
|
33717
34555
|
);
|
|
@@ -33728,6 +34566,7 @@ function createProgram() {
|
|
|
33728
34566
|
const commandChain = chain.join(" ") || actionCommand.name();
|
|
33729
34567
|
const { enabled } = await readAnalyticsSetting();
|
|
33730
34568
|
setPersistedAnalyticsDisabled(!enabled);
|
|
34569
|
+
await readAgentConfig().then(applyBinaryOverrides, () => void 0);
|
|
33731
34570
|
setCliVersion(pkg.version);
|
|
33732
34571
|
noteCommandStart(commandChain);
|
|
33733
34572
|
});
|
|
@@ -33751,7 +34590,7 @@ init_config();
|
|
|
33751
34590
|
init_package_root();
|
|
33752
34591
|
import { existsSync as existsSync11 } from "node:fs";
|
|
33753
34592
|
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
33754
|
-
import { dirname as dirname16, join as
|
|
34593
|
+
import { dirname as dirname16, join as join29 } from "node:path";
|
|
33755
34594
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
33756
34595
|
async function readJson(path5) {
|
|
33757
34596
|
try {
|
|
@@ -33762,9 +34601,9 @@ async function readJson(path5) {
|
|
|
33762
34601
|
}
|
|
33763
34602
|
async function migrateOldConfig() {
|
|
33764
34603
|
try {
|
|
33765
|
-
const oldCredentials =
|
|
33766
|
-
const oldRuns =
|
|
33767
|
-
const oldDebugMode =
|
|
34604
|
+
const oldCredentials = join29(oldConfigDir2(), "credentials.json");
|
|
34605
|
+
const oldRuns = join29(oldConfigDir2(), "runs.json");
|
|
34606
|
+
const oldDebugMode = join29(
|
|
33768
34607
|
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
33769
34608
|
".contentful",
|
|
33770
34609
|
"config",
|