@contentful/experience-design-system-cli 2.37.1-dev-build-41421938.0 → 2.37.1-dev-build-d5797739.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +555 -243
- package/dist/index.js +604 -256
- package/dist/package.json +1 -1
- package/dist/src/tui/help/file-locations.d.ts +23 -0
- package/dist/src/tui/settings/agents/AgentScreens.d.ts +8 -0
- package/dist/src/tui/settings/agents/agent-store.d.ts +14 -0
- package/dist/src/tui/settings/contentful-configuration/ContentfulConfigScreen.d.ts +1 -0
- package/dist/src/tui/settings/contentful-configuration/ProjectConfigScreen.d.ts +5 -0
- package/dist/src/tui/settings/shared/FieldForm.d.ts +35 -0
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1500,7 +1500,7 @@ async function runAgent(options) {
|
|
|
1500
1500
|
promptLen: prompt.length,
|
|
1501
1501
|
promptHead: prompt.slice(0, 500)
|
|
1502
1502
|
});
|
|
1503
|
-
return new Promise((
|
|
1503
|
+
return new Promise((resolve28) => {
|
|
1504
1504
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1505
1505
|
const child = spawn(binary, args, {
|
|
1506
1506
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1549,7 +1549,7 @@ async function runAgent(options) {
|
|
|
1549
1549
|
stderrLen: stderr.length,
|
|
1550
1550
|
stderrTail: stderr.slice(-1e3)
|
|
1551
1551
|
});
|
|
1552
|
-
|
|
1552
|
+
resolve28(result);
|
|
1553
1553
|
});
|
|
1554
1554
|
});
|
|
1555
1555
|
}
|
|
@@ -1571,7 +1571,7 @@ async function checkAgentAuth(agent) {
|
|
|
1571
1571
|
return "not-found";
|
|
1572
1572
|
if (agent !== "claude")
|
|
1573
1573
|
return "ok";
|
|
1574
|
-
return new Promise((
|
|
1574
|
+
return new Promise((resolve28) => {
|
|
1575
1575
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1576
1576
|
let stdout = "";
|
|
1577
1577
|
let done = false;
|
|
@@ -1580,7 +1580,7 @@ async function checkAgentAuth(agent) {
|
|
|
1580
1580
|
return;
|
|
1581
1581
|
done = true;
|
|
1582
1582
|
child.kill("SIGTERM");
|
|
1583
|
-
|
|
1583
|
+
resolve28("unauthenticated");
|
|
1584
1584
|
}, 5e3);
|
|
1585
1585
|
child.stdout?.on("data", (chunk) => {
|
|
1586
1586
|
stdout += chunk.toString();
|
|
@@ -1591,14 +1591,14 @@ async function checkAgentAuth(agent) {
|
|
|
1591
1591
|
done = true;
|
|
1592
1592
|
clearTimeout(timer);
|
|
1593
1593
|
if (code !== 0) {
|
|
1594
|
-
|
|
1594
|
+
resolve28("unauthenticated");
|
|
1595
1595
|
return;
|
|
1596
1596
|
}
|
|
1597
1597
|
try {
|
|
1598
1598
|
const status = JSON.parse(stdout);
|
|
1599
|
-
|
|
1599
|
+
resolve28(status.loggedIn ? "ok" : "unauthenticated");
|
|
1600
1600
|
} catch {
|
|
1601
|
-
|
|
1601
|
+
resolve28("unauthenticated");
|
|
1602
1602
|
}
|
|
1603
1603
|
});
|
|
1604
1604
|
});
|
|
@@ -1608,9 +1608,9 @@ async function binaryIsOnPath(binary) {
|
|
|
1608
1608
|
const fs = await import("node:fs/promises");
|
|
1609
1609
|
return fs.access(binary).then(() => true, () => false);
|
|
1610
1610
|
}
|
|
1611
|
-
return new Promise((
|
|
1611
|
+
return new Promise((resolve28) => {
|
|
1612
1612
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1613
|
-
child.on("close", (code) =>
|
|
1613
|
+
child.on("close", (code) => resolve28(code === 0));
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
1616
|
var init_check_agent_auth = __esm({
|
|
@@ -14333,7 +14333,7 @@ function errorMessage(error) {
|
|
|
14333
14333
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14334
14334
|
}
|
|
14335
14335
|
function defaultSleep(delayMs) {
|
|
14336
|
-
return new Promise((
|
|
14336
|
+
return new Promise((resolve28) => setTimeout(resolve28, delayMs));
|
|
14337
14337
|
}
|
|
14338
14338
|
var MAX_RETRY_AFTER_MS;
|
|
14339
14339
|
var init_http_utils = __esm({
|
|
@@ -14609,7 +14609,7 @@ var init_api_client = __esm({
|
|
|
14609
14609
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14610
14610
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14611
14611
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14612
|
-
await new Promise((
|
|
14612
|
+
await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
|
|
14613
14613
|
}
|
|
14614
14614
|
}
|
|
14615
14615
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -18527,7 +18527,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18527
18527
|
const message = error instanceof Error ? error.message : String(error);
|
|
18528
18528
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18529
18529
|
throw error;
|
|
18530
|
-
await new Promise((
|
|
18530
|
+
await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
|
|
18531
18531
|
}
|
|
18532
18532
|
}
|
|
18533
18533
|
}
|
|
@@ -32276,7 +32276,7 @@ var init_save = __esm({
|
|
|
32276
32276
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32277
32277
|
appendRun,
|
|
32278
32278
|
buildSourceFingerprint,
|
|
32279
|
-
sleep: (ms) => new Promise((
|
|
32279
|
+
sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
|
|
32280
32280
|
warn: (message) => process.stderr.write(message)
|
|
32281
32281
|
});
|
|
32282
32282
|
}
|
|
@@ -32827,13 +32827,48 @@ var init_debug_store = __esm({
|
|
|
32827
32827
|
}
|
|
32828
32828
|
});
|
|
32829
32829
|
|
|
32830
|
+
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
32831
|
+
import { join as join27, resolve as resolve27 } from "node:path";
|
|
32832
|
+
function describeFileLocations({
|
|
32833
|
+
contentfulBaseDir,
|
|
32834
|
+
debugModeEnabled,
|
|
32835
|
+
currentSessionDir: currentSessionDir2
|
|
32836
|
+
}) {
|
|
32837
|
+
if (!debugModeEnabled) {
|
|
32838
|
+
return {
|
|
32839
|
+
debugLogs: "none while Debug Mode is off",
|
|
32840
|
+
importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
32841
|
+
};
|
|
32842
|
+
}
|
|
32843
|
+
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
32844
|
+
const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
|
|
32845
|
+
return {
|
|
32846
|
+
debugLogs: join27(session, "debug"),
|
|
32847
|
+
importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
32848
|
+
};
|
|
32849
|
+
}
|
|
32850
|
+
var init_file_locations = __esm({
|
|
32851
|
+
"packages/experience-design-system-cli/src/tui/help/file-locations.ts"() {
|
|
32852
|
+
"use strict";
|
|
32853
|
+
}
|
|
32854
|
+
});
|
|
32855
|
+
|
|
32830
32856
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32831
32857
|
async function readHelpInfo() {
|
|
32832
|
-
const debugMode = await readDebugModeSetting();
|
|
32858
|
+
const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
|
|
32859
|
+
const base = settings["contentfulBaseDir"];
|
|
32860
|
+
const locations = describeFileLocations({
|
|
32861
|
+
contentfulBaseDir: typeof base === "string" ? base : "",
|
|
32862
|
+
debugModeEnabled: debugMode.enabled,
|
|
32863
|
+
currentSessionDir: currentSessionDir()
|
|
32864
|
+
});
|
|
32833
32865
|
return {
|
|
32834
32866
|
storage: [
|
|
32835
32867
|
{ label: "Config folder", value: configRoot2() },
|
|
32836
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
32868
|
+
{ label: "Settings file", value: configFilePath2() },
|
|
32869
|
+
{ label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
|
|
32870
|
+
{ label: "Debug logs", value: locations.debugLogs },
|
|
32871
|
+
{ label: "Import files", value: locations.importFiles }
|
|
32837
32872
|
],
|
|
32838
32873
|
troubleshooting: [
|
|
32839
32874
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32854,6 +32889,7 @@ var init_help_info = __esm({
|
|
|
32854
32889
|
init_debug_store();
|
|
32855
32890
|
init_debug_mode_store();
|
|
32856
32891
|
init_version();
|
|
32892
|
+
init_file_locations();
|
|
32857
32893
|
}
|
|
32858
32894
|
});
|
|
32859
32895
|
|
|
@@ -32865,7 +32901,7 @@ function Section({ title, rows }) {
|
|
|
32865
32901
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
32866
32902
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
32867
32903
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
32868
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
32904
|
+
/* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
32869
32905
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
32870
32906
|
] }, row.label))
|
|
32871
32907
|
] });
|
|
@@ -32979,6 +33015,349 @@ var init_PageContainer3 = __esm({
|
|
|
32979
33015
|
}
|
|
32980
33016
|
});
|
|
32981
33017
|
|
|
33018
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
33019
|
+
import { useState as useState29 } from "react";
|
|
33020
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33021
|
+
import TextInput4 from "ink-text-input";
|
|
33022
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33023
|
+
function FieldForm({
|
|
33024
|
+
title,
|
|
33025
|
+
subtitle,
|
|
33026
|
+
fields,
|
|
33027
|
+
values,
|
|
33028
|
+
onChange,
|
|
33029
|
+
onSave,
|
|
33030
|
+
onQuit,
|
|
33031
|
+
notice,
|
|
33032
|
+
busy = false,
|
|
33033
|
+
footer
|
|
33034
|
+
}) {
|
|
33035
|
+
const [active, setActive] = useState29(0);
|
|
33036
|
+
const [editing, setEditing] = useState29(false);
|
|
33037
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33038
|
+
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
33039
|
+
const current = fields[active];
|
|
33040
|
+
useInput11((input, key) => {
|
|
33041
|
+
if (busy) return;
|
|
33042
|
+
if (editing) {
|
|
33043
|
+
if (key.escape) {
|
|
33044
|
+
onChange(current.key, valueBeforeEdit);
|
|
33045
|
+
setEditing(false);
|
|
33046
|
+
}
|
|
33047
|
+
return;
|
|
33048
|
+
}
|
|
33049
|
+
if (key.escape || input === "q") {
|
|
33050
|
+
onQuit();
|
|
33051
|
+
return;
|
|
33052
|
+
}
|
|
33053
|
+
if (input === "s") {
|
|
33054
|
+
onSave();
|
|
33055
|
+
return;
|
|
33056
|
+
}
|
|
33057
|
+
if (input === "c") {
|
|
33058
|
+
onChange(current.key, "");
|
|
33059
|
+
return;
|
|
33060
|
+
}
|
|
33061
|
+
if (key.tab || key.downArrow) {
|
|
33062
|
+
setActive((i) => (i + 1) % fields.length);
|
|
33063
|
+
return;
|
|
33064
|
+
}
|
|
33065
|
+
if (key.upArrow) {
|
|
33066
|
+
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
33067
|
+
return;
|
|
33068
|
+
}
|
|
33069
|
+
if (key.return) {
|
|
33070
|
+
setValueBeforeEdit(values[current.key]);
|
|
33071
|
+
setEditing(true);
|
|
33072
|
+
}
|
|
33073
|
+
});
|
|
33074
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33075
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: title }),
|
|
33076
|
+
subtitle && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: subtitle }),
|
|
33077
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33078
|
+
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: fields.map((field, index) => {
|
|
33079
|
+
const isActive = index === active;
|
|
33080
|
+
const value = values[field.key];
|
|
33081
|
+
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
33082
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33083
|
+
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33084
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
33085
|
+
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33086
|
+
TextInput4,
|
|
33087
|
+
{
|
|
33088
|
+
value,
|
|
33089
|
+
onChange: (next) => onChange(field.key, next),
|
|
33090
|
+
onSubmit: () => setEditing(false),
|
|
33091
|
+
mask: field.masked ? "\u2022" : void 0
|
|
33092
|
+
}
|
|
33093
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33094
|
+
field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
33095
|
+
] }, field.key);
|
|
33096
|
+
}) }),
|
|
33097
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33098
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33099
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33100
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33101
|
+
" ",
|
|
33102
|
+
notice.text
|
|
33103
|
+
] })
|
|
33104
|
+
] }),
|
|
33105
|
+
footer,
|
|
33106
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33107
|
+
/* @__PURE__ */ jsx55(
|
|
33108
|
+
ControlHints,
|
|
33109
|
+
{
|
|
33110
|
+
hints: editing ? [
|
|
33111
|
+
{ keys: "type", label: "edit" },
|
|
33112
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33113
|
+
{ keys: "\u23CE", label: "done" },
|
|
33114
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33115
|
+
] : [
|
|
33116
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33117
|
+
{ keys: "\u23CE", label: "edit" },
|
|
33118
|
+
{ keys: "c", label: "clear" },
|
|
33119
|
+
{ keys: "s", label: "save" },
|
|
33120
|
+
{ keys: "Esc/q", label: "back without saving" }
|
|
33121
|
+
]
|
|
33122
|
+
}
|
|
33123
|
+
)
|
|
33124
|
+
] });
|
|
33125
|
+
}
|
|
33126
|
+
var init_FieldForm = __esm({
|
|
33127
|
+
"packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
|
|
33128
|
+
"use strict";
|
|
33129
|
+
init_home_theme();
|
|
33130
|
+
init_control_hints();
|
|
33131
|
+
}
|
|
33132
|
+
});
|
|
33133
|
+
|
|
33134
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
|
|
33135
|
+
function emptyAgents() {
|
|
33136
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "" }]));
|
|
33137
|
+
}
|
|
33138
|
+
async function readAgentConfig() {
|
|
33139
|
+
const store = await readV1Store();
|
|
33140
|
+
const stored = asString(store["agent"]);
|
|
33141
|
+
const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
|
|
33142
|
+
const agents = emptyAgents();
|
|
33143
|
+
const saved = store["agents"];
|
|
33144
|
+
if (saved && typeof saved === "object") {
|
|
33145
|
+
for (const name of AGENT_NAMES) {
|
|
33146
|
+
const entry = saved[name];
|
|
33147
|
+
if (entry && typeof entry === "object")
|
|
33148
|
+
agents[name] = { model: asString(entry["model"]) };
|
|
33149
|
+
}
|
|
33150
|
+
}
|
|
33151
|
+
const legacyModel = asString(store["agentModel"]);
|
|
33152
|
+
if (legacyModel && !agents[defaultAgent].model) agents[defaultAgent] = { model: legacyModel };
|
|
33153
|
+
return { defaultAgent, agents };
|
|
33154
|
+
}
|
|
33155
|
+
async function writeAgentConfig(config) {
|
|
33156
|
+
const existing = await readV1Store();
|
|
33157
|
+
const merged = { ...existing };
|
|
33158
|
+
const agents = {};
|
|
33159
|
+
for (const name of AGENT_NAMES) {
|
|
33160
|
+
const model = config.agents[name].model.trim();
|
|
33161
|
+
if (model) agents[name] = { model };
|
|
33162
|
+
}
|
|
33163
|
+
merged["agent"] = config.defaultAgent;
|
|
33164
|
+
const defaultModel = agents[config.defaultAgent]?.model;
|
|
33165
|
+
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
33166
|
+
else delete merged["agentModel"];
|
|
33167
|
+
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
33168
|
+
else delete merged["agents"];
|
|
33169
|
+
await writeV1Store(merged);
|
|
33170
|
+
}
|
|
33171
|
+
var DEFAULT_AGENT3, AGENT_LABELS, AGENT_HINTS, asString;
|
|
33172
|
+
var init_agent_store = __esm({
|
|
33173
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts"() {
|
|
33174
|
+
"use strict";
|
|
33175
|
+
init_src4();
|
|
33176
|
+
init_v1_store();
|
|
33177
|
+
DEFAULT_AGENT3 = "claude";
|
|
33178
|
+
AGENT_LABELS = {
|
|
33179
|
+
claude: "Claude Code",
|
|
33180
|
+
codex: "OpenAI Codex",
|
|
33181
|
+
opencode: "OpenCode",
|
|
33182
|
+
cursor: "Cursor",
|
|
33183
|
+
copilot: "GitHub Copilot"
|
|
33184
|
+
};
|
|
33185
|
+
AGENT_HINTS = {
|
|
33186
|
+
claude: "claude",
|
|
33187
|
+
codex: "codex",
|
|
33188
|
+
opencode: "opencode",
|
|
33189
|
+
cursor: "cursor-agent",
|
|
33190
|
+
copilot: "copilot"
|
|
33191
|
+
};
|
|
33192
|
+
asString = (value) => typeof value === "string" ? value : "";
|
|
33193
|
+
}
|
|
33194
|
+
});
|
|
33195
|
+
|
|
33196
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
33197
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
33198
|
+
import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
|
|
33199
|
+
import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33200
|
+
function AgentForm({
|
|
33201
|
+
name,
|
|
33202
|
+
config,
|
|
33203
|
+
setConfig,
|
|
33204
|
+
onBack
|
|
33205
|
+
}) {
|
|
33206
|
+
const [saving, setSaving] = useState30(false);
|
|
33207
|
+
const [notice, setNotice] = useState30(null);
|
|
33208
|
+
const save = () => {
|
|
33209
|
+
setSaving(true);
|
|
33210
|
+
setNotice(null);
|
|
33211
|
+
writeAgentConfig(config).then(() => setNotice({ kind: "success", text: `${AGENT_LABELS[name]} settings saved` })).catch(
|
|
33212
|
+
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
|
|
33213
|
+
).finally(() => setSaving(false));
|
|
33214
|
+
};
|
|
33215
|
+
return /* @__PURE__ */ jsx56(
|
|
33216
|
+
FieldForm,
|
|
33217
|
+
{
|
|
33218
|
+
title: AGENT_LABELS[name],
|
|
33219
|
+
subtitle: `Runs the \`${AGENT_HINTS[name]}\` command. ${config.defaultAgent === name ? "This is the default agent." : ""}`.trim(),
|
|
33220
|
+
fields: MODEL_FIELDS,
|
|
33221
|
+
values: { model: config.agents[name].model },
|
|
33222
|
+
onChange: (_key, value) => {
|
|
33223
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { model: value } } });
|
|
33224
|
+
setNotice(null);
|
|
33225
|
+
},
|
|
33226
|
+
onSave: save,
|
|
33227
|
+
onQuit: onBack,
|
|
33228
|
+
notice,
|
|
33229
|
+
busy: saving
|
|
33230
|
+
}
|
|
33231
|
+
);
|
|
33232
|
+
}
|
|
33233
|
+
function AgentsScreen({ onDone }) {
|
|
33234
|
+
const [config, setConfig] = useState30(null);
|
|
33235
|
+
const [focus, setFocus] = useState30(0);
|
|
33236
|
+
const [open, setOpen] = useState30(null);
|
|
33237
|
+
const [notice, setNotice] = useState30(null);
|
|
33238
|
+
useEffect22(() => {
|
|
33239
|
+
void readAgentConfig().then((loaded) => {
|
|
33240
|
+
setConfig(loaded);
|
|
33241
|
+
startDebugRun({
|
|
33242
|
+
flow: "settings/agents",
|
|
33243
|
+
step: "01-agents",
|
|
33244
|
+
menuOption: "Configuration > Agents",
|
|
33245
|
+
inputs: { default_agent: loaded.defaultAgent }
|
|
33246
|
+
});
|
|
33247
|
+
});
|
|
33248
|
+
}, []);
|
|
33249
|
+
const cycleDefault = (step) => {
|
|
33250
|
+
if (!config) return;
|
|
33251
|
+
const index = AGENT_NAMES.indexOf(config.defaultAgent);
|
|
33252
|
+
const next = { ...config, defaultAgent: AGENT_NAMES[(index + step + AGENT_NAMES.length) % AGENT_NAMES.length] };
|
|
33253
|
+
setConfig(next);
|
|
33254
|
+
writeAgentConfig(next).then(() => setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[next.defaultAgent]}` })).catch(
|
|
33255
|
+
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
|
|
33256
|
+
);
|
|
33257
|
+
};
|
|
33258
|
+
useInput12((input, key) => {
|
|
33259
|
+
if (!config || open) return;
|
|
33260
|
+
const row = ROWS[focus];
|
|
33261
|
+
if (key.upArrow) {
|
|
33262
|
+
setFocus((i) => (i - 1 + ROWS.length) % ROWS.length);
|
|
33263
|
+
return;
|
|
33264
|
+
}
|
|
33265
|
+
if (key.downArrow || key.tab) {
|
|
33266
|
+
setFocus((i) => (i + 1) % ROWS.length);
|
|
33267
|
+
return;
|
|
33268
|
+
}
|
|
33269
|
+
if (row.kind === "default" && key.leftArrow) {
|
|
33270
|
+
cycleDefault(-1);
|
|
33271
|
+
return;
|
|
33272
|
+
}
|
|
33273
|
+
if (row.kind === "default" && key.rightArrow) {
|
|
33274
|
+
cycleDefault(1);
|
|
33275
|
+
return;
|
|
33276
|
+
}
|
|
33277
|
+
if (key.return) {
|
|
33278
|
+
if (row.kind === "default") cycleDefault(1);
|
|
33279
|
+
else setOpen(row.name);
|
|
33280
|
+
return;
|
|
33281
|
+
}
|
|
33282
|
+
if (key.escape || input === "q") {
|
|
33283
|
+
void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
|
|
33284
|
+
onDone();
|
|
33285
|
+
}
|
|
33286
|
+
});
|
|
33287
|
+
if (!config) {
|
|
33288
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33289
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: "Agents" }),
|
|
33290
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33291
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: "Loading..." })
|
|
33292
|
+
] });
|
|
33293
|
+
}
|
|
33294
|
+
if (open) {
|
|
33295
|
+
return /* @__PURE__ */ jsx56(AgentForm, { name: open, config, setConfig, onBack: () => setOpen(null) });
|
|
33296
|
+
}
|
|
33297
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33298
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: "Agents" }),
|
|
33299
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "The coding agent the CLI runs, and the settings for each one." }),
|
|
33300
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33301
|
+
ROWS.map((row, index) => {
|
|
33302
|
+
const isFocused = index === focus;
|
|
33303
|
+
const pointer = /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
33304
|
+
if (row.kind === "default") {
|
|
33305
|
+
return /* @__PURE__ */ jsx56(Box45, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33306
|
+
pointer,
|
|
33307
|
+
/* @__PURE__ */ jsx56(Text47, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: "Default agent" }),
|
|
33308
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: `\u2039 ${AGENT_LABELS[config.defaultAgent]} \u203A` })
|
|
33309
|
+
] }) }, "default");
|
|
33310
|
+
}
|
|
33311
|
+
const model = config.agents[row.name].model;
|
|
33312
|
+
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33313
|
+
pointer,
|
|
33314
|
+
/* @__PURE__ */ jsx56(Box45, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[row.name] }) }),
|
|
33315
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: model ? `model: ${model}` : "model: default" }),
|
|
33316
|
+
row.name === config.defaultAgent && /* @__PURE__ */ jsx56(Text47, { color: PALETTE.success, children: "(default)" })
|
|
33317
|
+
] }, row.name);
|
|
33318
|
+
}),
|
|
33319
|
+
notice && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
33320
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33321
|
+
/* @__PURE__ */ jsxs46(Text47, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33322
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33323
|
+
" ",
|
|
33324
|
+
notice.text
|
|
33325
|
+
] })
|
|
33326
|
+
] }),
|
|
33327
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33328
|
+
/* @__PURE__ */ jsx56(
|
|
33329
|
+
ControlHints,
|
|
33330
|
+
{
|
|
33331
|
+
hints: ROWS[focus].kind === "default" ? [
|
|
33332
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33333
|
+
{ keys: "\u2190/\u2192", label: "change default agent" },
|
|
33334
|
+
{ keys: "Esc/q", label: "back" }
|
|
33335
|
+
] : [
|
|
33336
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
33337
|
+
{ keys: "\u23CE", label: "open" },
|
|
33338
|
+
{ keys: "Esc/q", label: "back" }
|
|
33339
|
+
]
|
|
33340
|
+
}
|
|
33341
|
+
)
|
|
33342
|
+
] });
|
|
33343
|
+
}
|
|
33344
|
+
var MODEL_FIELDS, ROWS;
|
|
33345
|
+
var init_AgentScreens = __esm({
|
|
33346
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx"() {
|
|
33347
|
+
"use strict";
|
|
33348
|
+
init_src4();
|
|
33349
|
+
init_home_theme();
|
|
33350
|
+
init_control_hints();
|
|
33351
|
+
init_debug_store();
|
|
33352
|
+
init_FieldForm();
|
|
33353
|
+
init_agent_store();
|
|
33354
|
+
MODEL_FIELDS = [
|
|
33355
|
+
{ key: "model", label: "Model", hint: "(empty: the agent\u2019s own default)" }
|
|
33356
|
+
];
|
|
33357
|
+
ROWS = [{ kind: "default" }, ...AGENT_NAMES.map((name) => ({ kind: "agent", name }))];
|
|
33358
|
+
}
|
|
33359
|
+
});
|
|
33360
|
+
|
|
32982
33361
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
32983
33362
|
async function readCredentials() {
|
|
32984
33363
|
const store = await readV1Store();
|
|
@@ -33010,11 +33389,10 @@ var init_config_store = __esm({
|
|
|
33010
33389
|
}
|
|
33011
33390
|
});
|
|
33012
33391
|
|
|
33013
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/
|
|
33014
|
-
import { useEffect as
|
|
33015
|
-
import { Box as
|
|
33016
|
-
import
|
|
33017
|
-
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33392
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
33393
|
+
import { useEffect as useEffect23, useState as useState31 } from "react";
|
|
33394
|
+
import { Box as Box46, Text as Text48 } from "ink";
|
|
33395
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33018
33396
|
function debugFields(config) {
|
|
33019
33397
|
return {
|
|
33020
33398
|
space_id: config?.spaceId ?? "",
|
|
@@ -33026,189 +33404,159 @@ function debugFields(config) {
|
|
|
33026
33404
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
33027
33405
|
};
|
|
33028
33406
|
}
|
|
33029
|
-
function
|
|
33030
|
-
const [
|
|
33031
|
-
const [
|
|
33032
|
-
const [
|
|
33033
|
-
const [
|
|
33034
|
-
|
|
33035
|
-
|
|
33036
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33037
|
-
useEffect22(() => {
|
|
33038
|
-
readCredentials().then((cfg) => {
|
|
33407
|
+
function ProjectConfigScreen({ onDone }) {
|
|
33408
|
+
const [config, setConfig] = useState31(null);
|
|
33409
|
+
const [saving, setSaving] = useState31(false);
|
|
33410
|
+
const [notice, setNotice] = useState31(null);
|
|
33411
|
+
const [lastSaved, setLastSaved] = useState31(null);
|
|
33412
|
+
useEffect23(() => {
|
|
33413
|
+
void readCredentials().then((cfg) => {
|
|
33039
33414
|
setConfig(cfg);
|
|
33040
|
-
setStage("form");
|
|
33041
33415
|
startDebugRun({
|
|
33042
33416
|
flow: "settings/contentful-configuration",
|
|
33043
33417
|
step: "01-configuration",
|
|
33044
|
-
menuOption: "Configuration",
|
|
33418
|
+
menuOption: "Configuration > Project",
|
|
33045
33419
|
inputs: debugFields(cfg)
|
|
33046
33420
|
});
|
|
33047
33421
|
});
|
|
33048
33422
|
}, []);
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
setConfig({ ...config, [field]: value });
|
|
33056
|
-
setNotice(null);
|
|
33423
|
+
if (!config) {
|
|
33424
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33425
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Project" }),
|
|
33426
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33427
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
33428
|
+
] });
|
|
33057
33429
|
}
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
setStage("saving");
|
|
33430
|
+
const save = () => {
|
|
33431
|
+
setSaving(true);
|
|
33061
33432
|
setNotice(null);
|
|
33062
33433
|
writeCredentials(config).then(() => {
|
|
33063
33434
|
setLastSaved(config);
|
|
33064
33435
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
33065
|
-
setNotice({ kind: "success", text: "
|
|
33066
|
-
setStage("form");
|
|
33436
|
+
setNotice({ kind: "success", text: "Project settings saved" });
|
|
33067
33437
|
}).catch((err) => {
|
|
33068
33438
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
33069
|
-
|
|
33070
|
-
|
|
33071
|
-
|
|
33072
|
-
function quit() {
|
|
33439
|
+
}).finally(() => setSaving(false));
|
|
33440
|
+
};
|
|
33441
|
+
const quit = () => {
|
|
33073
33442
|
void finishDebugRun(
|
|
33074
33443
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
33075
33444
|
);
|
|
33076
33445
|
onDone();
|
|
33077
|
-
}
|
|
33078
|
-
|
|
33079
|
-
|
|
33080
|
-
|
|
33081
|
-
|
|
33082
|
-
|
|
33083
|
-
|
|
33084
|
-
|
|
33085
|
-
|
|
33086
|
-
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
|
|
33091
|
-
|
|
33092
|
-
|
|
33093
|
-
return;
|
|
33094
|
-
}
|
|
33095
|
-
if (input === "c") {
|
|
33096
|
-
setFieldValue(activeField, "");
|
|
33097
|
-
return;
|
|
33446
|
+
};
|
|
33447
|
+
return /* @__PURE__ */ jsx57(
|
|
33448
|
+
FieldForm,
|
|
33449
|
+
{
|
|
33450
|
+
title: "Project",
|
|
33451
|
+
subtitle: "The Contentful space and where the CLI keeps its files.",
|
|
33452
|
+
fields: FIELDS2,
|
|
33453
|
+
values: valuesOf(config),
|
|
33454
|
+
onChange: (key, value) => {
|
|
33455
|
+
setConfig({ ...config, [key]: value });
|
|
33456
|
+
setNotice(null);
|
|
33457
|
+
},
|
|
33458
|
+
onSave: save,
|
|
33459
|
+
onQuit: quit,
|
|
33460
|
+
notice,
|
|
33461
|
+
busy: saving
|
|
33098
33462
|
}
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
|
|
33463
|
+
);
|
|
33464
|
+
}
|
|
33465
|
+
var FIELDS2, valuesOf;
|
|
33466
|
+
var init_ProjectConfigScreen = __esm({
|
|
33467
|
+
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx"() {
|
|
33468
|
+
"use strict";
|
|
33469
|
+
init_home_theme();
|
|
33470
|
+
init_debug_store();
|
|
33471
|
+
init_FieldForm();
|
|
33472
|
+
init_config_store();
|
|
33473
|
+
FIELDS2 = [
|
|
33474
|
+
{ key: "spaceId", label: "Space ID" },
|
|
33475
|
+
{ key: "environmentId", label: "Environment ID" },
|
|
33476
|
+
{ key: "cmaToken", label: "CMA Token", masked: true },
|
|
33477
|
+
{ key: "host", label: "API Host" },
|
|
33478
|
+
{ key: "defaultComponentDir", label: "Default component directory" },
|
|
33479
|
+
{ key: "defaultTokenFile", label: "Default token file" },
|
|
33480
|
+
{ key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
|
|
33481
|
+
];
|
|
33482
|
+
valuesOf = (config) => Object.fromEntries(FIELDS2.map(({ key }) => [key, config[key] || ""]));
|
|
33483
|
+
}
|
|
33484
|
+
});
|
|
33485
|
+
|
|
33486
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
33487
|
+
import { useState as useState32 } from "react";
|
|
33488
|
+
import { Box as Box47, Text as Text49, useInput as useInput13 } from "ink";
|
|
33489
|
+
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33490
|
+
function ConfigurationScreen({ onDone }) {
|
|
33491
|
+
const [focus, setFocus] = useState32(0);
|
|
33492
|
+
const [open, setOpen] = useState32(null);
|
|
33493
|
+
const close = () => setOpen(null);
|
|
33494
|
+
useInput13((input, key) => {
|
|
33495
|
+
if (open) return;
|
|
33496
|
+
if (key.upArrow) {
|
|
33497
|
+
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
33102
33498
|
return;
|
|
33103
33499
|
}
|
|
33104
|
-
if (key.
|
|
33105
|
-
|
|
33106
|
-
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
33500
|
+
if (key.downArrow || key.tab) {
|
|
33501
|
+
setFocus((i) => (i + 1) % SECTIONS.length);
|
|
33107
33502
|
return;
|
|
33108
33503
|
}
|
|
33109
33504
|
if (key.return) {
|
|
33110
|
-
|
|
33111
|
-
|
|
33505
|
+
setOpen(SECTIONS[focus].id);
|
|
33506
|
+
return;
|
|
33112
33507
|
}
|
|
33508
|
+
if (key.escape || input === "q") onDone();
|
|
33113
33509
|
});
|
|
33114
|
-
if (
|
|
33115
|
-
|
|
33116
|
-
|
|
33117
|
-
|
|
33118
|
-
|
|
33119
|
-
|
|
33120
|
-
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
|
|
33124
|
-
/* @__PURE__ */
|
|
33125
|
-
|
|
33126
|
-
const value = fieldValue(field);
|
|
33127
|
-
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
33128
|
-
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33129
|
-
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33130
|
-
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
33131
|
-
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33132
|
-
TextInput4,
|
|
33133
|
-
{
|
|
33134
|
-
value,
|
|
33135
|
-
onChange: (next) => setFieldValue(field, next),
|
|
33136
|
-
onSubmit: () => setEditing(false),
|
|
33137
|
-
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
33138
|
-
}
|
|
33139
|
-
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33140
|
-
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
33141
|
-
] }, field);
|
|
33142
|
-
}) }),
|
|
33143
|
-
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33144
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33145
|
-
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33146
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33147
|
-
" ",
|
|
33148
|
-
notice.text
|
|
33149
|
-
] })
|
|
33150
|
-
] }),
|
|
33151
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33152
|
-
/* @__PURE__ */ jsx55(
|
|
33510
|
+
if (open === "project") return /* @__PURE__ */ jsx58(ProjectConfigScreen, { onDone: close });
|
|
33511
|
+
if (open === "agents") return /* @__PURE__ */ jsx58(AgentsScreen, { onDone: close });
|
|
33512
|
+
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33513
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Configuration" }),
|
|
33514
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33515
|
+
SECTIONS.map((section, index) => /* @__PURE__ */ jsxs48(Box47, { gap: 1, children: [
|
|
33516
|
+
/* @__PURE__ */ jsx58(Text49, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
|
|
33517
|
+
/* @__PURE__ */ jsx58(Box47, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
|
|
33518
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: section.description })
|
|
33519
|
+
] }, section.id)),
|
|
33520
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33521
|
+
/* @__PURE__ */ jsx58(
|
|
33153
33522
|
ControlHints,
|
|
33154
33523
|
{
|
|
33155
|
-
hints:
|
|
33156
|
-
{ keys: "type", label: "edit" },
|
|
33157
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33158
|
-
{ keys: "\u23CE", label: "done" },
|
|
33159
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33160
|
-
] : [
|
|
33524
|
+
hints: [
|
|
33161
33525
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
33162
|
-
{ keys: "\u23CE", label: "
|
|
33163
|
-
{ keys: "
|
|
33164
|
-
{ keys: "s", label: "save" },
|
|
33165
|
-
{ keys: "Esc/q", label: "quit without saving" }
|
|
33526
|
+
{ keys: "\u23CE", label: "open" },
|
|
33527
|
+
{ keys: "Esc/q", label: "back" }
|
|
33166
33528
|
]
|
|
33167
33529
|
}
|
|
33168
33530
|
)
|
|
33169
33531
|
] });
|
|
33170
33532
|
}
|
|
33171
|
-
var
|
|
33533
|
+
var SECTIONS;
|
|
33172
33534
|
var init_ContentfulConfigScreen = __esm({
|
|
33173
33535
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
33174
33536
|
"use strict";
|
|
33175
33537
|
init_home_theme();
|
|
33176
|
-
init_config_store();
|
|
33177
|
-
init_debug_store();
|
|
33178
33538
|
init_control_hints();
|
|
33179
|
-
|
|
33180
|
-
|
|
33181
|
-
|
|
33182
|
-
|
|
33183
|
-
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
33539
|
+
init_AgentScreens();
|
|
33540
|
+
init_ProjectConfigScreen();
|
|
33541
|
+
SECTIONS = [
|
|
33542
|
+
{
|
|
33543
|
+
id: "project",
|
|
33544
|
+
label: "Project",
|
|
33545
|
+
description: "Contentful space, credentials, defaults and where .contentful goes"
|
|
33546
|
+
},
|
|
33547
|
+
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
33187
33548
|
];
|
|
33188
|
-
FIELD_LABELS = {
|
|
33189
|
-
spaceId: "Space ID",
|
|
33190
|
-
environmentId: "Environment ID",
|
|
33191
|
-
cmaToken: "CMA Token",
|
|
33192
|
-
host: "API Host",
|
|
33193
|
-
defaultComponentDir: "Default component directory",
|
|
33194
|
-
defaultTokenFile: "Default token file",
|
|
33195
|
-
contentfulBaseDir: "Root Project Directory"
|
|
33196
|
-
};
|
|
33197
|
-
FIELD_HINTS = {
|
|
33198
|
-
contentfulBaseDir: "(where .contentful goes)"
|
|
33199
|
-
};
|
|
33200
|
-
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
33201
33549
|
}
|
|
33202
33550
|
});
|
|
33203
33551
|
|
|
33204
33552
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33205
|
-
import { useEffect as
|
|
33206
|
-
import { Box as
|
|
33207
|
-
import { Fragment as
|
|
33553
|
+
import { useEffect as useEffect24, useState as useState33 } from "react";
|
|
33554
|
+
import { Box as Box48, Text as Text50, useInput as useInput14 } from "ink";
|
|
33555
|
+
import { Fragment as Fragment19, jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33208
33556
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33209
|
-
const [loading, setLoading] =
|
|
33210
|
-
const [enabled, setEnabled] =
|
|
33211
|
-
|
|
33557
|
+
const [loading, setLoading] = useState33(true);
|
|
33558
|
+
const [enabled, setEnabled] = useState33(true);
|
|
33559
|
+
useEffect24(() => {
|
|
33212
33560
|
readAnalyticsSetting().then((setting) => {
|
|
33213
33561
|
setEnabled(setting.enabled);
|
|
33214
33562
|
setLoading(false);
|
|
@@ -33220,7 +33568,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33220
33568
|
});
|
|
33221
33569
|
});
|
|
33222
33570
|
}, []);
|
|
33223
|
-
|
|
33571
|
+
useInput14((input, key) => {
|
|
33224
33572
|
if (loading) return;
|
|
33225
33573
|
if (key.return || input === " ") {
|
|
33226
33574
|
setEnabled((current) => {
|
|
@@ -33235,21 +33583,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33235
33583
|
onDone();
|
|
33236
33584
|
}
|
|
33237
33585
|
});
|
|
33238
|
-
return /* @__PURE__ */
|
|
33239
|
-
/* @__PURE__ */
|
|
33240
|
-
/* @__PURE__ */
|
|
33241
|
-
loading ? /* @__PURE__ */
|
|
33242
|
-
/* @__PURE__ */
|
|
33586
|
+
return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33587
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33588
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33589
|
+
loading ? /* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs49(Fragment19, { children: [
|
|
33590
|
+
/* @__PURE__ */ jsxs49(Text50, { children: [
|
|
33243
33591
|
"Share anonymous usage data:",
|
|
33244
33592
|
" ",
|
|
33245
|
-
/* @__PURE__ */
|
|
33593
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33246
33594
|
] }),
|
|
33247
|
-
/* @__PURE__ */
|
|
33248
|
-
/* @__PURE__ */
|
|
33249
|
-
/* @__PURE__ */
|
|
33595
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33596
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
33597
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
33250
33598
|
] }),
|
|
33251
|
-
/* @__PURE__ */
|
|
33252
|
-
/* @__PURE__ */
|
|
33599
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33600
|
+
/* @__PURE__ */ jsx59(
|
|
33253
33601
|
ControlHints,
|
|
33254
33602
|
{
|
|
33255
33603
|
hints: [
|
|
@@ -33271,12 +33619,12 @@ var init_screen11 = __esm({
|
|
|
33271
33619
|
});
|
|
33272
33620
|
|
|
33273
33621
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
33274
|
-
import { useEffect as
|
|
33275
|
-
import { Box as
|
|
33276
|
-
import { jsx as
|
|
33622
|
+
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
33623
|
+
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
33624
|
+
import { jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
33277
33625
|
function UpgradeScreen({ onDone }) {
|
|
33278
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
33279
|
-
|
|
33626
|
+
const [upgradeCheck, setUpgradeCheck] = useState34();
|
|
33627
|
+
useEffect25(() => {
|
|
33280
33628
|
startDebugRun({
|
|
33281
33629
|
flow: "upgrade",
|
|
33282
33630
|
step: "01-upgrade",
|
|
@@ -33285,7 +33633,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
33285
33633
|
});
|
|
33286
33634
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
33287
33635
|
}, []);
|
|
33288
|
-
|
|
33636
|
+
useInput15((_input, key) => {
|
|
33289
33637
|
if (key.return) {
|
|
33290
33638
|
void finishDebugRun({
|
|
33291
33639
|
outputs: upgradeCheck ?? {},
|
|
@@ -33296,12 +33644,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
33296
33644
|
return;
|
|
33297
33645
|
}
|
|
33298
33646
|
});
|
|
33299
|
-
return /* @__PURE__ */
|
|
33300
|
-
/* @__PURE__ */
|
|
33301
|
-
/* @__PURE__ */
|
|
33647
|
+
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33648
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, children: "Upgrade" }),
|
|
33649
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33302
33650
|
renderBody(upgradeCheck),
|
|
33303
|
-
/* @__PURE__ */
|
|
33304
|
-
/* @__PURE__ */
|
|
33651
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33652
|
+
/* @__PURE__ */ jsxs50(Text51, { bold: true, color: PALETTE.accent, children: [
|
|
33305
33653
|
FOCUS_MARKER,
|
|
33306
33654
|
" Go Back"
|
|
33307
33655
|
] })
|
|
@@ -33309,34 +33657,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
33309
33657
|
}
|
|
33310
33658
|
function renderBody(upgradeCheck) {
|
|
33311
33659
|
if (!upgradeCheck) {
|
|
33312
|
-
return /* @__PURE__ */
|
|
33660
|
+
return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
33313
33661
|
}
|
|
33314
33662
|
if (upgradeCheck.status === "error") {
|
|
33315
|
-
return /* @__PURE__ */
|
|
33663
|
+
return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
33316
33664
|
}
|
|
33317
33665
|
if (upgradeCheck.status === "up-to-date") {
|
|
33318
|
-
return /* @__PURE__ */
|
|
33666
|
+
return /* @__PURE__ */ jsxs50(Text51, { color: PALETTE.success, children: [
|
|
33319
33667
|
"You're already on the latest version (v",
|
|
33320
33668
|
upgradeCheck.current,
|
|
33321
33669
|
")."
|
|
33322
33670
|
] });
|
|
33323
33671
|
}
|
|
33324
|
-
return /* @__PURE__ */
|
|
33325
|
-
/* @__PURE__ */
|
|
33326
|
-
/* @__PURE__ */
|
|
33672
|
+
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", children: [
|
|
33673
|
+
/* @__PURE__ */ jsxs50(Text51, { color: PALETTE.muted, children: [
|
|
33674
|
+
/* @__PURE__ */ jsxs50(Text51, { bold: true, color: PALETTE.success, children: [
|
|
33327
33675
|
"v",
|
|
33328
33676
|
upgradeCheck.latest
|
|
33329
33677
|
] }),
|
|
33330
33678
|
" ",
|
|
33331
33679
|
"is available (you're on ",
|
|
33332
|
-
/* @__PURE__ */
|
|
33680
|
+
/* @__PURE__ */ jsxs50(Text51, { bold: true, children: [
|
|
33333
33681
|
"v",
|
|
33334
33682
|
upgradeCheck.current
|
|
33335
33683
|
] }),
|
|
33336
33684
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
33337
33685
|
] }),
|
|
33338
|
-
/* @__PURE__ */
|
|
33339
|
-
/* @__PURE__ */
|
|
33686
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33687
|
+
/* @__PURE__ */ jsx60(Box49, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx60(Text51, { bold: true, children: cmd }, cmd)) })
|
|
33340
33688
|
] });
|
|
33341
33689
|
}
|
|
33342
33690
|
var UPGRADE_COMMANDS;
|
|
@@ -33351,13 +33699,13 @@ var init_PageContainer4 = __esm({
|
|
|
33351
33699
|
});
|
|
33352
33700
|
|
|
33353
33701
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
33354
|
-
import { useEffect as
|
|
33355
|
-
import { Box as
|
|
33356
|
-
import { jsx as
|
|
33702
|
+
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
33703
|
+
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
33704
|
+
import { jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
33357
33705
|
function DebugModeScreen({ onDone }) {
|
|
33358
|
-
const [loading, setLoading] =
|
|
33359
|
-
const [enabled, setEnabled] =
|
|
33360
|
-
|
|
33706
|
+
const [loading, setLoading] = useState35(true);
|
|
33707
|
+
const [enabled, setEnabled] = useState35(true);
|
|
33708
|
+
useEffect26(() => {
|
|
33361
33709
|
readDebugModeSetting().then((setting) => {
|
|
33362
33710
|
setEnabled(setting.enabled);
|
|
33363
33711
|
setLoading(false);
|
|
@@ -33369,7 +33717,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
33369
33717
|
});
|
|
33370
33718
|
});
|
|
33371
33719
|
}, []);
|
|
33372
|
-
|
|
33720
|
+
useInput16((input, key) => {
|
|
33373
33721
|
if (loading) return;
|
|
33374
33722
|
if (key.return || input === " ") {
|
|
33375
33723
|
setEnabled((current) => {
|
|
@@ -33384,16 +33732,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
33384
33732
|
onDone();
|
|
33385
33733
|
}
|
|
33386
33734
|
});
|
|
33387
|
-
return /* @__PURE__ */
|
|
33388
|
-
/* @__PURE__ */
|
|
33389
|
-
/* @__PURE__ */
|
|
33390
|
-
loading ? /* @__PURE__ */
|
|
33735
|
+
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33736
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
33737
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33738
|
+
loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs51(Text52, { children: [
|
|
33391
33739
|
"Debug logging:",
|
|
33392
33740
|
" ",
|
|
33393
|
-
/* @__PURE__ */
|
|
33741
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33394
33742
|
] }),
|
|
33395
|
-
/* @__PURE__ */
|
|
33396
|
-
/* @__PURE__ */
|
|
33743
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33744
|
+
/* @__PURE__ */ jsx61(
|
|
33397
33745
|
ControlHints,
|
|
33398
33746
|
{
|
|
33399
33747
|
hints: [
|
|
@@ -33419,20 +33767,20 @@ var app_exports = {};
|
|
|
33419
33767
|
__export(app_exports, {
|
|
33420
33768
|
runApp: () => runApp
|
|
33421
33769
|
});
|
|
33422
|
-
import { join as
|
|
33423
|
-
import { useEffect as
|
|
33424
|
-
import { Fragment as
|
|
33770
|
+
import { join as join28 } from "node:path";
|
|
33771
|
+
import { useEffect as useEffect27, useState as useState36 } from "react";
|
|
33772
|
+
import { Fragment as Fragment20, jsx as jsx62 } from "react/jsx-runtime";
|
|
33425
33773
|
function App({ importOptions, inkClear }) {
|
|
33426
|
-
const [screen, setScreen] =
|
|
33427
|
-
const [importExitCode, setImportExitCode] =
|
|
33774
|
+
const [screen, setScreen] = useState36("start");
|
|
33775
|
+
const [importExitCode, setImportExitCode] = useState36();
|
|
33428
33776
|
const showImportResult = importExitCode !== void 0;
|
|
33429
|
-
const [projectPath, setProjectPath] =
|
|
33430
|
-
const [tokensPath, setTokensPath] =
|
|
33431
|
-
const [scannedFiles, setScannedFiles] =
|
|
33432
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
33433
|
-
const [extractionRun, setExtractionRun] =
|
|
33777
|
+
const [projectPath, setProjectPath] = useState36();
|
|
33778
|
+
const [tokensPath, setTokensPath] = useState36();
|
|
33779
|
+
const [scannedFiles, setScannedFiles] = useState36();
|
|
33780
|
+
const [pendingLaunch, setPendingLaunch] = useState36();
|
|
33781
|
+
const [extractionRun, setExtractionRun] = useState36();
|
|
33434
33782
|
const extraction = useExtraction(extractionRun?.input);
|
|
33435
|
-
const [scopeRun, setScopeRun] =
|
|
33783
|
+
const [scopeRun, setScopeRun] = useState36();
|
|
33436
33784
|
const scopeFlow = useScopeGateFlow(
|
|
33437
33785
|
scopeRun && {
|
|
33438
33786
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -33447,12 +33795,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33447
33795
|
}
|
|
33448
33796
|
}
|
|
33449
33797
|
);
|
|
33450
|
-
const [generationInput, setGenerationInput] =
|
|
33798
|
+
const [generationInput, setGenerationInput] = useState36();
|
|
33451
33799
|
const generation = useGeneration(generationInput);
|
|
33452
|
-
const [flowStart, setFlowStart] =
|
|
33800
|
+
const [flowStart, setFlowStart] = useState36();
|
|
33453
33801
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
33454
|
-
const [importDefaults, setImportDefaults] =
|
|
33455
|
-
|
|
33802
|
+
const [importDefaults, setImportDefaults] = useState36();
|
|
33803
|
+
useEffect27(() => {
|
|
33456
33804
|
if (screen !== "import") {
|
|
33457
33805
|
setImportDefaults(void 0);
|
|
33458
33806
|
return;
|
|
@@ -33470,7 +33818,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33470
33818
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
33471
33819
|
const state2 = await inspectTokens({
|
|
33472
33820
|
rawTokensPath: tokens,
|
|
33473
|
-
contentfulDir:
|
|
33821
|
+
contentfulDir: join28(resolveUserPath(projectPath2), ".contentful"),
|
|
33474
33822
|
cache: importOptions.cache
|
|
33475
33823
|
});
|
|
33476
33824
|
if (state2.kind === "cached") {
|
|
@@ -33512,12 +33860,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33512
33860
|
}
|
|
33513
33861
|
});
|
|
33514
33862
|
};
|
|
33515
|
-
|
|
33863
|
+
useEffect27(() => {
|
|
33516
33864
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
33517
33865
|
setExtractionRun(void 0);
|
|
33518
33866
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
33519
33867
|
}, [extraction, extractionRun]);
|
|
33520
|
-
|
|
33868
|
+
useEffect27(() => {
|
|
33521
33869
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
33522
33870
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33523
33871
|
setGenerationInput({
|
|
@@ -33535,7 +33883,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33535
33883
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
33536
33884
|
});
|
|
33537
33885
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
33538
|
-
|
|
33886
|
+
useEffect27(() => {
|
|
33539
33887
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
33540
33888
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33541
33889
|
inkClear();
|
|
@@ -33578,9 +33926,9 @@ function App({ importOptions, inkClear }) {
|
|
|
33578
33926
|
};
|
|
33579
33927
|
switch (screen) {
|
|
33580
33928
|
case "import":
|
|
33581
|
-
if (showImportResult) return /* @__PURE__ */
|
|
33929
|
+
if (showImportResult) return /* @__PURE__ */ jsx62(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
33582
33930
|
if (flow && flowStart) {
|
|
33583
|
-
return /* @__PURE__ */
|
|
33931
|
+
return /* @__PURE__ */ jsx62(
|
|
33584
33932
|
FlowScreen,
|
|
33585
33933
|
{
|
|
33586
33934
|
state: flow.state,
|
|
@@ -33590,12 +33938,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33590
33938
|
}
|
|
33591
33939
|
);
|
|
33592
33940
|
}
|
|
33593
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
33941
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33594
33942
|
if (projectPath === void 0) {
|
|
33595
|
-
return /* @__PURE__ */
|
|
33943
|
+
return /* @__PURE__ */ jsx62(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
33596
33944
|
}
|
|
33597
33945
|
if (tokensPath === void 0) {
|
|
33598
|
-
return /* @__PURE__ */
|
|
33946
|
+
return /* @__PURE__ */ jsx62(
|
|
33599
33947
|
TokenInputScreen,
|
|
33600
33948
|
{
|
|
33601
33949
|
initialPath: importDefaults.tokenFile,
|
|
@@ -33605,7 +33953,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33605
33953
|
);
|
|
33606
33954
|
}
|
|
33607
33955
|
if (scannedFiles === void 0) {
|
|
33608
|
-
return /* @__PURE__ */
|
|
33956
|
+
return /* @__PURE__ */ jsx62(
|
|
33609
33957
|
PathValidationScreen,
|
|
33610
33958
|
{
|
|
33611
33959
|
projectPath,
|
|
@@ -33617,10 +33965,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33617
33965
|
}
|
|
33618
33966
|
if (extractionRun) {
|
|
33619
33967
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
33620
|
-
return /* @__PURE__ */
|
|
33968
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
33621
33969
|
}
|
|
33622
33970
|
if (extraction?.status === "running") {
|
|
33623
|
-
return /* @__PURE__ */
|
|
33971
|
+
return /* @__PURE__ */ jsx62(
|
|
33624
33972
|
ExtractionScreen,
|
|
33625
33973
|
{
|
|
33626
33974
|
progress: extraction.progress,
|
|
@@ -33629,14 +33977,14 @@ function App({ importOptions, inkClear }) {
|
|
|
33629
33977
|
}
|
|
33630
33978
|
);
|
|
33631
33979
|
}
|
|
33632
|
-
return /* @__PURE__ */
|
|
33980
|
+
return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33633
33981
|
}
|
|
33634
33982
|
if (scopeRun && scopeFlow) {
|
|
33635
33983
|
if (scopeFlow.status === "failed") {
|
|
33636
|
-
return /* @__PURE__ */
|
|
33984
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
33637
33985
|
}
|
|
33638
33986
|
if (scopeFlow.status === "deciding") {
|
|
33639
|
-
return /* @__PURE__ */
|
|
33987
|
+
return /* @__PURE__ */ jsx62(
|
|
33640
33988
|
ScopeGateScreen,
|
|
33641
33989
|
{
|
|
33642
33990
|
components: scopeFlow.load.components,
|
|
@@ -33646,7 +33994,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33646
33994
|
);
|
|
33647
33995
|
}
|
|
33648
33996
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
33649
|
-
return /* @__PURE__ */
|
|
33997
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
33650
33998
|
}
|
|
33651
33999
|
if (generation?.status === "running") {
|
|
33652
34000
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -33654,7 +34002,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33654
34002
|
hasRawTokens,
|
|
33655
34003
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
33656
34004
|
});
|
|
33657
|
-
return /* @__PURE__ */
|
|
34005
|
+
return /* @__PURE__ */ jsx62(
|
|
33658
34006
|
GenerationScreen,
|
|
33659
34007
|
{
|
|
33660
34008
|
progress: generation.progress,
|
|
@@ -33666,10 +34014,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33666
34014
|
}
|
|
33667
34015
|
);
|
|
33668
34016
|
}
|
|
33669
|
-
return /* @__PURE__ */
|
|
34017
|
+
return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33670
34018
|
}
|
|
33671
34019
|
if (pendingLaunch?.cached) {
|
|
33672
|
-
return /* @__PURE__ */
|
|
34020
|
+
return /* @__PURE__ */ jsx62(
|
|
33673
34021
|
TokenReuseScreen,
|
|
33674
34022
|
{
|
|
33675
34023
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -33680,7 +34028,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33680
34028
|
}
|
|
33681
34029
|
);
|
|
33682
34030
|
}
|
|
33683
|
-
return /* @__PURE__ */
|
|
34031
|
+
return /* @__PURE__ */ jsx62(
|
|
33684
34032
|
CredentialsScreen,
|
|
33685
34033
|
{
|
|
33686
34034
|
initial: importDefaults.credentials,
|
|
@@ -33689,19 +34037,19 @@ function App({ importOptions, inkClear }) {
|
|
|
33689
34037
|
}
|
|
33690
34038
|
);
|
|
33691
34039
|
case "help":
|
|
33692
|
-
return /* @__PURE__ */
|
|
34040
|
+
return /* @__PURE__ */ jsx62(HelpScreen, { onDone: goToStart });
|
|
33693
34041
|
case "upgrade":
|
|
33694
|
-
return /* @__PURE__ */
|
|
34042
|
+
return /* @__PURE__ */ jsx62(UpgradeScreen, { onDone: goToStart });
|
|
33695
34043
|
case "settings":
|
|
33696
|
-
return /* @__PURE__ */
|
|
34044
|
+
return /* @__PURE__ */ jsx62(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
33697
34045
|
case "settings-configuration":
|
|
33698
|
-
return /* @__PURE__ */
|
|
34046
|
+
return /* @__PURE__ */ jsx62(ConfigurationScreen, { onDone: goToSettings });
|
|
33699
34047
|
case "settings-opt-in-analytics":
|
|
33700
|
-
return /* @__PURE__ */
|
|
34048
|
+
return /* @__PURE__ */ jsx62(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
33701
34049
|
case "settings-debug-mode":
|
|
33702
|
-
return /* @__PURE__ */
|
|
34050
|
+
return /* @__PURE__ */ jsx62(DebugModeScreen, { onDone: goToSettings });
|
|
33703
34051
|
case "start":
|
|
33704
|
-
return /* @__PURE__ */
|
|
34052
|
+
return /* @__PURE__ */ jsx62(HomeScreen, { onNavigate: setScreen });
|
|
33705
34053
|
}
|
|
33706
34054
|
}
|
|
33707
34055
|
async function runApp(renderApp, importOptions) {
|
|
@@ -33709,7 +34057,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
33709
34057
|
instance.clear?.();
|
|
33710
34058
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
33711
34059
|
};
|
|
33712
|
-
const instance = renderApp(/* @__PURE__ */
|
|
34060
|
+
const instance = renderApp(/* @__PURE__ */ jsx62(App, { importOptions, inkClear }));
|
|
33713
34061
|
await instance.waitUntilExit();
|
|
33714
34062
|
}
|
|
33715
34063
|
var init_app = __esm({
|
|
@@ -33744,7 +34092,7 @@ var init_app = __esm({
|
|
|
33744
34092
|
// packages/experience-design-system-cli/program.ts
|
|
33745
34093
|
init_src4();
|
|
33746
34094
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
33747
|
-
import { join as
|
|
34095
|
+
import { join as join29 } from "node:path";
|
|
33748
34096
|
import { Command } from "commander";
|
|
33749
34097
|
|
|
33750
34098
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
@@ -33848,14 +34196,14 @@ function runDevWatch(args) {
|
|
|
33848
34196
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33849
34197
|
return Promise.resolve(1);
|
|
33850
34198
|
}
|
|
33851
|
-
return new Promise((
|
|
34199
|
+
return new Promise((resolve28) => {
|
|
33852
34200
|
const child = spawn4(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33853
34201
|
process.on("SIGINT", () => void 0);
|
|
33854
|
-
child.on("exit", (code) =>
|
|
34202
|
+
child.on("exit", (code) => resolve28(code ?? 0));
|
|
33855
34203
|
child.on("error", (err) => {
|
|
33856
34204
|
process.stderr.write(`${err.message}
|
|
33857
34205
|
`);
|
|
33858
|
-
|
|
34206
|
+
resolve28(1);
|
|
33859
34207
|
});
|
|
33860
34208
|
});
|
|
33861
34209
|
}
|
|
@@ -33881,7 +34229,7 @@ init_analytics_store();
|
|
|
33881
34229
|
init_package_root();
|
|
33882
34230
|
var pkg = JSON.parse(
|
|
33883
34231
|
readFileSync9(
|
|
33884
|
-
|
|
34232
|
+
join29(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
33885
34233
|
"utf8"
|
|
33886
34234
|
)
|
|
33887
34235
|
);
|
|
@@ -33922,7 +34270,7 @@ init_config();
|
|
|
33922
34270
|
init_package_root();
|
|
33923
34271
|
import { existsSync as existsSync12 } from "node:fs";
|
|
33924
34272
|
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
33925
|
-
import { dirname as dirname16, join as
|
|
34273
|
+
import { dirname as dirname16, join as join30 } from "node:path";
|
|
33926
34274
|
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
33927
34275
|
async function readJson(path5) {
|
|
33928
34276
|
try {
|
|
@@ -33933,9 +34281,9 @@ async function readJson(path5) {
|
|
|
33933
34281
|
}
|
|
33934
34282
|
async function migrateOldConfig() {
|
|
33935
34283
|
try {
|
|
33936
|
-
const oldCredentials =
|
|
33937
|
-
const oldRuns =
|
|
33938
|
-
const oldDebugMode =
|
|
34284
|
+
const oldCredentials = join30(oldConfigDir2(), "credentials.json");
|
|
34285
|
+
const oldRuns = join30(oldConfigDir2(), "runs.json");
|
|
34286
|
+
const oldDebugMode = join30(
|
|
33939
34287
|
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
33940
34288
|
".contentful",
|
|
33941
34289
|
"config",
|