@contentful/experience-design-system-cli 2.37.1-dev-build-2ed60464.0 → 2.37.1-dev-build-fc847476.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 +587 -243
- package/dist/index.js +634 -256
- package/dist/package.json +1 -1
- package/dist/src/tui/help/file-locations.d.ts +23 -0
- package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +2 -0
- package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +2 -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`);
|
|
@@ -16270,6 +16270,33 @@ var init_tracker = __esm({
|
|
|
16270
16270
|
});
|
|
16271
16271
|
|
|
16272
16272
|
// packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js
|
|
16273
|
+
function countWriteResult(items, entityType) {
|
|
16274
|
+
const subset = items.filter((item) => item.entityType === entityType);
|
|
16275
|
+
return {
|
|
16276
|
+
created_count: subset.filter((item) => item.action === "create" && item.status === "succeeded").length,
|
|
16277
|
+
updated_count: subset.filter((item) => item.action === "update" && item.status === "succeeded").length,
|
|
16278
|
+
failed_count: subset.filter((item) => item.status === "failed").length
|
|
16279
|
+
};
|
|
16280
|
+
}
|
|
16281
|
+
function recordApplyOutcome(client2, spaceId, environmentId, operation) {
|
|
16282
|
+
setCommandContext({
|
|
16283
|
+
space_key: spaceId,
|
|
16284
|
+
environment_key: environmentId,
|
|
16285
|
+
x_contentful_request_id: client2.getLastRequestId()
|
|
16286
|
+
});
|
|
16287
|
+
enrichCommandResult({
|
|
16288
|
+
dsi_operation_id: operation.sys.id,
|
|
16289
|
+
component_type_result: countWriteResult(operation.items ?? [], "ComponentType"),
|
|
16290
|
+
design_token_result: countWriteResult(operation.items ?? [], "DesignToken")
|
|
16291
|
+
});
|
|
16292
|
+
}
|
|
16293
|
+
function recordContentfulContext(client2, spaceId, environmentId) {
|
|
16294
|
+
setCommandContext({
|
|
16295
|
+
space_key: spaceId,
|
|
16296
|
+
environment_key: environmentId,
|
|
16297
|
+
x_contentful_request_id: client2.getLastRequestId()
|
|
16298
|
+
});
|
|
16299
|
+
}
|
|
16273
16300
|
var init_apply2 = __esm({
|
|
16274
16301
|
"packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js"() {
|
|
16275
16302
|
"use strict";
|
|
@@ -18500,7 +18527,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18500
18527
|
const message = error instanceof Error ? error.message : String(error);
|
|
18501
18528
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18502
18529
|
throw error;
|
|
18503
|
-
await new Promise((
|
|
18530
|
+
await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
|
|
18504
18531
|
}
|
|
18505
18532
|
}
|
|
18506
18533
|
}
|
|
@@ -31807,6 +31834,7 @@ function clearedValidationErrorState() {
|
|
|
31807
31834
|
}
|
|
31808
31835
|
async function runPreview(input, deps) {
|
|
31809
31836
|
if (shouldBypassPreview(input.state)) return buildSkippedPreviewTransition();
|
|
31837
|
+
setCommandContext({ space_key: input.spaceId, environment_key: input.environmentId });
|
|
31810
31838
|
try {
|
|
31811
31839
|
const client2 = deps.createClient({
|
|
31812
31840
|
cmaToken: input.cmaToken,
|
|
@@ -31855,6 +31883,7 @@ async function runPreview(input, deps) {
|
|
|
31855
31883
|
db.close();
|
|
31856
31884
|
}
|
|
31857
31885
|
}
|
|
31886
|
+
recordContentfulContext(client2, input.spaceId, input.environmentId);
|
|
31858
31887
|
if (isEmptyPreview(preview)) {
|
|
31859
31888
|
return {
|
|
31860
31889
|
step: "done",
|
|
@@ -32025,6 +32054,7 @@ async function runPush(input, deps, onPatch) {
|
|
|
32025
32054
|
} catch (logErr) {
|
|
32026
32055
|
safeLog(deps, { pollLogError: String(logErr) });
|
|
32027
32056
|
}
|
|
32057
|
+
recordApplyOutcome(client2, input.spaceId, input.environmentId, operation);
|
|
32028
32058
|
const pushResult = resultOf(operation, preview);
|
|
32029
32059
|
const pushSucceeded = pushResult.componentTypes.failed === 0 && pushResult.designTokens.failed === 0 && operation.sys.status !== "failed";
|
|
32030
32060
|
if (pushSucceeded && input.state.lastRunId) {
|
|
@@ -32246,7 +32276,7 @@ var init_save = __esm({
|
|
|
32246
32276
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32247
32277
|
appendRun,
|
|
32248
32278
|
buildSourceFingerprint,
|
|
32249
|
-
sleep: (ms) => new Promise((
|
|
32279
|
+
sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
|
|
32250
32280
|
warn: (message) => process.stderr.write(message)
|
|
32251
32281
|
});
|
|
32252
32282
|
}
|
|
@@ -32797,13 +32827,48 @@ var init_debug_store = __esm({
|
|
|
32797
32827
|
}
|
|
32798
32828
|
});
|
|
32799
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
|
+
|
|
32800
32856
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32801
32857
|
async function readHelpInfo() {
|
|
32802
|
-
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
|
+
});
|
|
32803
32865
|
return {
|
|
32804
32866
|
storage: [
|
|
32805
32867
|
{ label: "Config folder", value: configRoot2() },
|
|
32806
|
-
{ 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 }
|
|
32807
32872
|
],
|
|
32808
32873
|
troubleshooting: [
|
|
32809
32874
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32824,6 +32889,7 @@ var init_help_info = __esm({
|
|
|
32824
32889
|
init_debug_store();
|
|
32825
32890
|
init_debug_mode_store();
|
|
32826
32891
|
init_version();
|
|
32892
|
+
init_file_locations();
|
|
32827
32893
|
}
|
|
32828
32894
|
});
|
|
32829
32895
|
|
|
@@ -32835,7 +32901,7 @@ function Section({ title, rows }) {
|
|
|
32835
32901
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
32836
32902
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
32837
32903
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
32838
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
32904
|
+
/* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
32839
32905
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
32840
32906
|
] }, row.label))
|
|
32841
32907
|
] });
|
|
@@ -32949,6 +33015,349 @@ var init_PageContainer3 = __esm({
|
|
|
32949
33015
|
}
|
|
32950
33016
|
});
|
|
32951
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
|
+
|
|
32952
33361
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
32953
33362
|
async function readCredentials() {
|
|
32954
33363
|
const store = await readV1Store();
|
|
@@ -32980,11 +33389,10 @@ var init_config_store = __esm({
|
|
|
32980
33389
|
}
|
|
32981
33390
|
});
|
|
32982
33391
|
|
|
32983
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/
|
|
32984
|
-
import { useEffect as
|
|
32985
|
-
import { Box as
|
|
32986
|
-
import
|
|
32987
|
-
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";
|
|
32988
33396
|
function debugFields(config) {
|
|
32989
33397
|
return {
|
|
32990
33398
|
space_id: config?.spaceId ?? "",
|
|
@@ -32996,189 +33404,159 @@ function debugFields(config) {
|
|
|
32996
33404
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
32997
33405
|
};
|
|
32998
33406
|
}
|
|
32999
|
-
function
|
|
33000
|
-
const [
|
|
33001
|
-
const [
|
|
33002
|
-
const [
|
|
33003
|
-
const [
|
|
33004
|
-
|
|
33005
|
-
|
|
33006
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33007
|
-
useEffect22(() => {
|
|
33008
|
-
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) => {
|
|
33009
33414
|
setConfig(cfg);
|
|
33010
|
-
setStage("form");
|
|
33011
33415
|
startDebugRun({
|
|
33012
33416
|
flow: "settings/contentful-configuration",
|
|
33013
33417
|
step: "01-configuration",
|
|
33014
|
-
menuOption: "Configuration",
|
|
33418
|
+
menuOption: "Configuration > Project",
|
|
33015
33419
|
inputs: debugFields(cfg)
|
|
33016
33420
|
});
|
|
33017
33421
|
});
|
|
33018
33422
|
}, []);
|
|
33019
|
-
|
|
33020
|
-
|
|
33021
|
-
|
|
33022
|
-
|
|
33023
|
-
|
|
33024
|
-
|
|
33025
|
-
setConfig({ ...config, [field]: value });
|
|
33026
|
-
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
|
+
] });
|
|
33027
33429
|
}
|
|
33028
|
-
|
|
33029
|
-
|
|
33030
|
-
setStage("saving");
|
|
33430
|
+
const save = () => {
|
|
33431
|
+
setSaving(true);
|
|
33031
33432
|
setNotice(null);
|
|
33032
33433
|
writeCredentials(config).then(() => {
|
|
33033
33434
|
setLastSaved(config);
|
|
33034
33435
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
33035
|
-
setNotice({ kind: "success", text: "
|
|
33036
|
-
setStage("form");
|
|
33436
|
+
setNotice({ kind: "success", text: "Project settings saved" });
|
|
33037
33437
|
}).catch((err) => {
|
|
33038
33438
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
|
|
33042
|
-
function quit() {
|
|
33439
|
+
}).finally(() => setSaving(false));
|
|
33440
|
+
};
|
|
33441
|
+
const quit = () => {
|
|
33043
33442
|
void finishDebugRun(
|
|
33044
33443
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
33045
33444
|
);
|
|
33046
33445
|
onDone();
|
|
33047
|
-
}
|
|
33048
|
-
|
|
33049
|
-
|
|
33050
|
-
|
|
33051
|
-
|
|
33052
|
-
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
return;
|
|
33064
|
-
}
|
|
33065
|
-
if (input === "c") {
|
|
33066
|
-
setFieldValue(activeField, "");
|
|
33067
|
-
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
|
|
33068
33462
|
}
|
|
33069
|
-
|
|
33070
|
-
|
|
33071
|
-
|
|
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);
|
|
33072
33498
|
return;
|
|
33073
33499
|
}
|
|
33074
|
-
if (key.
|
|
33075
|
-
|
|
33076
|
-
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
33500
|
+
if (key.downArrow || key.tab) {
|
|
33501
|
+
setFocus((i) => (i + 1) % SECTIONS.length);
|
|
33077
33502
|
return;
|
|
33078
33503
|
}
|
|
33079
33504
|
if (key.return) {
|
|
33080
|
-
|
|
33081
|
-
|
|
33505
|
+
setOpen(SECTIONS[focus].id);
|
|
33506
|
+
return;
|
|
33082
33507
|
}
|
|
33508
|
+
if (key.escape || input === "q") onDone();
|
|
33083
33509
|
});
|
|
33084
|
-
if (
|
|
33085
|
-
|
|
33086
|
-
|
|
33087
|
-
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
|
|
33091
|
-
|
|
33092
|
-
|
|
33093
|
-
|
|
33094
|
-
/* @__PURE__ */
|
|
33095
|
-
|
|
33096
|
-
const value = fieldValue(field);
|
|
33097
|
-
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
33098
|
-
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33099
|
-
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33100
|
-
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
33101
|
-
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33102
|
-
TextInput4,
|
|
33103
|
-
{
|
|
33104
|
-
value,
|
|
33105
|
-
onChange: (next) => setFieldValue(field, next),
|
|
33106
|
-
onSubmit: () => setEditing(false),
|
|
33107
|
-
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
33108
|
-
}
|
|
33109
|
-
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33110
|
-
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
33111
|
-
] }, field);
|
|
33112
|
-
}) }),
|
|
33113
|
-
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33114
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33115
|
-
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33116
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33117
|
-
" ",
|
|
33118
|
-
notice.text
|
|
33119
|
-
] })
|
|
33120
|
-
] }),
|
|
33121
|
-
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33122
|
-
/* @__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(
|
|
33123
33522
|
ControlHints,
|
|
33124
33523
|
{
|
|
33125
|
-
hints:
|
|
33126
|
-
{ keys: "type", label: "edit" },
|
|
33127
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33128
|
-
{ keys: "\u23CE", label: "done" },
|
|
33129
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33130
|
-
] : [
|
|
33524
|
+
hints: [
|
|
33131
33525
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
33132
|
-
{ keys: "\u23CE", label: "
|
|
33133
|
-
{ keys: "
|
|
33134
|
-
{ keys: "s", label: "save" },
|
|
33135
|
-
{ keys: "Esc/q", label: "quit without saving" }
|
|
33526
|
+
{ keys: "\u23CE", label: "open" },
|
|
33527
|
+
{ keys: "Esc/q", label: "back" }
|
|
33136
33528
|
]
|
|
33137
33529
|
}
|
|
33138
33530
|
)
|
|
33139
33531
|
] });
|
|
33140
33532
|
}
|
|
33141
|
-
var
|
|
33533
|
+
var SECTIONS;
|
|
33142
33534
|
var init_ContentfulConfigScreen = __esm({
|
|
33143
33535
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
33144
33536
|
"use strict";
|
|
33145
33537
|
init_home_theme();
|
|
33146
|
-
init_config_store();
|
|
33147
|
-
init_debug_store();
|
|
33148
33538
|
init_control_hints();
|
|
33149
|
-
|
|
33150
|
-
|
|
33151
|
-
|
|
33152
|
-
|
|
33153
|
-
|
|
33154
|
-
|
|
33155
|
-
|
|
33156
|
-
|
|
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" }
|
|
33157
33548
|
];
|
|
33158
|
-
FIELD_LABELS = {
|
|
33159
|
-
spaceId: "Space ID",
|
|
33160
|
-
environmentId: "Environment ID",
|
|
33161
|
-
cmaToken: "CMA Token",
|
|
33162
|
-
host: "API Host",
|
|
33163
|
-
defaultComponentDir: "Default component directory",
|
|
33164
|
-
defaultTokenFile: "Default token file",
|
|
33165
|
-
contentfulBaseDir: "Root Project Directory"
|
|
33166
|
-
};
|
|
33167
|
-
FIELD_HINTS = {
|
|
33168
|
-
contentfulBaseDir: "(where .contentful goes)"
|
|
33169
|
-
};
|
|
33170
|
-
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
33171
33549
|
}
|
|
33172
33550
|
});
|
|
33173
33551
|
|
|
33174
33552
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33175
|
-
import { useEffect as
|
|
33176
|
-
import { Box as
|
|
33177
|
-
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";
|
|
33178
33556
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33179
|
-
const [loading, setLoading] =
|
|
33180
|
-
const [enabled, setEnabled] =
|
|
33181
|
-
|
|
33557
|
+
const [loading, setLoading] = useState33(true);
|
|
33558
|
+
const [enabled, setEnabled] = useState33(true);
|
|
33559
|
+
useEffect24(() => {
|
|
33182
33560
|
readAnalyticsSetting().then((setting) => {
|
|
33183
33561
|
setEnabled(setting.enabled);
|
|
33184
33562
|
setLoading(false);
|
|
@@ -33190,7 +33568,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33190
33568
|
});
|
|
33191
33569
|
});
|
|
33192
33570
|
}, []);
|
|
33193
|
-
|
|
33571
|
+
useInput14((input, key) => {
|
|
33194
33572
|
if (loading) return;
|
|
33195
33573
|
if (key.return || input === " ") {
|
|
33196
33574
|
setEnabled((current) => {
|
|
@@ -33205,21 +33583,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33205
33583
|
onDone();
|
|
33206
33584
|
}
|
|
33207
33585
|
});
|
|
33208
|
-
return /* @__PURE__ */
|
|
33209
|
-
/* @__PURE__ */
|
|
33210
|
-
/* @__PURE__ */
|
|
33211
|
-
loading ? /* @__PURE__ */
|
|
33212
|
-
/* @__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: [
|
|
33213
33591
|
"Share anonymous usage data:",
|
|
33214
33592
|
" ",
|
|
33215
|
-
/* @__PURE__ */
|
|
33593
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33216
33594
|
] }),
|
|
33217
|
-
/* @__PURE__ */
|
|
33218
|
-
/* @__PURE__ */
|
|
33219
|
-
/* @__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." })
|
|
33220
33598
|
] }),
|
|
33221
|
-
/* @__PURE__ */
|
|
33222
|
-
/* @__PURE__ */
|
|
33599
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33600
|
+
/* @__PURE__ */ jsx59(
|
|
33223
33601
|
ControlHints,
|
|
33224
33602
|
{
|
|
33225
33603
|
hints: [
|
|
@@ -33241,12 +33619,12 @@ var init_screen11 = __esm({
|
|
|
33241
33619
|
});
|
|
33242
33620
|
|
|
33243
33621
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
33244
|
-
import { useEffect as
|
|
33245
|
-
import { Box as
|
|
33246
|
-
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";
|
|
33247
33625
|
function UpgradeScreen({ onDone }) {
|
|
33248
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
33249
|
-
|
|
33626
|
+
const [upgradeCheck, setUpgradeCheck] = useState34();
|
|
33627
|
+
useEffect25(() => {
|
|
33250
33628
|
startDebugRun({
|
|
33251
33629
|
flow: "upgrade",
|
|
33252
33630
|
step: "01-upgrade",
|
|
@@ -33255,7 +33633,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
33255
33633
|
});
|
|
33256
33634
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
33257
33635
|
}, []);
|
|
33258
|
-
|
|
33636
|
+
useInput15((_input, key) => {
|
|
33259
33637
|
if (key.return) {
|
|
33260
33638
|
void finishDebugRun({
|
|
33261
33639
|
outputs: upgradeCheck ?? {},
|
|
@@ -33266,12 +33644,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
33266
33644
|
return;
|
|
33267
33645
|
}
|
|
33268
33646
|
});
|
|
33269
|
-
return /* @__PURE__ */
|
|
33270
|
-
/* @__PURE__ */
|
|
33271
|
-
/* @__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: " " }),
|
|
33272
33650
|
renderBody(upgradeCheck),
|
|
33273
|
-
/* @__PURE__ */
|
|
33274
|
-
/* @__PURE__ */
|
|
33651
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33652
|
+
/* @__PURE__ */ jsxs50(Text51, { bold: true, color: PALETTE.accent, children: [
|
|
33275
33653
|
FOCUS_MARKER,
|
|
33276
33654
|
" Go Back"
|
|
33277
33655
|
] })
|
|
@@ -33279,34 +33657,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
33279
33657
|
}
|
|
33280
33658
|
function renderBody(upgradeCheck) {
|
|
33281
33659
|
if (!upgradeCheck) {
|
|
33282
|
-
return /* @__PURE__ */
|
|
33660
|
+
return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
33283
33661
|
}
|
|
33284
33662
|
if (upgradeCheck.status === "error") {
|
|
33285
|
-
return /* @__PURE__ */
|
|
33663
|
+
return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
33286
33664
|
}
|
|
33287
33665
|
if (upgradeCheck.status === "up-to-date") {
|
|
33288
|
-
return /* @__PURE__ */
|
|
33666
|
+
return /* @__PURE__ */ jsxs50(Text51, { color: PALETTE.success, children: [
|
|
33289
33667
|
"You're already on the latest version (v",
|
|
33290
33668
|
upgradeCheck.current,
|
|
33291
33669
|
")."
|
|
33292
33670
|
] });
|
|
33293
33671
|
}
|
|
33294
|
-
return /* @__PURE__ */
|
|
33295
|
-
/* @__PURE__ */
|
|
33296
|
-
/* @__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: [
|
|
33297
33675
|
"v",
|
|
33298
33676
|
upgradeCheck.latest
|
|
33299
33677
|
] }),
|
|
33300
33678
|
" ",
|
|
33301
33679
|
"is available (you're on ",
|
|
33302
|
-
/* @__PURE__ */
|
|
33680
|
+
/* @__PURE__ */ jsxs50(Text51, { bold: true, children: [
|
|
33303
33681
|
"v",
|
|
33304
33682
|
upgradeCheck.current
|
|
33305
33683
|
] }),
|
|
33306
33684
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
33307
33685
|
] }),
|
|
33308
|
-
/* @__PURE__ */
|
|
33309
|
-
/* @__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)) })
|
|
33310
33688
|
] });
|
|
33311
33689
|
}
|
|
33312
33690
|
var UPGRADE_COMMANDS;
|
|
@@ -33321,13 +33699,13 @@ var init_PageContainer4 = __esm({
|
|
|
33321
33699
|
});
|
|
33322
33700
|
|
|
33323
33701
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
33324
|
-
import { useEffect as
|
|
33325
|
-
import { Box as
|
|
33326
|
-
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";
|
|
33327
33705
|
function DebugModeScreen({ onDone }) {
|
|
33328
|
-
const [loading, setLoading] =
|
|
33329
|
-
const [enabled, setEnabled] =
|
|
33330
|
-
|
|
33706
|
+
const [loading, setLoading] = useState35(true);
|
|
33707
|
+
const [enabled, setEnabled] = useState35(true);
|
|
33708
|
+
useEffect26(() => {
|
|
33331
33709
|
readDebugModeSetting().then((setting) => {
|
|
33332
33710
|
setEnabled(setting.enabled);
|
|
33333
33711
|
setLoading(false);
|
|
@@ -33339,7 +33717,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
33339
33717
|
});
|
|
33340
33718
|
});
|
|
33341
33719
|
}, []);
|
|
33342
|
-
|
|
33720
|
+
useInput16((input, key) => {
|
|
33343
33721
|
if (loading) return;
|
|
33344
33722
|
if (key.return || input === " ") {
|
|
33345
33723
|
setEnabled((current) => {
|
|
@@ -33354,16 +33732,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
33354
33732
|
onDone();
|
|
33355
33733
|
}
|
|
33356
33734
|
});
|
|
33357
|
-
return /* @__PURE__ */
|
|
33358
|
-
/* @__PURE__ */
|
|
33359
|
-
/* @__PURE__ */
|
|
33360
|
-
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: [
|
|
33361
33739
|
"Debug logging:",
|
|
33362
33740
|
" ",
|
|
33363
|
-
/* @__PURE__ */
|
|
33741
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33364
33742
|
] }),
|
|
33365
|
-
/* @__PURE__ */
|
|
33366
|
-
/* @__PURE__ */
|
|
33743
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33744
|
+
/* @__PURE__ */ jsx61(
|
|
33367
33745
|
ControlHints,
|
|
33368
33746
|
{
|
|
33369
33747
|
hints: [
|
|
@@ -33389,20 +33767,20 @@ var app_exports = {};
|
|
|
33389
33767
|
__export(app_exports, {
|
|
33390
33768
|
runApp: () => runApp
|
|
33391
33769
|
});
|
|
33392
|
-
import { join as
|
|
33393
|
-
import { useEffect as
|
|
33394
|
-
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";
|
|
33395
33773
|
function App({ importOptions, inkClear }) {
|
|
33396
|
-
const [screen, setScreen] =
|
|
33397
|
-
const [importExitCode, setImportExitCode] =
|
|
33774
|
+
const [screen, setScreen] = useState36("start");
|
|
33775
|
+
const [importExitCode, setImportExitCode] = useState36();
|
|
33398
33776
|
const showImportResult = importExitCode !== void 0;
|
|
33399
|
-
const [projectPath, setProjectPath] =
|
|
33400
|
-
const [tokensPath, setTokensPath] =
|
|
33401
|
-
const [scannedFiles, setScannedFiles] =
|
|
33402
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
33403
|
-
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();
|
|
33404
33782
|
const extraction = useExtraction(extractionRun?.input);
|
|
33405
|
-
const [scopeRun, setScopeRun] =
|
|
33783
|
+
const [scopeRun, setScopeRun] = useState36();
|
|
33406
33784
|
const scopeFlow = useScopeGateFlow(
|
|
33407
33785
|
scopeRun && {
|
|
33408
33786
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -33417,12 +33795,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33417
33795
|
}
|
|
33418
33796
|
}
|
|
33419
33797
|
);
|
|
33420
|
-
const [generationInput, setGenerationInput] =
|
|
33798
|
+
const [generationInput, setGenerationInput] = useState36();
|
|
33421
33799
|
const generation = useGeneration(generationInput);
|
|
33422
|
-
const [flowStart, setFlowStart] =
|
|
33800
|
+
const [flowStart, setFlowStart] = useState36();
|
|
33423
33801
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
33424
|
-
const [importDefaults, setImportDefaults] =
|
|
33425
|
-
|
|
33802
|
+
const [importDefaults, setImportDefaults] = useState36();
|
|
33803
|
+
useEffect27(() => {
|
|
33426
33804
|
if (screen !== "import") {
|
|
33427
33805
|
setImportDefaults(void 0);
|
|
33428
33806
|
return;
|
|
@@ -33440,7 +33818,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33440
33818
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
33441
33819
|
const state2 = await inspectTokens({
|
|
33442
33820
|
rawTokensPath: tokens,
|
|
33443
|
-
contentfulDir:
|
|
33821
|
+
contentfulDir: join28(resolveUserPath(projectPath2), ".contentful"),
|
|
33444
33822
|
cache: importOptions.cache
|
|
33445
33823
|
});
|
|
33446
33824
|
if (state2.kind === "cached") {
|
|
@@ -33482,12 +33860,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33482
33860
|
}
|
|
33483
33861
|
});
|
|
33484
33862
|
};
|
|
33485
|
-
|
|
33863
|
+
useEffect27(() => {
|
|
33486
33864
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
33487
33865
|
setExtractionRun(void 0);
|
|
33488
33866
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
33489
33867
|
}, [extraction, extractionRun]);
|
|
33490
|
-
|
|
33868
|
+
useEffect27(() => {
|
|
33491
33869
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
33492
33870
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33493
33871
|
setGenerationInput({
|
|
@@ -33505,7 +33883,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33505
33883
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
33506
33884
|
});
|
|
33507
33885
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
33508
|
-
|
|
33886
|
+
useEffect27(() => {
|
|
33509
33887
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
33510
33888
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
33511
33889
|
inkClear();
|
|
@@ -33548,9 +33926,9 @@ function App({ importOptions, inkClear }) {
|
|
|
33548
33926
|
};
|
|
33549
33927
|
switch (screen) {
|
|
33550
33928
|
case "import":
|
|
33551
|
-
if (showImportResult) return /* @__PURE__ */
|
|
33929
|
+
if (showImportResult) return /* @__PURE__ */ jsx62(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
33552
33930
|
if (flow && flowStart) {
|
|
33553
|
-
return /* @__PURE__ */
|
|
33931
|
+
return /* @__PURE__ */ jsx62(
|
|
33554
33932
|
FlowScreen,
|
|
33555
33933
|
{
|
|
33556
33934
|
state: flow.state,
|
|
@@ -33560,12 +33938,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33560
33938
|
}
|
|
33561
33939
|
);
|
|
33562
33940
|
}
|
|
33563
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
33941
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33564
33942
|
if (projectPath === void 0) {
|
|
33565
|
-
return /* @__PURE__ */
|
|
33943
|
+
return /* @__PURE__ */ jsx62(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
33566
33944
|
}
|
|
33567
33945
|
if (tokensPath === void 0) {
|
|
33568
|
-
return /* @__PURE__ */
|
|
33946
|
+
return /* @__PURE__ */ jsx62(
|
|
33569
33947
|
TokenInputScreen,
|
|
33570
33948
|
{
|
|
33571
33949
|
initialPath: importDefaults.tokenFile,
|
|
@@ -33575,7 +33953,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33575
33953
|
);
|
|
33576
33954
|
}
|
|
33577
33955
|
if (scannedFiles === void 0) {
|
|
33578
|
-
return /* @__PURE__ */
|
|
33956
|
+
return /* @__PURE__ */ jsx62(
|
|
33579
33957
|
PathValidationScreen,
|
|
33580
33958
|
{
|
|
33581
33959
|
projectPath,
|
|
@@ -33587,10 +33965,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33587
33965
|
}
|
|
33588
33966
|
if (extractionRun) {
|
|
33589
33967
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
33590
|
-
return /* @__PURE__ */
|
|
33968
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
33591
33969
|
}
|
|
33592
33970
|
if (extraction?.status === "running") {
|
|
33593
|
-
return /* @__PURE__ */
|
|
33971
|
+
return /* @__PURE__ */ jsx62(
|
|
33594
33972
|
ExtractionScreen,
|
|
33595
33973
|
{
|
|
33596
33974
|
progress: extraction.progress,
|
|
@@ -33599,14 +33977,14 @@ function App({ importOptions, inkClear }) {
|
|
|
33599
33977
|
}
|
|
33600
33978
|
);
|
|
33601
33979
|
}
|
|
33602
|
-
return /* @__PURE__ */
|
|
33980
|
+
return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33603
33981
|
}
|
|
33604
33982
|
if (scopeRun && scopeFlow) {
|
|
33605
33983
|
if (scopeFlow.status === "failed") {
|
|
33606
|
-
return /* @__PURE__ */
|
|
33984
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
33607
33985
|
}
|
|
33608
33986
|
if (scopeFlow.status === "deciding") {
|
|
33609
|
-
return /* @__PURE__ */
|
|
33987
|
+
return /* @__PURE__ */ jsx62(
|
|
33610
33988
|
ScopeGateScreen,
|
|
33611
33989
|
{
|
|
33612
33990
|
components: scopeFlow.load.components,
|
|
@@ -33616,7 +33994,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33616
33994
|
);
|
|
33617
33995
|
}
|
|
33618
33996
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
33619
|
-
return /* @__PURE__ */
|
|
33997
|
+
return /* @__PURE__ */ jsx62(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
33620
33998
|
}
|
|
33621
33999
|
if (generation?.status === "running") {
|
|
33622
34000
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -33624,7 +34002,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33624
34002
|
hasRawTokens,
|
|
33625
34003
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
33626
34004
|
});
|
|
33627
|
-
return /* @__PURE__ */
|
|
34005
|
+
return /* @__PURE__ */ jsx62(
|
|
33628
34006
|
GenerationScreen,
|
|
33629
34007
|
{
|
|
33630
34008
|
progress: generation.progress,
|
|
@@ -33636,10 +34014,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33636
34014
|
}
|
|
33637
34015
|
);
|
|
33638
34016
|
}
|
|
33639
|
-
return /* @__PURE__ */
|
|
34017
|
+
return /* @__PURE__ */ jsx62(Fragment20, {});
|
|
33640
34018
|
}
|
|
33641
34019
|
if (pendingLaunch?.cached) {
|
|
33642
|
-
return /* @__PURE__ */
|
|
34020
|
+
return /* @__PURE__ */ jsx62(
|
|
33643
34021
|
TokenReuseScreen,
|
|
33644
34022
|
{
|
|
33645
34023
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -33650,7 +34028,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33650
34028
|
}
|
|
33651
34029
|
);
|
|
33652
34030
|
}
|
|
33653
|
-
return /* @__PURE__ */
|
|
34031
|
+
return /* @__PURE__ */ jsx62(
|
|
33654
34032
|
CredentialsScreen,
|
|
33655
34033
|
{
|
|
33656
34034
|
initial: importDefaults.credentials,
|
|
@@ -33659,19 +34037,19 @@ function App({ importOptions, inkClear }) {
|
|
|
33659
34037
|
}
|
|
33660
34038
|
);
|
|
33661
34039
|
case "help":
|
|
33662
|
-
return /* @__PURE__ */
|
|
34040
|
+
return /* @__PURE__ */ jsx62(HelpScreen, { onDone: goToStart });
|
|
33663
34041
|
case "upgrade":
|
|
33664
|
-
return /* @__PURE__ */
|
|
34042
|
+
return /* @__PURE__ */ jsx62(UpgradeScreen, { onDone: goToStart });
|
|
33665
34043
|
case "settings":
|
|
33666
|
-
return /* @__PURE__ */
|
|
34044
|
+
return /* @__PURE__ */ jsx62(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
33667
34045
|
case "settings-configuration":
|
|
33668
|
-
return /* @__PURE__ */
|
|
34046
|
+
return /* @__PURE__ */ jsx62(ConfigurationScreen, { onDone: goToSettings });
|
|
33669
34047
|
case "settings-opt-in-analytics":
|
|
33670
|
-
return /* @__PURE__ */
|
|
34048
|
+
return /* @__PURE__ */ jsx62(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
33671
34049
|
case "settings-debug-mode":
|
|
33672
|
-
return /* @__PURE__ */
|
|
34050
|
+
return /* @__PURE__ */ jsx62(DebugModeScreen, { onDone: goToSettings });
|
|
33673
34051
|
case "start":
|
|
33674
|
-
return /* @__PURE__ */
|
|
34052
|
+
return /* @__PURE__ */ jsx62(HomeScreen, { onNavigate: setScreen });
|
|
33675
34053
|
}
|
|
33676
34054
|
}
|
|
33677
34055
|
async function runApp(renderApp, importOptions) {
|
|
@@ -33679,7 +34057,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
33679
34057
|
instance.clear?.();
|
|
33680
34058
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
33681
34059
|
};
|
|
33682
|
-
const instance = renderApp(/* @__PURE__ */
|
|
34060
|
+
const instance = renderApp(/* @__PURE__ */ jsx62(App, { importOptions, inkClear }));
|
|
33683
34061
|
await instance.waitUntilExit();
|
|
33684
34062
|
}
|
|
33685
34063
|
var init_app = __esm({
|
|
@@ -33714,7 +34092,7 @@ var init_app = __esm({
|
|
|
33714
34092
|
// packages/experience-design-system-cli/program.ts
|
|
33715
34093
|
init_src4();
|
|
33716
34094
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
33717
|
-
import { join as
|
|
34095
|
+
import { join as join29 } from "node:path";
|
|
33718
34096
|
import { Command } from "commander";
|
|
33719
34097
|
|
|
33720
34098
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
@@ -33818,14 +34196,14 @@ function runDevWatch(args) {
|
|
|
33818
34196
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33819
34197
|
return Promise.resolve(1);
|
|
33820
34198
|
}
|
|
33821
|
-
return new Promise((
|
|
34199
|
+
return new Promise((resolve28) => {
|
|
33822
34200
|
const child = spawn4(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33823
34201
|
process.on("SIGINT", () => void 0);
|
|
33824
|
-
child.on("exit", (code) =>
|
|
34202
|
+
child.on("exit", (code) => resolve28(code ?? 0));
|
|
33825
34203
|
child.on("error", (err) => {
|
|
33826
34204
|
process.stderr.write(`${err.message}
|
|
33827
34205
|
`);
|
|
33828
|
-
|
|
34206
|
+
resolve28(1);
|
|
33829
34207
|
});
|
|
33830
34208
|
});
|
|
33831
34209
|
}
|
|
@@ -33851,7 +34229,7 @@ init_analytics_store();
|
|
|
33851
34229
|
init_package_root();
|
|
33852
34230
|
var pkg = JSON.parse(
|
|
33853
34231
|
readFileSync9(
|
|
33854
|
-
|
|
34232
|
+
join29(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
33855
34233
|
"utf8"
|
|
33856
34234
|
)
|
|
33857
34235
|
);
|
|
@@ -33892,7 +34270,7 @@ init_config();
|
|
|
33892
34270
|
init_package_root();
|
|
33893
34271
|
import { existsSync as existsSync12 } from "node:fs";
|
|
33894
34272
|
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
33895
|
-
import { dirname as dirname16, join as
|
|
34273
|
+
import { dirname as dirname16, join as join30 } from "node:path";
|
|
33896
34274
|
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
33897
34275
|
async function readJson(path5) {
|
|
33898
34276
|
try {
|
|
@@ -33903,9 +34281,9 @@ async function readJson(path5) {
|
|
|
33903
34281
|
}
|
|
33904
34282
|
async function migrateOldConfig() {
|
|
33905
34283
|
try {
|
|
33906
|
-
const oldCredentials =
|
|
33907
|
-
const oldRuns =
|
|
33908
|
-
const oldDebugMode =
|
|
34284
|
+
const oldCredentials = join30(oldConfigDir2(), "credentials.json");
|
|
34285
|
+
const oldRuns = join30(oldConfigDir2(), "runs.json");
|
|
34286
|
+
const oldDebugMode = join30(
|
|
33909
34287
|
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
33910
34288
|
".contentful",
|
|
33911
34289
|
"config",
|