@contentful/experience-design-system-cli 2.37.1-dev-build-a2aef8c6.0 → 2.37.1-dev-build-a67bc4a4.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 +255 -1014
- package/dist/index.js +275 -1117
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/{configuration/ConfigurationScreen.d.ts → contentful-configuration/ContentfulConfigScreen.d.ts} +0 -1
- package/package.json +3 -3
- package/dist/src/tui/help/file-locations.d.ts +0 -23
- package/dist/src/tui/settings/configuration/agents/AgentDetail.d.ts +0 -13
- package/dist/src/tui/settings/configuration/agents/AgentStatusBadge.d.ts +0 -10
- package/dist/src/tui/settings/configuration/agents/AgentsScreen.d.ts +0 -11
- package/dist/src/tui/settings/configuration/agents/agent-status.d.ts +0 -63
- package/dist/src/tui/settings/configuration/agents/agent-store.d.ts +0 -16
- package/dist/src/tui/settings/configuration/agents/apply-binary-overrides.d.ts +0 -13
- package/dist/src/tui/settings/configuration/project/ProjectScreen.d.ts +0 -5
- package/dist/src/tui/settings/shared/FieldForm.d.ts +0 -50
- package/dist/src/tui/upgrade/PageContainer.d.ts +0 -4
- /package/dist/src/tui/{upgrade → home}/version.d.ts +0 -0
- /package/dist/src/tui/settings/{configuration/project/project-store.d.ts → contentful-configuration/config-store.d.ts} +0 -0
- /package/dist/src/tui/settings/{shared → utils}/v1-store.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((resolve27) => {
|
|
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
|
+
resolve27(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((resolve27) => {
|
|
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
|
+
resolve27("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
|
+
resolve27("unauthenticated");
|
|
1595
1595
|
return;
|
|
1596
1596
|
}
|
|
1597
1597
|
try {
|
|
1598
1598
|
const status = JSON.parse(stdout);
|
|
1599
|
-
|
|
1599
|
+
resolve27(status.loggedIn ? "ok" : "unauthenticated");
|
|
1600
1600
|
} catch {
|
|
1601
|
-
|
|
1601
|
+
resolve27("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((resolve27) => {
|
|
1612
1612
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1613
|
-
child.on("close", (code) =>
|
|
1613
|
+
child.on("close", (code) => resolve27(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 access6 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
|
|
7920
|
+
if (access6.getExpression().getText() !== slotsName)
|
|
7921
7921
|
continue;
|
|
7922
|
-
const slotName =
|
|
7922
|
+
const slotName = access6.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((resolve27) => setTimeout(resolve27, 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((resolve27) => setTimeout(resolve27, 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(fields) {
|
|
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, fields);
|
|
16154
|
+
mergeContext(state.pending.context, fields);
|
|
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(fields = {}) {
|
|
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 = fields.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
|
+
...fields,
|
|
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((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
|
|
18531
18531
|
}
|
|
18532
18532
|
}
|
|
18533
18533
|
}
|
|
@@ -19446,7 +19446,6 @@ var init_src4 = __esm({
|
|
|
19446
19446
|
init_agents();
|
|
19447
19447
|
init_agent_name();
|
|
19448
19448
|
init_models();
|
|
19449
|
-
init_binaries();
|
|
19450
19449
|
init_is_agent_name();
|
|
19451
19450
|
init_agent_supports_bedrock();
|
|
19452
19451
|
init_check_agent_auth();
|
|
@@ -19555,10 +19554,10 @@ var init_config = __esm({
|
|
|
19555
19554
|
}
|
|
19556
19555
|
});
|
|
19557
19556
|
|
|
19558
|
-
// packages/experience-design-system-cli/src/tui/settings/
|
|
19557
|
+
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
19559
19558
|
var readV1Store, writeV1Store;
|
|
19560
19559
|
var init_v1_store = __esm({
|
|
19561
|
-
"packages/experience-design-system-cli/src/tui/settings/
|
|
19560
|
+
"packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
|
|
19562
19561
|
"use strict";
|
|
19563
19562
|
init_config();
|
|
19564
19563
|
readV1Store = readSettings2;
|
|
@@ -19566,90 +19565,6 @@ var init_v1_store = __esm({
|
|
|
19566
19565
|
}
|
|
19567
19566
|
});
|
|
19568
19567
|
|
|
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
|
-
|
|
19653
19568
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
19654
19569
|
async function readAnalyticsSetting() {
|
|
19655
19570
|
const store = await readV1Store();
|
|
@@ -19737,7 +19652,7 @@ var init_home_theme = __esm({
|
|
|
19737
19652
|
}
|
|
19738
19653
|
});
|
|
19739
19654
|
|
|
19740
|
-
// packages/experience-design-system-cli/src/tui/
|
|
19655
|
+
// packages/experience-design-system-cli/src/tui/home/version.ts
|
|
19741
19656
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
19742
19657
|
import { join as join17 } from "node:path";
|
|
19743
19658
|
import semver from "semver";
|
|
@@ -19770,7 +19685,7 @@ async function checkForUpgrade() {
|
|
|
19770
19685
|
}
|
|
19771
19686
|
var PACKAGE_NAME2, TAGS_URL;
|
|
19772
19687
|
var init_version = __esm({
|
|
19773
|
-
"packages/experience-design-system-cli/src/tui/
|
|
19688
|
+
"packages/experience-design-system-cli/src/tui/home/version.ts"() {
|
|
19774
19689
|
"use strict";
|
|
19775
19690
|
init_package_root();
|
|
19776
19691
|
PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
@@ -19824,14 +19739,11 @@ var init_control_hints = __esm({
|
|
|
19824
19739
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
19825
19740
|
import { Box, Text as Text2, useApp, useInput } from "ink";
|
|
19826
19741
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19827
|
-
function
|
|
19742
|
+
function versionStatus(upgradeCheck) {
|
|
19828
19743
|
if (upgradeCheck?.status === "update-available") {
|
|
19829
|
-
return {
|
|
19744
|
+
return { text: ` (upgrade available v${upgradeCheck.latest})`, color: PALETTE.success };
|
|
19830
19745
|
}
|
|
19831
|
-
|
|
19832
|
-
return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
|
|
19833
|
-
}
|
|
19834
|
-
return { label: "Upgrade Version" };
|
|
19746
|
+
return void 0;
|
|
19835
19747
|
}
|
|
19836
19748
|
function HomeScreen({ onNavigate }) {
|
|
19837
19749
|
const [focusIdx, setFocusIdx] = useState2(0);
|
|
@@ -19839,7 +19751,7 @@ function HomeScreen({ onNavigate }) {
|
|
|
19839
19751
|
const { exit } = useApp();
|
|
19840
19752
|
const terminalWidth = useTerminalWidth();
|
|
19841
19753
|
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
19842
|
-
const
|
|
19754
|
+
const status = versionStatus(upgradeCheck);
|
|
19843
19755
|
useEffect2(() => {
|
|
19844
19756
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
19845
19757
|
}, []);
|
|
@@ -19859,7 +19771,6 @@ function HomeScreen({ onNavigate }) {
|
|
|
19859
19771
|
}
|
|
19860
19772
|
if (key.return) {
|
|
19861
19773
|
const item = START_ITEMS[focusIdx];
|
|
19862
|
-
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
19863
19774
|
onNavigate(item.screen);
|
|
19864
19775
|
return;
|
|
19865
19776
|
}
|
|
@@ -19877,26 +19788,16 @@ function HomeScreen({ onNavigate }) {
|
|
|
19877
19788
|
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
19878
19789
|
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
19879
19790
|
"v",
|
|
19880
|
-
VERSION
|
|
19791
|
+
VERSION,
|
|
19792
|
+
status && /* @__PURE__ */ jsx2(Text2, { color: status.color, children: status.text })
|
|
19881
19793
|
] })
|
|
19882
19794
|
] }),
|
|
19883
19795
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
19884
19796
|
const focused = i === focusIdx;
|
|
19885
|
-
|
|
19886
|
-
|
|
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
|
-
},
|
|
19797
|
+
return /* @__PURE__ */ jsxs(Text2, { bold: focused, color: focused ? PALETTE.accent : void 0, children: [
|
|
19798
|
+
focused ? `${FOCUS_MARKER} ` : " ",
|
|
19898
19799
|
item.label
|
|
19899
|
-
);
|
|
19800
|
+
] }, item.label);
|
|
19900
19801
|
}) }) }),
|
|
19901
19802
|
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
19902
19803
|
ControlHints,
|
|
@@ -19925,7 +19826,6 @@ var init_home = __esm({
|
|
|
19925
19826
|
MIN_TERMINAL_WIDTH = 164;
|
|
19926
19827
|
START_ITEMS = [
|
|
19927
19828
|
{ label: "Import", screen: "import" },
|
|
19928
|
-
{ label: "Upgrade Version", screen: "upgrade" },
|
|
19929
19829
|
{ label: "Settings", screen: "settings" },
|
|
19930
19830
|
{ label: "Help", screen: "help" }
|
|
19931
19831
|
];
|
|
@@ -26216,16 +26116,16 @@ function SlotRow({
|
|
|
26216
26116
|
] });
|
|
26217
26117
|
}
|
|
26218
26118
|
function propFields(prop) {
|
|
26219
|
-
const
|
|
26119
|
+
const fields = ["description", "required", "type"];
|
|
26220
26120
|
if (prop.type === "token") {
|
|
26221
|
-
|
|
26121
|
+
fields.push("tokenKind");
|
|
26222
26122
|
}
|
|
26223
|
-
if (prop.type === "enum")
|
|
26123
|
+
if (prop.type === "enum") fields.push("values");
|
|
26224
26124
|
if (prop.type !== "richtext" && prop.type !== "media" && prop.type !== "link") {
|
|
26225
|
-
|
|
26125
|
+
fields.push("default");
|
|
26226
26126
|
}
|
|
26227
|
-
if (prop.type === "token" && prop.category === "design")
|
|
26228
|
-
return
|
|
26127
|
+
if (prop.type === "token" && prop.category === "design") fields.push("allowed");
|
|
26128
|
+
return fields;
|
|
26229
26129
|
}
|
|
26230
26130
|
function simulateGraphWithCandidate(projectSlotGraph, selfName, currentSlots, targetSlotName, candidate) {
|
|
26231
26131
|
const selfEntry = {
|
|
@@ -26763,8 +26663,8 @@ function FieldEditor({
|
|
|
26763
26663
|
return;
|
|
26764
26664
|
}
|
|
26765
26665
|
if (focusLevel === "field") {
|
|
26766
|
-
const
|
|
26767
|
-
const currentFieldIdx =
|
|
26666
|
+
const fields = inSlots ? SLOT_FIELDS : currentProp ? propFields(currentProp) : [];
|
|
26667
|
+
const currentFieldIdx = fields.indexOf(activeField);
|
|
26768
26668
|
const isValuesNav = activeField === "values" || activeField === "allowedComponents";
|
|
26769
26669
|
const arrowUp = key.upArrow;
|
|
26770
26670
|
const arrowDown = key.downArrow;
|
|
@@ -26778,10 +26678,10 @@ function FieldEditor({
|
|
|
26778
26678
|
const navPrevious = arrowUp || arrowLeft;
|
|
26779
26679
|
const navNext = arrowDown || arrowRight || input === "j";
|
|
26780
26680
|
const navBack = navPrevious || input === "k";
|
|
26781
|
-
if ((navBack || navNext) &&
|
|
26782
|
-
const lastIdx =
|
|
26681
|
+
if ((navBack || navNext) && fields.length > 0) {
|
|
26682
|
+
const lastIdx = fields.length - 1;
|
|
26783
26683
|
const targetIdx = navNext ? currentFieldIdx >= lastIdx ? 0 : currentFieldIdx + 1 : currentFieldIdx <= 0 ? lastIdx : currentFieldIdx - 1;
|
|
26784
|
-
const next =
|
|
26684
|
+
const next = fields[targetIdx];
|
|
26785
26685
|
setActiveField(next);
|
|
26786
26686
|
if (next === "description") {
|
|
26787
26687
|
const desc = inSlots ? currentSlot?.description ?? "" : currentProp?.description ?? "";
|
|
@@ -32358,7 +32258,7 @@ var init_save = __esm({
|
|
|
32358
32258
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32359
32259
|
appendRun,
|
|
32360
32260
|
buildSourceFingerprint,
|
|
32361
|
-
sleep: (ms) => new Promise((
|
|
32261
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
32362
32262
|
warn: (message) => process.stderr.write(message)
|
|
32363
32263
|
});
|
|
32364
32264
|
}
|
|
@@ -32909,48 +32809,13 @@ var init_debug_store = __esm({
|
|
|
32909
32809
|
}
|
|
32910
32810
|
});
|
|
32911
32811
|
|
|
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
|
-
|
|
32938
32812
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32939
32813
|
async function readHelpInfo() {
|
|
32940
|
-
const
|
|
32941
|
-
const base = settings["contentfulBaseDir"];
|
|
32942
|
-
const locations = describeFileLocations({
|
|
32943
|
-
contentfulBaseDir: typeof base === "string" ? base : "",
|
|
32944
|
-
debugModeEnabled: debugMode.enabled,
|
|
32945
|
-
currentSessionDir: currentSessionDir()
|
|
32946
|
-
});
|
|
32814
|
+
const debugMode = await readDebugModeSetting();
|
|
32947
32815
|
return {
|
|
32948
32816
|
storage: [
|
|
32949
32817
|
{ label: "Config folder", value: configRoot2() },
|
|
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 }
|
|
32818
|
+
{ label: "Settings file", value: configFilePath2() }
|
|
32954
32819
|
],
|
|
32955
32820
|
troubleshooting: [
|
|
32956
32821
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32971,7 +32836,6 @@ var init_help_info = __esm({
|
|
|
32971
32836
|
init_debug_store();
|
|
32972
32837
|
init_debug_mode_store();
|
|
32973
32838
|
init_version();
|
|
32974
|
-
init_file_locations();
|
|
32975
32839
|
}
|
|
32976
32840
|
});
|
|
32977
32841
|
|
|
@@ -32983,7 +32847,7 @@ function Section({ title, rows }) {
|
|
|
32983
32847
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
32984
32848
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
32985
32849
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
32986
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
32850
|
+
/* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
32987
32851
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
32988
32852
|
] }, row.label))
|
|
32989
32853
|
] });
|
|
@@ -33098,657 +32962,7 @@ var init_PageContainer3 = __esm({
|
|
|
33098
32962
|
}
|
|
33099
32963
|
});
|
|
33100
32964
|
|
|
33101
|
-
// packages/experience-design-system-cli/src/tui/settings/configuration/
|
|
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
|
|
32965
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
33752
32966
|
async function readCredentials() {
|
|
33753
32967
|
const store = await readV1Store();
|
|
33754
32968
|
return {
|
|
@@ -33772,17 +32986,18 @@ async function writeCredentials(config) {
|
|
|
33772
32986
|
});
|
|
33773
32987
|
await writeV1Store(merged);
|
|
33774
32988
|
}
|
|
33775
|
-
var
|
|
33776
|
-
"packages/experience-design-system-cli/src/tui/settings/configuration/
|
|
32989
|
+
var init_config_store = __esm({
|
|
32990
|
+
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts"() {
|
|
33777
32991
|
"use strict";
|
|
33778
32992
|
init_v1_store();
|
|
33779
32993
|
}
|
|
33780
32994
|
});
|
|
33781
32995
|
|
|
33782
|
-
// packages/experience-design-system-cli/src/tui/settings/configuration/
|
|
33783
|
-
import { useEffect as
|
|
33784
|
-
import { Box as
|
|
33785
|
-
import
|
|
32996
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
32997
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
32998
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
32999
|
+
import TextInput4 from "ink-text-input";
|
|
33000
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33786
33001
|
function debugFields(config) {
|
|
33787
33002
|
return {
|
|
33788
33003
|
space_id: config?.spaceId ?? "",
|
|
@@ -33794,159 +33009,189 @@ function debugFields(config) {
|
|
|
33794
33009
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
33795
33010
|
};
|
|
33796
33011
|
}
|
|
33797
|
-
function
|
|
33798
|
-
const [
|
|
33799
|
-
const [
|
|
33800
|
-
const [
|
|
33801
|
-
const [
|
|
33802
|
-
|
|
33803
|
-
|
|
33012
|
+
function ConfigurationScreen({ onDone }) {
|
|
33013
|
+
const [stage, setStage] = useState29("loading");
|
|
33014
|
+
const [config, setConfig] = useState29(null);
|
|
33015
|
+
const [activeField, setActiveField] = useState29("spaceId");
|
|
33016
|
+
const [notice, setNotice] = useState29(null);
|
|
33017
|
+
const [lastSaved, setLastSaved] = useState29(null);
|
|
33018
|
+
const [editing, setEditing] = useState29(false);
|
|
33019
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33020
|
+
useEffect22(() => {
|
|
33021
|
+
readCredentials().then((cfg) => {
|
|
33804
33022
|
setConfig(cfg);
|
|
33023
|
+
setStage("form");
|
|
33805
33024
|
startDebugRun({
|
|
33806
33025
|
flow: "settings/contentful-configuration",
|
|
33807
33026
|
step: "01-configuration",
|
|
33808
|
-
menuOption: "Configuration
|
|
33027
|
+
menuOption: "Configuration",
|
|
33809
33028
|
inputs: debugFields(cfg)
|
|
33810
33029
|
});
|
|
33811
33030
|
});
|
|
33812
33031
|
}, []);
|
|
33813
|
-
|
|
33814
|
-
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33032
|
+
function fieldValue(field) {
|
|
33033
|
+
if (!config) return "";
|
|
33034
|
+
return config[field] || "";
|
|
33035
|
+
}
|
|
33036
|
+
function setFieldValue(field, value) {
|
|
33037
|
+
if (!config) return;
|
|
33038
|
+
setConfig({ ...config, [field]: value });
|
|
33039
|
+
setNotice(null);
|
|
33819
33040
|
}
|
|
33820
|
-
|
|
33821
|
-
|
|
33041
|
+
function handleSave() {
|
|
33042
|
+
if (!config) return;
|
|
33043
|
+
setStage("saving");
|
|
33822
33044
|
setNotice(null);
|
|
33823
33045
|
writeCredentials(config).then(() => {
|
|
33824
33046
|
setLastSaved(config);
|
|
33825
33047
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
33826
|
-
setNotice({ kind: "success", text: "
|
|
33048
|
+
setNotice({ kind: "success", text: "Configuration saved" });
|
|
33049
|
+
setStage("form");
|
|
33827
33050
|
}).catch((err) => {
|
|
33828
33051
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
33829
|
-
|
|
33830
|
-
|
|
33831
|
-
|
|
33052
|
+
setStage("form");
|
|
33053
|
+
});
|
|
33054
|
+
}
|
|
33055
|
+
function quit() {
|
|
33832
33056
|
void finishDebugRun(
|
|
33833
33057
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
33834
33058
|
);
|
|
33835
33059
|
onDone();
|
|
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
|
|
33852
|
-
}
|
|
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
33060
|
}
|
|
33874
|
-
|
|
33875
|
-
|
|
33876
|
-
|
|
33877
|
-
|
|
33878
|
-
|
|
33879
|
-
|
|
33880
|
-
|
|
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);
|
|
33061
|
+
useInput11((input, key) => {
|
|
33062
|
+
if (stage === "loading" || stage === "saving") return;
|
|
33063
|
+
if (editing) {
|
|
33064
|
+
if (key.escape) {
|
|
33065
|
+
setFieldValue(activeField, valueBeforeEdit);
|
|
33066
|
+
setEditing(false);
|
|
33067
|
+
}
|
|
33888
33068
|
return;
|
|
33889
33069
|
}
|
|
33890
|
-
if (key.
|
|
33891
|
-
|
|
33070
|
+
if (key.escape || input === "q") {
|
|
33071
|
+
quit();
|
|
33892
33072
|
return;
|
|
33893
33073
|
}
|
|
33894
|
-
if (
|
|
33895
|
-
|
|
33074
|
+
if (input === "s") {
|
|
33075
|
+
handleSave();
|
|
33076
|
+
return;
|
|
33077
|
+
}
|
|
33078
|
+
if (input === "c") {
|
|
33079
|
+
setFieldValue(activeField, "");
|
|
33080
|
+
return;
|
|
33081
|
+
}
|
|
33082
|
+
if (key.tab || key.downArrow) {
|
|
33083
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
33084
|
+
setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
|
|
33085
|
+
return;
|
|
33086
|
+
}
|
|
33087
|
+
if (key.upArrow) {
|
|
33088
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
33089
|
+
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
33896
33090
|
return;
|
|
33897
33091
|
}
|
|
33898
|
-
if (key.
|
|
33092
|
+
if (key.return) {
|
|
33093
|
+
setValueBeforeEdit(fieldValue(activeField));
|
|
33094
|
+
setEditing(true);
|
|
33095
|
+
}
|
|
33899
33096
|
});
|
|
33900
|
-
if (
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
|
|
33908
|
-
|
|
33909
|
-
|
|
33910
|
-
/* @__PURE__ */
|
|
33911
|
-
|
|
33097
|
+
if (stage === "loading") {
|
|
33098
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33099
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
33100
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33101
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
|
|
33102
|
+
] });
|
|
33103
|
+
}
|
|
33104
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33105
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
33106
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33107
|
+
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
33108
|
+
const isActive = activeField === field;
|
|
33109
|
+
const value = fieldValue(field);
|
|
33110
|
+
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
33111
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33112
|
+
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33113
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
33114
|
+
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33115
|
+
TextInput4,
|
|
33116
|
+
{
|
|
33117
|
+
value,
|
|
33118
|
+
onChange: (next) => setFieldValue(field, next),
|
|
33119
|
+
onSubmit: () => setEditing(false),
|
|
33120
|
+
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
33121
|
+
}
|
|
33122
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33123
|
+
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
33124
|
+
] }, field);
|
|
33125
|
+
}) }),
|
|
33126
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33127
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33128
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33129
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33130
|
+
" ",
|
|
33131
|
+
notice.text
|
|
33132
|
+
] })
|
|
33133
|
+
] }),
|
|
33134
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33135
|
+
/* @__PURE__ */ jsx55(
|
|
33912
33136
|
ControlHints,
|
|
33913
33137
|
{
|
|
33914
|
-
hints: [
|
|
33138
|
+
hints: editing ? [
|
|
33139
|
+
{ keys: "type", label: "edit" },
|
|
33140
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33141
|
+
{ keys: "\u23CE", label: "done" },
|
|
33142
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33143
|
+
] : [
|
|
33915
33144
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
33916
|
-
{ keys: "\u23CE", label: "
|
|
33917
|
-
{ keys: "
|
|
33145
|
+
{ keys: "\u23CE", label: "edit" },
|
|
33146
|
+
{ keys: "c", label: "clear" },
|
|
33147
|
+
{ keys: "s", label: "save" },
|
|
33148
|
+
{ keys: "Esc/q", label: "quit without saving" }
|
|
33918
33149
|
]
|
|
33919
33150
|
}
|
|
33920
33151
|
)
|
|
33921
33152
|
] });
|
|
33922
33153
|
}
|
|
33923
|
-
var
|
|
33924
|
-
var
|
|
33925
|
-
"packages/experience-design-system-cli/src/tui/settings/configuration/
|
|
33154
|
+
var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
|
|
33155
|
+
var init_ContentfulConfigScreen = __esm({
|
|
33156
|
+
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
33926
33157
|
"use strict";
|
|
33927
33158
|
init_theme();
|
|
33159
|
+
init_config_store();
|
|
33160
|
+
init_debug_store();
|
|
33928
33161
|
init_control_hints();
|
|
33929
|
-
|
|
33930
|
-
|
|
33931
|
-
|
|
33932
|
-
|
|
33933
|
-
|
|
33934
|
-
|
|
33935
|
-
|
|
33936
|
-
|
|
33937
|
-
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
33162
|
+
FIELD_ORDER = [
|
|
33163
|
+
"spaceId",
|
|
33164
|
+
"environmentId",
|
|
33165
|
+
"cmaToken",
|
|
33166
|
+
"host",
|
|
33167
|
+
"defaultComponentDir",
|
|
33168
|
+
"defaultTokenFile",
|
|
33169
|
+
"contentfulBaseDir"
|
|
33938
33170
|
];
|
|
33171
|
+
FIELD_LABELS = {
|
|
33172
|
+
spaceId: "Space ID",
|
|
33173
|
+
environmentId: "Environment ID",
|
|
33174
|
+
cmaToken: "CMA Token",
|
|
33175
|
+
host: "API Host",
|
|
33176
|
+
defaultComponentDir: "Default component directory",
|
|
33177
|
+
defaultTokenFile: "Default token file",
|
|
33178
|
+
contentfulBaseDir: "Root Project Directory"
|
|
33179
|
+
};
|
|
33180
|
+
FIELD_HINTS = {
|
|
33181
|
+
contentfulBaseDir: "(where .contentful goes)"
|
|
33182
|
+
};
|
|
33183
|
+
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
33939
33184
|
}
|
|
33940
33185
|
});
|
|
33941
33186
|
|
|
33942
33187
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33943
|
-
import { useEffect as
|
|
33944
|
-
import { Box as
|
|
33945
|
-
import { Fragment as
|
|
33188
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
33189
|
+
import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
|
|
33190
|
+
import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33946
33191
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33947
|
-
const [loading, setLoading] =
|
|
33948
|
-
const [enabled, setEnabled] =
|
|
33949
|
-
|
|
33192
|
+
const [loading, setLoading] = useState30(true);
|
|
33193
|
+
const [enabled, setEnabled] = useState30(true);
|
|
33194
|
+
useEffect23(() => {
|
|
33950
33195
|
readAnalyticsSetting().then((setting) => {
|
|
33951
33196
|
setEnabled(setting.enabled);
|
|
33952
33197
|
setLoading(false);
|
|
@@ -33958,7 +33203,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33958
33203
|
});
|
|
33959
33204
|
});
|
|
33960
33205
|
}, []);
|
|
33961
|
-
|
|
33206
|
+
useInput12((input, key) => {
|
|
33962
33207
|
if (loading) return;
|
|
33963
33208
|
if (key.return || input === " ") {
|
|
33964
33209
|
setEnabled((current) => {
|
|
@@ -33973,21 +33218,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33973
33218
|
onDone();
|
|
33974
33219
|
}
|
|
33975
33220
|
});
|
|
33976
|
-
return /* @__PURE__ */
|
|
33977
|
-
/* @__PURE__ */
|
|
33978
|
-
/* @__PURE__ */
|
|
33979
|
-
loading ? /* @__PURE__ */
|
|
33980
|
-
/* @__PURE__ */
|
|
33221
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33222
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33223
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33224
|
+
loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
33225
|
+
/* @__PURE__ */ jsxs46(Text47, { children: [
|
|
33981
33226
|
"Share anonymous usage data:",
|
|
33982
33227
|
" ",
|
|
33983
|
-
/* @__PURE__ */
|
|
33228
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33984
33229
|
] }),
|
|
33985
|
-
/* @__PURE__ */
|
|
33986
|
-
/* @__PURE__ */
|
|
33987
|
-
/* @__PURE__ */
|
|
33230
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33231
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
33232
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
33988
33233
|
] }),
|
|
33989
|
-
/* @__PURE__ */
|
|
33990
|
-
/* @__PURE__ */
|
|
33234
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33235
|
+
/* @__PURE__ */ jsx56(
|
|
33991
33236
|
ControlHints,
|
|
33992
33237
|
{
|
|
33993
33238
|
hints: [
|
|
@@ -34008,95 +33253,14 @@ var init_screen11 = __esm({
|
|
|
34008
33253
|
}
|
|
34009
33254
|
});
|
|
34010
33255
|
|
|
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
|
-
|
|
34092
33256
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
34093
|
-
import { useEffect as
|
|
34094
|
-
import { Box as
|
|
34095
|
-
import { jsx as
|
|
33257
|
+
import { useEffect as useEffect24, useState as useState31 } from "react";
|
|
33258
|
+
import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
|
|
33259
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
34096
33260
|
function DebugModeScreen({ onDone }) {
|
|
34097
|
-
const [loading, setLoading] =
|
|
34098
|
-
const [enabled, setEnabled] =
|
|
34099
|
-
|
|
33261
|
+
const [loading, setLoading] = useState31(true);
|
|
33262
|
+
const [enabled, setEnabled] = useState31(true);
|
|
33263
|
+
useEffect24(() => {
|
|
34100
33264
|
readDebugModeSetting().then((setting) => {
|
|
34101
33265
|
setEnabled(setting.enabled);
|
|
34102
33266
|
setLoading(false);
|
|
@@ -34108,7 +33272,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
34108
33272
|
});
|
|
34109
33273
|
});
|
|
34110
33274
|
}, []);
|
|
34111
|
-
|
|
33275
|
+
useInput13((input, key) => {
|
|
34112
33276
|
if (loading) return;
|
|
34113
33277
|
if (key.return || input === " ") {
|
|
34114
33278
|
setEnabled((current) => {
|
|
@@ -34123,16 +33287,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
34123
33287
|
onDone();
|
|
34124
33288
|
}
|
|
34125
33289
|
});
|
|
34126
|
-
return /* @__PURE__ */
|
|
34127
|
-
/* @__PURE__ */
|
|
34128
|
-
/* @__PURE__ */
|
|
34129
|
-
loading ? /* @__PURE__ */
|
|
33290
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33291
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
33292
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33293
|
+
loading ? /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs47(Text48, { children: [
|
|
34130
33294
|
"Debug logging:",
|
|
34131
33295
|
" ",
|
|
34132
|
-
/* @__PURE__ */
|
|
33296
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
34133
33297
|
] }),
|
|
34134
|
-
/* @__PURE__ */
|
|
34135
|
-
/* @__PURE__ */
|
|
33298
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33299
|
+
/* @__PURE__ */ jsx57(
|
|
34136
33300
|
ControlHints,
|
|
34137
33301
|
{
|
|
34138
33302
|
hints: [
|
|
@@ -34158,20 +33322,20 @@ var app_exports = {};
|
|
|
34158
33322
|
__export(app_exports, {
|
|
34159
33323
|
runApp: () => runApp
|
|
34160
33324
|
});
|
|
34161
|
-
import { join as
|
|
34162
|
-
import { useEffect as
|
|
34163
|
-
import { Fragment as
|
|
33325
|
+
import { join as join26 } from "node:path";
|
|
33326
|
+
import { useEffect as useEffect25, useState as useState32 } from "react";
|
|
33327
|
+
import { Fragment as Fragment19, jsx as jsx58 } from "react/jsx-runtime";
|
|
34164
33328
|
function App({ importOptions, inkClear }) {
|
|
34165
|
-
const [screen, setScreen] =
|
|
34166
|
-
const [importExitCode, setImportExitCode] =
|
|
33329
|
+
const [screen, setScreen] = useState32("start");
|
|
33330
|
+
const [importExitCode, setImportExitCode] = useState32();
|
|
34167
33331
|
const showImportResult = importExitCode !== void 0;
|
|
34168
|
-
const [projectPath, setProjectPath] =
|
|
34169
|
-
const [tokensPath, setTokensPath] =
|
|
34170
|
-
const [scannedFiles, setScannedFiles] =
|
|
34171
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
34172
|
-
const [extractionRun, setExtractionRun] =
|
|
33332
|
+
const [projectPath, setProjectPath] = useState32();
|
|
33333
|
+
const [tokensPath, setTokensPath] = useState32();
|
|
33334
|
+
const [scannedFiles, setScannedFiles] = useState32();
|
|
33335
|
+
const [pendingLaunch, setPendingLaunch] = useState32();
|
|
33336
|
+
const [extractionRun, setExtractionRun] = useState32();
|
|
34173
33337
|
const extraction = useExtraction(extractionRun?.input);
|
|
34174
|
-
const [scopeRun, setScopeRun] =
|
|
33338
|
+
const [scopeRun, setScopeRun] = useState32();
|
|
34175
33339
|
const scopeFlow = useScopeGateFlow(
|
|
34176
33340
|
scopeRun && {
|
|
34177
33341
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -34186,12 +33350,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34186
33350
|
}
|
|
34187
33351
|
}
|
|
34188
33352
|
);
|
|
34189
|
-
const [generationInput, setGenerationInput] =
|
|
33353
|
+
const [generationInput, setGenerationInput] = useState32();
|
|
34190
33354
|
const generation = useGeneration(generationInput);
|
|
34191
|
-
const [flowStart, setFlowStart] =
|
|
33355
|
+
const [flowStart, setFlowStart] = useState32();
|
|
34192
33356
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34193
|
-
const [importDefaults, setImportDefaults] =
|
|
34194
|
-
|
|
33357
|
+
const [importDefaults, setImportDefaults] = useState32();
|
|
33358
|
+
useEffect25(() => {
|
|
34195
33359
|
if (screen !== "import") {
|
|
34196
33360
|
setImportDefaults(void 0);
|
|
34197
33361
|
return;
|
|
@@ -34209,7 +33373,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34209
33373
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
34210
33374
|
const state2 = await inspectTokens({
|
|
34211
33375
|
rawTokensPath: tokens,
|
|
34212
|
-
contentfulDir:
|
|
33376
|
+
contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
|
|
34213
33377
|
cache: importOptions.cache
|
|
34214
33378
|
});
|
|
34215
33379
|
if (state2.kind === "cached") {
|
|
@@ -34251,12 +33415,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34251
33415
|
}
|
|
34252
33416
|
});
|
|
34253
33417
|
};
|
|
34254
|
-
|
|
33418
|
+
useEffect25(() => {
|
|
34255
33419
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34256
33420
|
setExtractionRun(void 0);
|
|
34257
33421
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34258
33422
|
}, [extraction, extractionRun]);
|
|
34259
|
-
|
|
33423
|
+
useEffect25(() => {
|
|
34260
33424
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34261
33425
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34262
33426
|
setGenerationInput({
|
|
@@ -34274,7 +33438,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34274
33438
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34275
33439
|
});
|
|
34276
33440
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34277
|
-
|
|
33441
|
+
useEffect25(() => {
|
|
34278
33442
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34279
33443
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34280
33444
|
inkClear();
|
|
@@ -34317,9 +33481,9 @@ function App({ importOptions, inkClear }) {
|
|
|
34317
33481
|
};
|
|
34318
33482
|
switch (screen) {
|
|
34319
33483
|
case "import":
|
|
34320
|
-
if (showImportResult) return /* @__PURE__ */
|
|
33484
|
+
if (showImportResult) return /* @__PURE__ */ jsx58(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
34321
33485
|
if (flow && flowStart) {
|
|
34322
|
-
return /* @__PURE__ */
|
|
33486
|
+
return /* @__PURE__ */ jsx58(
|
|
34323
33487
|
FlowScreen,
|
|
34324
33488
|
{
|
|
34325
33489
|
state: flow.state,
|
|
@@ -34329,12 +33493,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34329
33493
|
}
|
|
34330
33494
|
);
|
|
34331
33495
|
}
|
|
34332
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
33496
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
34333
33497
|
if (projectPath === void 0) {
|
|
34334
|
-
return /* @__PURE__ */
|
|
33498
|
+
return /* @__PURE__ */ jsx58(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
34335
33499
|
}
|
|
34336
33500
|
if (tokensPath === void 0) {
|
|
34337
|
-
return /* @__PURE__ */
|
|
33501
|
+
return /* @__PURE__ */ jsx58(
|
|
34338
33502
|
TokenInputScreen,
|
|
34339
33503
|
{
|
|
34340
33504
|
initialPath: importDefaults.tokenFile,
|
|
@@ -34344,7 +33508,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34344
33508
|
);
|
|
34345
33509
|
}
|
|
34346
33510
|
if (scannedFiles === void 0) {
|
|
34347
|
-
return /* @__PURE__ */
|
|
33511
|
+
return /* @__PURE__ */ jsx58(
|
|
34348
33512
|
PathValidationScreen,
|
|
34349
33513
|
{
|
|
34350
33514
|
projectPath,
|
|
@@ -34356,10 +33520,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34356
33520
|
}
|
|
34357
33521
|
if (extractionRun) {
|
|
34358
33522
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
34359
|
-
return /* @__PURE__ */
|
|
33523
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
34360
33524
|
}
|
|
34361
33525
|
if (extraction?.status === "running") {
|
|
34362
|
-
return /* @__PURE__ */
|
|
33526
|
+
return /* @__PURE__ */ jsx58(
|
|
34363
33527
|
ExtractionScreen,
|
|
34364
33528
|
{
|
|
34365
33529
|
progress: extraction.progress,
|
|
@@ -34368,14 +33532,14 @@ function App({ importOptions, inkClear }) {
|
|
|
34368
33532
|
}
|
|
34369
33533
|
);
|
|
34370
33534
|
}
|
|
34371
|
-
return /* @__PURE__ */
|
|
33535
|
+
return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
34372
33536
|
}
|
|
34373
33537
|
if (scopeRun && scopeFlow) {
|
|
34374
33538
|
if (scopeFlow.status === "failed") {
|
|
34375
|
-
return /* @__PURE__ */
|
|
33539
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
34376
33540
|
}
|
|
34377
33541
|
if (scopeFlow.status === "deciding") {
|
|
34378
|
-
return /* @__PURE__ */
|
|
33542
|
+
return /* @__PURE__ */ jsx58(
|
|
34379
33543
|
ScopeGateScreen,
|
|
34380
33544
|
{
|
|
34381
33545
|
components: scopeFlow.load.components,
|
|
@@ -34385,7 +33549,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34385
33549
|
);
|
|
34386
33550
|
}
|
|
34387
33551
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
34388
|
-
return /* @__PURE__ */
|
|
33552
|
+
return /* @__PURE__ */ jsx58(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
34389
33553
|
}
|
|
34390
33554
|
if (generation?.status === "running") {
|
|
34391
33555
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -34393,7 +33557,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34393
33557
|
hasRawTokens,
|
|
34394
33558
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
34395
33559
|
});
|
|
34396
|
-
return /* @__PURE__ */
|
|
33560
|
+
return /* @__PURE__ */ jsx58(
|
|
34397
33561
|
GenerationScreen,
|
|
34398
33562
|
{
|
|
34399
33563
|
progress: generation.progress,
|
|
@@ -34405,10 +33569,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34405
33569
|
}
|
|
34406
33570
|
);
|
|
34407
33571
|
}
|
|
34408
|
-
return /* @__PURE__ */
|
|
33572
|
+
return /* @__PURE__ */ jsx58(Fragment19, {});
|
|
34409
33573
|
}
|
|
34410
33574
|
if (pendingLaunch?.cached) {
|
|
34411
|
-
return /* @__PURE__ */
|
|
33575
|
+
return /* @__PURE__ */ jsx58(
|
|
34412
33576
|
TokenReuseScreen,
|
|
34413
33577
|
{
|
|
34414
33578
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -34419,7 +33583,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34419
33583
|
}
|
|
34420
33584
|
);
|
|
34421
33585
|
}
|
|
34422
|
-
return /* @__PURE__ */
|
|
33586
|
+
return /* @__PURE__ */ jsx58(
|
|
34423
33587
|
CredentialsScreen,
|
|
34424
33588
|
{
|
|
34425
33589
|
initial: importDefaults.credentials,
|
|
@@ -34428,19 +33592,17 @@ function App({ importOptions, inkClear }) {
|
|
|
34428
33592
|
}
|
|
34429
33593
|
);
|
|
34430
33594
|
case "help":
|
|
34431
|
-
return /* @__PURE__ */
|
|
34432
|
-
case "upgrade":
|
|
34433
|
-
return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
|
|
33595
|
+
return /* @__PURE__ */ jsx58(HelpScreen, { onDone: goToStart });
|
|
34434
33596
|
case "settings":
|
|
34435
|
-
return /* @__PURE__ */
|
|
33597
|
+
return /* @__PURE__ */ jsx58(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
34436
33598
|
case "settings-configuration":
|
|
34437
|
-
return /* @__PURE__ */
|
|
33599
|
+
return /* @__PURE__ */ jsx58(ConfigurationScreen, { onDone: goToSettings });
|
|
34438
33600
|
case "settings-opt-in-analytics":
|
|
34439
|
-
return /* @__PURE__ */
|
|
33601
|
+
return /* @__PURE__ */ jsx58(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
34440
33602
|
case "settings-debug-mode":
|
|
34441
|
-
return /* @__PURE__ */
|
|
33603
|
+
return /* @__PURE__ */ jsx58(DebugModeScreen, { onDone: goToSettings });
|
|
34442
33604
|
case "start":
|
|
34443
|
-
return /* @__PURE__ */
|
|
33605
|
+
return /* @__PURE__ */ jsx58(HomeScreen, { onNavigate: setScreen });
|
|
34444
33606
|
}
|
|
34445
33607
|
}
|
|
34446
33608
|
async function runApp(renderApp, importOptions) {
|
|
@@ -34448,7 +33610,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
34448
33610
|
instance.clear?.();
|
|
34449
33611
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
34450
33612
|
};
|
|
34451
|
-
const instance = renderApp(/* @__PURE__ */
|
|
33613
|
+
const instance = renderApp(/* @__PURE__ */ jsx58(App, { importOptions, inkClear }));
|
|
34452
33614
|
await instance.waitUntilExit();
|
|
34453
33615
|
}
|
|
34454
33616
|
var init_app = __esm({
|
|
@@ -34472,18 +33634,17 @@ var init_app = __esm({
|
|
|
34472
33634
|
init_use_flow();
|
|
34473
33635
|
init_PageContainer2();
|
|
34474
33636
|
init_PageContainer3();
|
|
34475
|
-
|
|
33637
|
+
init_ContentfulConfigScreen();
|
|
34476
33638
|
init_screen11();
|
|
34477
|
-
init_PageContainer4();
|
|
34478
33639
|
init_screen12();
|
|
34479
|
-
|
|
33640
|
+
init_config_store();
|
|
34480
33641
|
}
|
|
34481
33642
|
});
|
|
34482
33643
|
|
|
34483
33644
|
// packages/experience-design-system-cli/program.ts
|
|
34484
33645
|
init_src4();
|
|
34485
33646
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
34486
|
-
import { join as
|
|
33647
|
+
import { join as join27 } from "node:path";
|
|
34487
33648
|
import { Command } from "commander";
|
|
34488
33649
|
|
|
34489
33650
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
@@ -34511,14 +33672,14 @@ function runDevWatch(args) {
|
|
|
34511
33672
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
34512
33673
|
return Promise.resolve(1);
|
|
34513
33674
|
}
|
|
34514
|
-
return new Promise((
|
|
33675
|
+
return new Promise((resolve27) => {
|
|
34515
33676
|
const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
34516
33677
|
process.on("SIGINT", () => void 0);
|
|
34517
|
-
child.on("exit", (code) =>
|
|
33678
|
+
child.on("exit", (code) => resolve27(code ?? 0));
|
|
34518
33679
|
child.on("error", (err) => {
|
|
34519
33680
|
process.stderr.write(`${err.message}
|
|
34520
33681
|
`);
|
|
34521
|
-
|
|
33682
|
+
resolve27(1);
|
|
34522
33683
|
});
|
|
34523
33684
|
});
|
|
34524
33685
|
}
|
|
@@ -34543,13 +33704,11 @@ function registerImportCommand(program, openTui) {
|
|
|
34543
33704
|
}
|
|
34544
33705
|
|
|
34545
33706
|
// packages/experience-design-system-cli/program.ts
|
|
34546
|
-
init_agent_store();
|
|
34547
|
-
init_apply_binary_overrides();
|
|
34548
33707
|
init_analytics_store();
|
|
34549
33708
|
init_package_root();
|
|
34550
33709
|
var pkg = JSON.parse(
|
|
34551
33710
|
readFileSync9(
|
|
34552
|
-
|
|
33711
|
+
join27(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
34553
33712
|
"utf8"
|
|
34554
33713
|
)
|
|
34555
33714
|
);
|
|
@@ -34566,7 +33725,6 @@ function createProgram() {
|
|
|
34566
33725
|
const commandChain = chain.join(" ") || actionCommand.name();
|
|
34567
33726
|
const { enabled } = await readAnalyticsSetting();
|
|
34568
33727
|
setPersistedAnalyticsDisabled(!enabled);
|
|
34569
|
-
await readAgentConfig().then(applyBinaryOverrides, () => void 0);
|
|
34570
33728
|
setCliVersion(pkg.version);
|
|
34571
33729
|
noteCommandStart(commandChain);
|
|
34572
33730
|
});
|
|
@@ -34590,7 +33748,7 @@ init_config();
|
|
|
34590
33748
|
init_package_root();
|
|
34591
33749
|
import { existsSync as existsSync11 } from "node:fs";
|
|
34592
33750
|
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
34593
|
-
import { dirname as dirname16, join as
|
|
33751
|
+
import { dirname as dirname16, join as join28 } from "node:path";
|
|
34594
33752
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
34595
33753
|
async function readJson(path5) {
|
|
34596
33754
|
try {
|
|
@@ -34601,9 +33759,9 @@ async function readJson(path5) {
|
|
|
34601
33759
|
}
|
|
34602
33760
|
async function migrateOldConfig() {
|
|
34603
33761
|
try {
|
|
34604
|
-
const oldCredentials =
|
|
34605
|
-
const oldRuns =
|
|
34606
|
-
const oldDebugMode =
|
|
33762
|
+
const oldCredentials = join28(oldConfigDir2(), "credentials.json");
|
|
33763
|
+
const oldRuns = join28(oldConfigDir2(), "runs.json");
|
|
33764
|
+
const oldDebugMode = join28(
|
|
34607
33765
|
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
34608
33766
|
".contentful",
|
|
34609
33767
|
"config",
|