@contentful/experience-design-system-cli 2.37.1-dev-build-5efcf6e5.0 → 2.37.1-dev-build-2ec208d2.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
CHANGED
|
@@ -28607,7 +28607,8 @@ function emptyAgents() {
|
|
|
28607
28607
|
async function readAgentConfig() {
|
|
28608
28608
|
const store = await readV1Store();
|
|
28609
28609
|
const stored = asString(store["agent"]);
|
|
28610
|
-
const
|
|
28610
|
+
const defaultChosen = isAgentName(stored);
|
|
28611
|
+
const defaultAgent = defaultChosen ? stored : DEFAULT_AGENT_NAME;
|
|
28611
28612
|
const agents = emptyAgents();
|
|
28612
28613
|
const saved = store["agents"];
|
|
28613
28614
|
if (saved && typeof saved === "object") {
|
|
@@ -28622,7 +28623,7 @@ async function readAgentConfig() {
|
|
|
28622
28623
|
const legacyModel = asString(store["agentModel"]);
|
|
28623
28624
|
if (legacyModel && !agents[defaultAgent].model)
|
|
28624
28625
|
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
28625
|
-
return { defaultAgent, agents };
|
|
28626
|
+
return { defaultAgent, defaultChosen, agents };
|
|
28626
28627
|
}
|
|
28627
28628
|
async function writeAgentConfig(config) {
|
|
28628
28629
|
const existing = await readV1Store();
|
|
@@ -28633,8 +28634,9 @@ async function writeAgentConfig(config) {
|
|
|
28633
28634
|
const binary = config.agents[name].binary.trim();
|
|
28634
28635
|
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
28635
28636
|
}
|
|
28636
|
-
|
|
28637
|
-
|
|
28637
|
+
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
28638
|
+
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
28639
|
+
else delete merged["agent"];
|
|
28638
28640
|
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
28639
28641
|
else delete merged["agentModel"];
|
|
28640
28642
|
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
@@ -28854,6 +28856,20 @@ import { useState as useState29 } from "react";
|
|
|
28854
28856
|
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
28855
28857
|
import TextInput4 from "ink-text-input";
|
|
28856
28858
|
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
28859
|
+
function formLabelWidth(rows) {
|
|
28860
|
+
return Math.max(...rows.map((row) => row.label.length));
|
|
28861
|
+
}
|
|
28862
|
+
function FormReadOnlyRow({
|
|
28863
|
+
label,
|
|
28864
|
+
labelWidth,
|
|
28865
|
+
children
|
|
28866
|
+
}) {
|
|
28867
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
28868
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
28869
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: label }) }),
|
|
28870
|
+
children
|
|
28871
|
+
] });
|
|
28872
|
+
}
|
|
28857
28873
|
function FieldForm({
|
|
28858
28874
|
title,
|
|
28859
28875
|
subtitle,
|
|
@@ -28871,10 +28887,7 @@ function FieldForm({
|
|
|
28871
28887
|
const [editing, setEditing] = useState29(false);
|
|
28872
28888
|
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
28873
28889
|
const rowCount = fields2.length + actions.length;
|
|
28874
|
-
const labelWidth =
|
|
28875
|
-
...fields2.map((field) => field.label.length),
|
|
28876
|
-
...actions.map((action) => action.label.length)
|
|
28877
|
-
);
|
|
28890
|
+
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
28878
28891
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
28879
28892
|
const currentAction = currentField ? void 0 : actions[active - fields2.length];
|
|
28880
28893
|
useInput11((input, key) => {
|
|
@@ -28936,8 +28949,12 @@ function FieldForm({
|
|
|
28936
28949
|
onSubmit: () => setEditing(false),
|
|
28937
28950
|
mask: field.masked ? "\u2022" : void 0
|
|
28938
28951
|
}
|
|
28939
|
-
) :
|
|
28940
|
-
|
|
28952
|
+
) : display ? /* @__PURE__ */ jsx55(Text46, { bold: true, children: display }) : (
|
|
28953
|
+
// An empty value shows its hint (or "(empty)") in the value's place, not after an empty element, so the
|
|
28954
|
+
// text starts in the same column as every other row's.
|
|
28955
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint ?? "(empty)" })
|
|
28956
|
+
),
|
|
28957
|
+
display && field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
28941
28958
|
] }, field.key);
|
|
28942
28959
|
}),
|
|
28943
28960
|
actions.map((action, index) => {
|
|
@@ -29020,15 +29037,7 @@ var fields = (name) => [
|
|
|
29020
29037
|
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
29021
29038
|
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
29022
29039
|
];
|
|
29023
|
-
var
|
|
29024
|
-
var LABEL_GAP = 2;
|
|
29025
|
-
var POINTER_WIDTH = 2;
|
|
29026
|
-
function Row2({ label, children }) {
|
|
29027
|
-
return /* @__PURE__ */ jsxs46(Box45, { children: [
|
|
29028
|
-
/* @__PURE__ */ jsx57(Box45, { width: POINTER_WIDTH + LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: label }) }),
|
|
29029
|
-
children
|
|
29030
|
-
] });
|
|
29031
|
-
}
|
|
29040
|
+
var INSPECT_DELAY_MS = 400;
|
|
29032
29041
|
function StatusHeading() {
|
|
29033
29042
|
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
29034
29043
|
/* @__PURE__ */ jsx57(Text48, { bold: true, color: PALETTE.muted, children: "STATUS" }),
|
|
@@ -29049,9 +29058,12 @@ function AgentDetail({
|
|
|
29049
29058
|
useEffect22(() => {
|
|
29050
29059
|
let active = true;
|
|
29051
29060
|
setChecks(void 0);
|
|
29052
|
-
|
|
29061
|
+
const timer = setTimeout(() => {
|
|
29062
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
29063
|
+
}, INSPECT_DELAY_MS);
|
|
29053
29064
|
return () => {
|
|
29054
29065
|
active = false;
|
|
29066
|
+
clearTimeout(timer);
|
|
29055
29067
|
};
|
|
29056
29068
|
}, [name, settings.binary]);
|
|
29057
29069
|
const save = () => {
|
|
@@ -29084,12 +29096,14 @@ function AgentDetail({
|
|
|
29084
29096
|
hint: "run test",
|
|
29085
29097
|
onRun: runTest
|
|
29086
29098
|
};
|
|
29099
|
+
const formFields = fields(name);
|
|
29100
|
+
const labelWidth = formLabelWidth([...formFields, action]);
|
|
29087
29101
|
return /* @__PURE__ */ jsx57(
|
|
29088
29102
|
FieldForm,
|
|
29089
29103
|
{
|
|
29090
29104
|
title: AGENT_LABELS[name],
|
|
29091
29105
|
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
29092
|
-
fields:
|
|
29106
|
+
fields: formFields,
|
|
29093
29107
|
values: { binary: settings.binary, model: settings.model },
|
|
29094
29108
|
onChange: (key, value) => {
|
|
29095
29109
|
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
@@ -29102,7 +29116,7 @@ function AgentDetail({
|
|
|
29102
29116
|
busy: saving || testing,
|
|
29103
29117
|
children: /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
29104
29118
|
/* @__PURE__ */ jsx57(StatusHeading, {}),
|
|
29105
|
-
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(
|
|
29119
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
29106
29120
|
] })
|
|
29107
29121
|
}
|
|
29108
29122
|
);
|
|
@@ -29118,6 +29132,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29118
29132
|
const [open, setOpen] = useState31(null);
|
|
29119
29133
|
const [notice, setNotice] = useState31(null);
|
|
29120
29134
|
const [saving, setSaving] = useState31(false);
|
|
29135
|
+
const [loadError, setLoadError] = useState31(null);
|
|
29121
29136
|
const [checks, setChecks] = useState31({});
|
|
29122
29137
|
const inspectAll = (loaded) => {
|
|
29123
29138
|
for (const name of AGENT_NAMES) {
|
|
@@ -29127,7 +29142,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29127
29142
|
}
|
|
29128
29143
|
};
|
|
29129
29144
|
useEffect23(() => {
|
|
29130
|
-
|
|
29145
|
+
readAgentConfig().then((loaded) => {
|
|
29131
29146
|
setConfig(loaded);
|
|
29132
29147
|
inspectAll(loaded);
|
|
29133
29148
|
startDebugRun({
|
|
@@ -29136,7 +29151,7 @@ function AgentsScreen({ onDone }) {
|
|
|
29136
29151
|
menuOption: "Configuration > Agents",
|
|
29137
29152
|
inputs: { default_agent: loaded.defaultAgent }
|
|
29138
29153
|
});
|
|
29139
|
-
});
|
|
29154
|
+
}).catch((err) => setLoadError(err instanceof Error ? err.message : String(err)));
|
|
29140
29155
|
}, []);
|
|
29141
29156
|
const makeDefault = (name) => {
|
|
29142
29157
|
if (!config || saving) return;
|
|
@@ -29146,8 +29161,8 @@ function AgentsScreen({ onDone }) {
|
|
|
29146
29161
|
}
|
|
29147
29162
|
setSaving(true);
|
|
29148
29163
|
setNotice(null);
|
|
29149
|
-
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
29150
|
-
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
29164
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
29165
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
29151
29166
|
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
29152
29167
|
}).catch(
|
|
29153
29168
|
(err) => setNotice({
|
|
@@ -29157,6 +29172,10 @@ function AgentsScreen({ onDone }) {
|
|
|
29157
29172
|
).finally(() => setSaving(false));
|
|
29158
29173
|
};
|
|
29159
29174
|
useInput12((input, key) => {
|
|
29175
|
+
if (loadError && (key.escape || input === "q")) {
|
|
29176
|
+
onDone();
|
|
29177
|
+
return;
|
|
29178
|
+
}
|
|
29160
29179
|
if (!config || open || saving) return;
|
|
29161
29180
|
const focused = AGENT_NAMES[focus];
|
|
29162
29181
|
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
@@ -29186,7 +29205,14 @@ function AgentsScreen({ onDone }) {
|
|
|
29186
29205
|
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
29187
29206
|
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Agents" }),
|
|
29188
29207
|
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29189
|
-
/* @__PURE__ */
|
|
29208
|
+
loadError ? /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
29209
|
+
/* @__PURE__ */ jsxs47(Text49, { color: PALETTE.error, children: [
|
|
29210
|
+
"\u2717 Could not read the settings: ",
|
|
29211
|
+
loadError
|
|
29212
|
+
] }),
|
|
29213
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
29214
|
+
/* @__PURE__ */ jsx58(ControlHints, { hints: [{ keys: "Esc/q", label: "back" }] })
|
|
29215
|
+
] }) : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "Loading..." })
|
|
29190
29216
|
] });
|
|
29191
29217
|
}
|
|
29192
29218
|
if (open) {
|
package/dist/index.js
CHANGED
|
@@ -19573,7 +19573,8 @@ function emptyAgents() {
|
|
|
19573
19573
|
async function readAgentConfig() {
|
|
19574
19574
|
const store = await readV1Store();
|
|
19575
19575
|
const stored = asString(store["agent"]);
|
|
19576
|
-
const
|
|
19576
|
+
const defaultChosen = isAgentName(stored);
|
|
19577
|
+
const defaultAgent = defaultChosen ? stored : DEFAULT_AGENT_NAME;
|
|
19577
19578
|
const agents = emptyAgents();
|
|
19578
19579
|
const saved = store["agents"];
|
|
19579
19580
|
if (saved && typeof saved === "object") {
|
|
@@ -19588,7 +19589,7 @@ async function readAgentConfig() {
|
|
|
19588
19589
|
const legacyModel = asString(store["agentModel"]);
|
|
19589
19590
|
if (legacyModel && !agents[defaultAgent].model)
|
|
19590
19591
|
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
19591
|
-
return { defaultAgent, agents };
|
|
19592
|
+
return { defaultAgent, defaultChosen, agents };
|
|
19592
19593
|
}
|
|
19593
19594
|
async function writeAgentConfig(config) {
|
|
19594
19595
|
const existing = await readV1Store();
|
|
@@ -19599,8 +19600,9 @@ async function writeAgentConfig(config) {
|
|
|
19599
19600
|
const binary = config.agents[name].binary.trim();
|
|
19600
19601
|
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
19601
19602
|
}
|
|
19602
|
-
|
|
19603
|
-
|
|
19603
|
+
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
19604
|
+
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
19605
|
+
else delete merged["agent"];
|
|
19604
19606
|
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
19605
19607
|
else delete merged["agentModel"];
|
|
19606
19608
|
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
@@ -33312,6 +33314,20 @@ import { useState as useState29 } from "react";
|
|
|
33312
33314
|
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33313
33315
|
import TextInput4 from "ink-text-input";
|
|
33314
33316
|
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33317
|
+
function formLabelWidth(rows) {
|
|
33318
|
+
return Math.max(...rows.map((row) => row.label.length));
|
|
33319
|
+
}
|
|
33320
|
+
function FormReadOnlyRow({
|
|
33321
|
+
label,
|
|
33322
|
+
labelWidth,
|
|
33323
|
+
children
|
|
33324
|
+
}) {
|
|
33325
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33326
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33327
|
+
/* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: label }) }),
|
|
33328
|
+
children
|
|
33329
|
+
] });
|
|
33330
|
+
}
|
|
33315
33331
|
function FieldForm({
|
|
33316
33332
|
title,
|
|
33317
33333
|
subtitle,
|
|
@@ -33329,10 +33345,7 @@ function FieldForm({
|
|
|
33329
33345
|
const [editing, setEditing] = useState29(false);
|
|
33330
33346
|
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33331
33347
|
const rowCount = fields2.length + actions.length;
|
|
33332
|
-
const labelWidth =
|
|
33333
|
-
...fields2.map((field) => field.label.length),
|
|
33334
|
-
...actions.map((action) => action.label.length)
|
|
33335
|
-
);
|
|
33348
|
+
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
33336
33349
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
33337
33350
|
const currentAction = currentField ? void 0 : actions[active - fields2.length];
|
|
33338
33351
|
useInput11((input, key) => {
|
|
@@ -33394,8 +33407,12 @@ function FieldForm({
|
|
|
33394
33407
|
onSubmit: () => setEditing(false),
|
|
33395
33408
|
mask: field.masked ? "\u2022" : void 0
|
|
33396
33409
|
}
|
|
33397
|
-
) :
|
|
33398
|
-
|
|
33410
|
+
) : display ? /* @__PURE__ */ jsx55(Text46, { bold: true, children: display }) : (
|
|
33411
|
+
// An empty value shows its hint (or "(empty)") in the value's place, not after an empty element, so the
|
|
33412
|
+
// text starts in the same column as every other row's.
|
|
33413
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint ?? "(empty)" })
|
|
33414
|
+
),
|
|
33415
|
+
display && field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
|
|
33399
33416
|
] }, field.key);
|
|
33400
33417
|
}),
|
|
33401
33418
|
actions.map((action, index) => {
|
|
@@ -33473,12 +33490,6 @@ var init_AgentStatusBadge = __esm({
|
|
|
33473
33490
|
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
33474
33491
|
import { Box as Box45, Text as Text48 } from "ink";
|
|
33475
33492
|
import { jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33476
|
-
function Row2({ label, children }) {
|
|
33477
|
-
return /* @__PURE__ */ jsxs46(Box45, { children: [
|
|
33478
|
-
/* @__PURE__ */ jsx57(Box45, { width: POINTER_WIDTH + LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: label }) }),
|
|
33479
|
-
children
|
|
33480
|
-
] });
|
|
33481
|
-
}
|
|
33482
33493
|
function StatusHeading() {
|
|
33483
33494
|
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33484
33495
|
/* @__PURE__ */ jsx57(Text48, { bold: true, color: PALETTE.muted, children: "STATUS" }),
|
|
@@ -33499,9 +33510,12 @@ function AgentDetail({
|
|
|
33499
33510
|
useEffect22(() => {
|
|
33500
33511
|
let active = true;
|
|
33501
33512
|
setChecks(void 0);
|
|
33502
|
-
|
|
33513
|
+
const timer = setTimeout(() => {
|
|
33514
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33515
|
+
}, INSPECT_DELAY_MS);
|
|
33503
33516
|
return () => {
|
|
33504
33517
|
active = false;
|
|
33518
|
+
clearTimeout(timer);
|
|
33505
33519
|
};
|
|
33506
33520
|
}, [name, settings.binary]);
|
|
33507
33521
|
const save = () => {
|
|
@@ -33534,12 +33548,14 @@ function AgentDetail({
|
|
|
33534
33548
|
hint: "run test",
|
|
33535
33549
|
onRun: runTest
|
|
33536
33550
|
};
|
|
33551
|
+
const formFields = fields(name);
|
|
33552
|
+
const labelWidth = formLabelWidth([...formFields, action]);
|
|
33537
33553
|
return /* @__PURE__ */ jsx57(
|
|
33538
33554
|
FieldForm,
|
|
33539
33555
|
{
|
|
33540
33556
|
title: AGENT_LABELS[name],
|
|
33541
33557
|
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
33542
|
-
fields:
|
|
33558
|
+
fields: formFields,
|
|
33543
33559
|
values: { binary: settings.binary, model: settings.model },
|
|
33544
33560
|
onChange: (key, value) => {
|
|
33545
33561
|
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
@@ -33552,12 +33568,12 @@ function AgentDetail({
|
|
|
33552
33568
|
busy: saving || testing,
|
|
33553
33569
|
children: /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
33554
33570
|
/* @__PURE__ */ jsx57(StatusHeading, {}),
|
|
33555
|
-
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(
|
|
33571
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx57(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
33556
33572
|
] })
|
|
33557
33573
|
}
|
|
33558
33574
|
);
|
|
33559
33575
|
}
|
|
33560
|
-
var fields,
|
|
33576
|
+
var fields, INSPECT_DELAY_MS;
|
|
33561
33577
|
var init_AgentDetail = __esm({
|
|
33562
33578
|
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx"() {
|
|
33563
33579
|
"use strict";
|
|
@@ -33572,9 +33588,7 @@ var init_AgentDetail = __esm({
|
|
|
33572
33588
|
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
33573
33589
|
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33574
33590
|
];
|
|
33575
|
-
|
|
33576
|
-
LABEL_GAP = 2;
|
|
33577
|
-
POINTER_WIDTH = 2;
|
|
33591
|
+
INSPECT_DELAY_MS = 400;
|
|
33578
33592
|
}
|
|
33579
33593
|
});
|
|
33580
33594
|
|
|
@@ -33588,6 +33602,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33588
33602
|
const [open, setOpen] = useState31(null);
|
|
33589
33603
|
const [notice, setNotice] = useState31(null);
|
|
33590
33604
|
const [saving, setSaving] = useState31(false);
|
|
33605
|
+
const [loadError, setLoadError] = useState31(null);
|
|
33591
33606
|
const [checks, setChecks] = useState31({});
|
|
33592
33607
|
const inspectAll = (loaded) => {
|
|
33593
33608
|
for (const name of AGENT_NAMES) {
|
|
@@ -33597,7 +33612,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33597
33612
|
}
|
|
33598
33613
|
};
|
|
33599
33614
|
useEffect23(() => {
|
|
33600
|
-
|
|
33615
|
+
readAgentConfig().then((loaded) => {
|
|
33601
33616
|
setConfig(loaded);
|
|
33602
33617
|
inspectAll(loaded);
|
|
33603
33618
|
startDebugRun({
|
|
@@ -33606,7 +33621,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33606
33621
|
menuOption: "Configuration > Agents",
|
|
33607
33622
|
inputs: { default_agent: loaded.defaultAgent }
|
|
33608
33623
|
});
|
|
33609
|
-
});
|
|
33624
|
+
}).catch((err) => setLoadError(err instanceof Error ? err.message : String(err)));
|
|
33610
33625
|
}, []);
|
|
33611
33626
|
const makeDefault = (name) => {
|
|
33612
33627
|
if (!config || saving) return;
|
|
@@ -33616,8 +33631,8 @@ function AgentsScreen({ onDone }) {
|
|
|
33616
33631
|
}
|
|
33617
33632
|
setSaving(true);
|
|
33618
33633
|
setNotice(null);
|
|
33619
|
-
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
33620
|
-
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
33634
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
33635
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
33621
33636
|
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
33622
33637
|
}).catch(
|
|
33623
33638
|
(err) => setNotice({
|
|
@@ -33627,6 +33642,10 @@ function AgentsScreen({ onDone }) {
|
|
|
33627
33642
|
).finally(() => setSaving(false));
|
|
33628
33643
|
};
|
|
33629
33644
|
useInput12((input, key) => {
|
|
33645
|
+
if (loadError && (key.escape || input === "q")) {
|
|
33646
|
+
onDone();
|
|
33647
|
+
return;
|
|
33648
|
+
}
|
|
33630
33649
|
if (!config || open || saving) return;
|
|
33631
33650
|
const focused = AGENT_NAMES[focus];
|
|
33632
33651
|
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
@@ -33656,7 +33675,14 @@ function AgentsScreen({ onDone }) {
|
|
|
33656
33675
|
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33657
33676
|
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Agents" }),
|
|
33658
33677
|
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33659
|
-
/* @__PURE__ */
|
|
33678
|
+
loadError ? /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
33679
|
+
/* @__PURE__ */ jsxs47(Text49, { color: PALETTE.error, children: [
|
|
33680
|
+
"\u2717 Could not read the settings: ",
|
|
33681
|
+
loadError
|
|
33682
|
+
] }),
|
|
33683
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33684
|
+
/* @__PURE__ */ jsx58(ControlHints, { hints: [{ keys: "Esc/q", label: "back" }] })
|
|
33685
|
+
] }) : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "Loading..." })
|
|
33660
33686
|
] });
|
|
33661
33687
|
}
|
|
33662
33688
|
if (open) {
|
package/dist/package.json
CHANGED
|
@@ -6,8 +6,13 @@ export type AgentSettings = {
|
|
|
6
6
|
binary: string;
|
|
7
7
|
};
|
|
8
8
|
export type AgentConfig = {
|
|
9
|
-
/** The agent the CLI uses when `--agent` is not given. */
|
|
9
|
+
/** The agent the CLI uses when `--agent` is not given. Claude when nothing was chosen. */
|
|
10
10
|
defaultAgent: AgentName;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the user chose the default agent. Only then is `agent` written to config.json, so someone who never chose
|
|
13
|
+
* keeps the import's built-in default, including if that default changes in a later version.
|
|
14
|
+
*/
|
|
15
|
+
defaultChosen?: boolean;
|
|
11
16
|
agents: Record<AgentName, AgentSettings>;
|
|
12
17
|
};
|
|
13
18
|
export declare const AGENT_LABELS: Record<AgentName, string>;
|
|
@@ -41,6 +41,19 @@ interface FieldFormProps<K extends string> {
|
|
|
41
41
|
/** Shown after the rows and the notice, for read-only content that belongs to the same screen. */
|
|
42
42
|
children?: React.ReactNode;
|
|
43
43
|
}
|
|
44
|
+
/** The widest label among a form's rows. The form pads every label to it, and read-only rows use it to line up with them. */
|
|
45
|
+
export declare function formLabelWidth(rows: readonly {
|
|
46
|
+
label: string;
|
|
47
|
+
}[]): number;
|
|
48
|
+
/**
|
|
49
|
+
* A label and value for read-only content shown with a form. It is built the same way as the form's own rows (a pointer
|
|
50
|
+
* slot, the label padded to the shared width, then the value), so its values start in the same column as the form's.
|
|
51
|
+
*/
|
|
52
|
+
export declare function FormReadOnlyRow({ label, labelWidth, children, }: {
|
|
53
|
+
label: string;
|
|
54
|
+
labelWidth: number;
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
}): React.ReactElement;
|
|
44
57
|
/**
|
|
45
58
|
* The edit-in-place form the Configuration pages share. Fields are read-only until Enter opens one; Enter again closes it.
|
|
46
59
|
* While one is open, keys type into it (so a "q" in a path is just a "q"), and Esc closes it and restores the old value.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-2ec208d2.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-
|
|
49
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-2ec208d2.0",
|
|
49
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-2ec208d2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|