@contentful/experience-design-system-cli 2.37.1-dev-build-d5797739.0 → 2.37.1-dev-build-8b3a1c07.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 +374 -125
- package/dist/index.js +448 -171
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/agents/AgentStatusLine.d.ts +13 -0
- package/dist/src/tui/settings/agents/agent-status.d.ts +29 -0
- package/dist/src/tui/settings/agents/agent-store.d.ts +3 -0
- package/dist/src/tui/settings/agents/apply-binary-overrides.d.ts +13 -0
- package/dist/src/tui/settings/shared/FieldForm.d.ts +7 -1
- package/legacy/dist/src/index.js +1 -0
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7916,10 +7916,10 @@ function extractVueSlotsFromSetup(options) {
|
|
|
7916
7916
|
if (!body)
|
|
7917
7917
|
return [];
|
|
7918
7918
|
const slotsByName = /* @__PURE__ */ new Map();
|
|
7919
|
-
for (const
|
|
7920
|
-
if (
|
|
7919
|
+
for (const access7 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
|
|
7920
|
+
if (access7.getExpression().getText() !== slotsName)
|
|
7921
7921
|
continue;
|
|
7922
|
-
const slotName =
|
|
7922
|
+
const slotName = access7.getName();
|
|
7923
7923
|
if (!slotsByName.has(slotName)) {
|
|
7924
7924
|
slotsByName.set(slotName, {
|
|
7925
7925
|
name: slotName,
|
|
@@ -19446,6 +19446,7 @@ var init_src4 = __esm({
|
|
|
19446
19446
|
init_agents();
|
|
19447
19447
|
init_agent_name();
|
|
19448
19448
|
init_models();
|
|
19449
|
+
init_binaries();
|
|
19449
19450
|
init_is_agent_name();
|
|
19450
19451
|
init_agent_supports_bedrock();
|
|
19451
19452
|
init_check_agent_auth();
|
|
@@ -19565,6 +19566,97 @@ var init_v1_store = __esm({
|
|
|
19565
19566
|
}
|
|
19566
19567
|
});
|
|
19567
19568
|
|
|
19569
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
|
|
19570
|
+
function emptyAgents() {
|
|
19571
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
19572
|
+
}
|
|
19573
|
+
async function readAgentConfig() {
|
|
19574
|
+
const store = await readV1Store();
|
|
19575
|
+
const stored = asString(store["agent"]);
|
|
19576
|
+
const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
|
|
19577
|
+
const agents = emptyAgents();
|
|
19578
|
+
const saved = store["agents"];
|
|
19579
|
+
if (saved && typeof saved === "object") {
|
|
19580
|
+
for (const name of AGENT_NAMES) {
|
|
19581
|
+
const entry = saved[name];
|
|
19582
|
+
if (entry && typeof entry === "object") {
|
|
19583
|
+
const fields = entry;
|
|
19584
|
+
agents[name] = { model: asString(fields["model"]), binary: asString(fields["binary"]) };
|
|
19585
|
+
}
|
|
19586
|
+
}
|
|
19587
|
+
}
|
|
19588
|
+
const legacyModel = asString(store["agentModel"]);
|
|
19589
|
+
if (legacyModel && !agents[defaultAgent].model)
|
|
19590
|
+
agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
|
|
19591
|
+
return { defaultAgent, agents };
|
|
19592
|
+
}
|
|
19593
|
+
async function writeAgentConfig(config) {
|
|
19594
|
+
const existing = await readV1Store();
|
|
19595
|
+
const merged = { ...existing };
|
|
19596
|
+
const agents = {};
|
|
19597
|
+
for (const name of AGENT_NAMES) {
|
|
19598
|
+
const model = config.agents[name].model.trim();
|
|
19599
|
+
const binary = config.agents[name].binary.trim();
|
|
19600
|
+
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
19601
|
+
}
|
|
19602
|
+
merged["agent"] = config.defaultAgent;
|
|
19603
|
+
const defaultModel = agents[config.defaultAgent]?.model;
|
|
19604
|
+
if (defaultModel) merged["agentModel"] = defaultModel;
|
|
19605
|
+
else delete merged["agentModel"];
|
|
19606
|
+
if (Object.keys(agents).length > 0) merged["agents"] = agents;
|
|
19607
|
+
else delete merged["agents"];
|
|
19608
|
+
await writeV1Store(merged);
|
|
19609
|
+
}
|
|
19610
|
+
var DEFAULT_AGENT3, AGENT_LABELS, AGENT_HINTS, asString;
|
|
19611
|
+
var init_agent_store = __esm({
|
|
19612
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts"() {
|
|
19613
|
+
"use strict";
|
|
19614
|
+
init_src4();
|
|
19615
|
+
init_v1_store();
|
|
19616
|
+
DEFAULT_AGENT3 = "claude";
|
|
19617
|
+
AGENT_LABELS = {
|
|
19618
|
+
claude: "Claude Code",
|
|
19619
|
+
codex: "OpenAI Codex",
|
|
19620
|
+
opencode: "OpenCode",
|
|
19621
|
+
cursor: "Cursor",
|
|
19622
|
+
copilot: "GitHub Copilot"
|
|
19623
|
+
};
|
|
19624
|
+
AGENT_HINTS = {
|
|
19625
|
+
claude: "claude",
|
|
19626
|
+
codex: "codex",
|
|
19627
|
+
opencode: "opencode",
|
|
19628
|
+
cursor: "cursor-agent",
|
|
19629
|
+
copilot: "copilot"
|
|
19630
|
+
};
|
|
19631
|
+
asString = (value) => typeof value === "string" ? value : "";
|
|
19632
|
+
}
|
|
19633
|
+
});
|
|
19634
|
+
|
|
19635
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts
|
|
19636
|
+
function applyBinaryOverrides(config) {
|
|
19637
|
+
for (const name of AGENT_NAMES) {
|
|
19638
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
19639
|
+
const binary = config.agents[name].binary.trim();
|
|
19640
|
+
if (binary) {
|
|
19641
|
+
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
19642
|
+
process.env[key] = binary;
|
|
19643
|
+
} else if (shellValues.has(key)) {
|
|
19644
|
+
const shellValue = shellValues.get(key);
|
|
19645
|
+
if (shellValue === void 0) delete process.env[key];
|
|
19646
|
+
else process.env[key] = shellValue;
|
|
19647
|
+
shellValues.delete(key);
|
|
19648
|
+
}
|
|
19649
|
+
}
|
|
19650
|
+
}
|
|
19651
|
+
var shellValues;
|
|
19652
|
+
var init_apply_binary_overrides = __esm({
|
|
19653
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts"() {
|
|
19654
|
+
"use strict";
|
|
19655
|
+
init_src4();
|
|
19656
|
+
shellValues = /* @__PURE__ */ new Map();
|
|
19657
|
+
}
|
|
19658
|
+
});
|
|
19659
|
+
|
|
19568
19660
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
19569
19661
|
async function readAnalyticsSetting() {
|
|
19570
19662
|
const store = await readV1Store();
|
|
@@ -33030,7 +33122,8 @@ function FieldForm({
|
|
|
33030
33122
|
onQuit,
|
|
33031
33123
|
notice,
|
|
33032
33124
|
busy = false,
|
|
33033
|
-
footer
|
|
33125
|
+
footer,
|
|
33126
|
+
actions = []
|
|
33034
33127
|
}) {
|
|
33035
33128
|
const [active, setActive] = useState29(0);
|
|
33036
33129
|
const [editing, setEditing] = useState29(false);
|
|
@@ -33058,6 +33151,11 @@ function FieldForm({
|
|
|
33058
33151
|
onChange(current.key, "");
|
|
33059
33152
|
return;
|
|
33060
33153
|
}
|
|
33154
|
+
const action = actions.find((candidate) => candidate.key === input);
|
|
33155
|
+
if (action) {
|
|
33156
|
+
action.run();
|
|
33157
|
+
return;
|
|
33158
|
+
}
|
|
33061
33159
|
if (key.tab || key.downArrow) {
|
|
33062
33160
|
setActive((i) => (i + 1) % fields.length);
|
|
33063
33161
|
return;
|
|
@@ -33117,6 +33215,7 @@ function FieldForm({
|
|
|
33117
33215
|
{ keys: "\u23CE", label: "edit" },
|
|
33118
33216
|
{ keys: "c", label: "clear" },
|
|
33119
33217
|
{ keys: "s", label: "save" },
|
|
33218
|
+
...actions.map(({ key, label }) => ({ keys: key, label })),
|
|
33120
33219
|
{ keys: "Esc/q", label: "back without saving" }
|
|
33121
33220
|
]
|
|
33122
33221
|
}
|
|
@@ -33131,72 +33230,195 @@ var init_FieldForm = __esm({
|
|
|
33131
33230
|
}
|
|
33132
33231
|
});
|
|
33133
33232
|
|
|
33134
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/agent-
|
|
33135
|
-
|
|
33136
|
-
|
|
33233
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
|
|
33234
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
33235
|
+
import { access as access6, constants } from "node:fs/promises";
|
|
33236
|
+
function effectiveBinary(name, savedBinary) {
|
|
33237
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
33137
33238
|
}
|
|
33138
|
-
|
|
33139
|
-
const
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
|
|
33146
|
-
|
|
33147
|
-
|
|
33148
|
-
agents[name] = { model: asString(entry["model"]) };
|
|
33149
|
-
}
|
|
33239
|
+
function defaultModelLabel(name) {
|
|
33240
|
+
const model = DEFAULT_MODELS[name];
|
|
33241
|
+
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33242
|
+
}
|
|
33243
|
+
function resolveOnPath(binary) {
|
|
33244
|
+
if (binary.includes("/")) {
|
|
33245
|
+
return access6(binary, constants.X_OK).then(
|
|
33246
|
+
() => binary,
|
|
33247
|
+
() => null
|
|
33248
|
+
);
|
|
33150
33249
|
}
|
|
33151
|
-
|
|
33152
|
-
|
|
33153
|
-
|
|
33250
|
+
return new Promise((resolve28) => {
|
|
33251
|
+
execFile2(
|
|
33252
|
+
process.platform === "win32" ? "where" : "which",
|
|
33253
|
+
[binary],
|
|
33254
|
+
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
33255
|
+
);
|
|
33256
|
+
});
|
|
33154
33257
|
}
|
|
33155
|
-
|
|
33156
|
-
|
|
33157
|
-
|
|
33158
|
-
|
|
33159
|
-
|
|
33160
|
-
|
|
33161
|
-
|
|
33258
|
+
function readVersion(binary) {
|
|
33259
|
+
return new Promise((resolve28) => {
|
|
33260
|
+
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
33261
|
+
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
33262
|
+
if (!error && line) resolve28(pass("version", line));
|
|
33263
|
+
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
33264
|
+
});
|
|
33265
|
+
});
|
|
33266
|
+
}
|
|
33267
|
+
async function inspectAgent(name, binary) {
|
|
33268
|
+
const target = effectiveBinary(name, binary);
|
|
33269
|
+
const found = await resolveOnPath(target);
|
|
33270
|
+
if (!found) return [fail3("path", `\`${target}\` was not found or is not executable`)];
|
|
33271
|
+
const checks = [pass("path", found)];
|
|
33272
|
+
checks.push(await readVersion(found));
|
|
33273
|
+
if (name === "claude") {
|
|
33274
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
33275
|
+
checks.push(
|
|
33276
|
+
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33277
|
+
);
|
|
33162
33278
|
}
|
|
33163
|
-
|
|
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);
|
|
33279
|
+
return checks;
|
|
33170
33280
|
}
|
|
33171
|
-
|
|
33172
|
-
|
|
33173
|
-
|
|
33281
|
+
async function testAgent(name, binary, model) {
|
|
33282
|
+
const checks = await inspectAgent(name, binary);
|
|
33283
|
+
if (!checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33284
|
+
const target = effectiveBinary(name, binary);
|
|
33285
|
+
const found = await resolveOnPath(target) ?? target;
|
|
33286
|
+
const started = Date.now();
|
|
33287
|
+
const result = await withBinaryEnv(
|
|
33288
|
+
name,
|
|
33289
|
+
found,
|
|
33290
|
+
() => createLocalCliAgentInvoker().invoke({
|
|
33291
|
+
agent: name,
|
|
33292
|
+
...model.trim() ? { model: model.trim() } : {},
|
|
33293
|
+
prompt: TEST_PROMPT,
|
|
33294
|
+
timeoutMs: PROMPT_TIMEOUT_MS
|
|
33295
|
+
})
|
|
33296
|
+
);
|
|
33297
|
+
const seconds = ((Date.now() - started) / 1e3).toFixed(1);
|
|
33298
|
+
if (result.timedOut) return [...checks, fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`)];
|
|
33299
|
+
if (result.exitCode !== 0) {
|
|
33300
|
+
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
33301
|
+
return [...checks, fail3("prompt", reason)];
|
|
33302
|
+
}
|
|
33303
|
+
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33304
|
+
}
|
|
33305
|
+
function statusFromChecks(name, checks) {
|
|
33306
|
+
if (checks.length === 0) return "checking";
|
|
33307
|
+
if (checks.some((check) => check.step === "path" && !check.ok)) return "not-found";
|
|
33308
|
+
const login = checks.find((check) => check.step === "login");
|
|
33309
|
+
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33310
|
+
const prompt = checks.find((check) => check.step === "prompt");
|
|
33311
|
+
if (prompt) return prompt.ok ? "ready" : "not-logged-in";
|
|
33312
|
+
return name === "claude" ? "ready" : "unknown";
|
|
33313
|
+
}
|
|
33314
|
+
function nextStepHint(name, status) {
|
|
33315
|
+
if (status === "not-found") return INSTALL_HINTS[name];
|
|
33316
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33317
|
+
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33318
|
+
return "";
|
|
33319
|
+
}
|
|
33320
|
+
async function withBinaryEnv(name, binary, run) {
|
|
33321
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33322
|
+
const previous = process.env[key];
|
|
33323
|
+
process.env[key] = binary;
|
|
33324
|
+
try {
|
|
33325
|
+
return await run();
|
|
33326
|
+
} finally {
|
|
33327
|
+
if (previous === void 0) delete process.env[key];
|
|
33328
|
+
else process.env[key] = previous;
|
|
33329
|
+
}
|
|
33330
|
+
}
|
|
33331
|
+
var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail3, pass;
|
|
33332
|
+
var init_agent_status = __esm({
|
|
33333
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts"() {
|
|
33174
33334
|
"use strict";
|
|
33175
33335
|
init_src4();
|
|
33176
|
-
|
|
33177
|
-
|
|
33178
|
-
|
|
33179
|
-
|
|
33180
|
-
|
|
33181
|
-
|
|
33182
|
-
|
|
33183
|
-
|
|
33336
|
+
VERSION_TIMEOUT_MS = 5e3;
|
|
33337
|
+
PROMPT_TIMEOUT_MS = 6e4;
|
|
33338
|
+
TEST_PROMPT = "Reply with the single word: ok";
|
|
33339
|
+
INSTALL_HINTS = {
|
|
33340
|
+
claude: "npm install -g @anthropic-ai/claude-code",
|
|
33341
|
+
codex: "npm install -g @openai/codex",
|
|
33342
|
+
opencode: "npm install -g opencode-ai",
|
|
33343
|
+
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
33344
|
+
copilot: "npm install -g @github/copilot"
|
|
33184
33345
|
};
|
|
33185
|
-
|
|
33186
|
-
claude: "claude",
|
|
33187
|
-
codex: "
|
|
33188
|
-
opencode: "opencode",
|
|
33189
|
-
cursor: "
|
|
33190
|
-
copilot: "copilot"
|
|
33346
|
+
LOGIN_HINTS = {
|
|
33347
|
+
claude: "run `claude login`",
|
|
33348
|
+
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
33349
|
+
opencode: "run `opencode auth`",
|
|
33350
|
+
cursor: "sign in from Cursor",
|
|
33351
|
+
copilot: "run `copilot` and sign in"
|
|
33352
|
+
};
|
|
33353
|
+
fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
33354
|
+
pass = (step, detail) => ({ step, ok: true, detail });
|
|
33355
|
+
}
|
|
33356
|
+
});
|
|
33357
|
+
|
|
33358
|
+
// packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusLine.tsx
|
|
33359
|
+
import { Box as Box45, Text as Text47 } from "ink";
|
|
33360
|
+
import { jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33361
|
+
function AgentStatusBadge({
|
|
33362
|
+
name,
|
|
33363
|
+
checks
|
|
33364
|
+
}) {
|
|
33365
|
+
const status = checks ? statusFromChecks(name, checks) : "checking";
|
|
33366
|
+
return /* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] });
|
|
33367
|
+
}
|
|
33368
|
+
function AgentChecks({
|
|
33369
|
+
name,
|
|
33370
|
+
checks
|
|
33371
|
+
}) {
|
|
33372
|
+
if (!checks) {
|
|
33373
|
+
return /* @__PURE__ */ jsx56(Box45, { marginTop: 1, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Checking..." }) });
|
|
33374
|
+
}
|
|
33375
|
+
const status = statusFromChecks(name, checks);
|
|
33376
|
+
const hint = nextStepHint(name, status);
|
|
33377
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
33378
|
+
/* @__PURE__ */ jsxs46(Text47, { bold: true, children: [
|
|
33379
|
+
"Status: ",
|
|
33380
|
+
/* @__PURE__ */ jsx56(Text47, { color: STATUS_COLOR[status], children: STATUS_TEXT[status] })
|
|
33381
|
+
] }),
|
|
33382
|
+
checks.map((check) => /* @__PURE__ */ jsxs46(Text47, { color: check.ok ? PALETTE.success : PALETTE.muted, children: [
|
|
33383
|
+
check.ok ? "\u2713" : "\xB7",
|
|
33384
|
+
" ",
|
|
33385
|
+
check.step,
|
|
33386
|
+
": ",
|
|
33387
|
+
check.detail
|
|
33388
|
+
] }, check.step)),
|
|
33389
|
+
hint && /* @__PURE__ */ jsxs46(Text47, { color: PALETTE.muted, children: [
|
|
33390
|
+
"Next: ",
|
|
33391
|
+
hint
|
|
33392
|
+
] })
|
|
33393
|
+
] });
|
|
33394
|
+
}
|
|
33395
|
+
var STATUS_TEXT, STATUS_COLOR;
|
|
33396
|
+
var init_AgentStatusLine = __esm({
|
|
33397
|
+
"packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusLine.tsx"() {
|
|
33398
|
+
"use strict";
|
|
33399
|
+
init_home_theme();
|
|
33400
|
+
init_agent_status();
|
|
33401
|
+
STATUS_TEXT = {
|
|
33402
|
+
checking: "checking...",
|
|
33403
|
+
ready: "ready",
|
|
33404
|
+
"not-found": "not found",
|
|
33405
|
+
"not-logged-in": "not logged in",
|
|
33406
|
+
unknown: "found, login not checked"
|
|
33407
|
+
};
|
|
33408
|
+
STATUS_COLOR = {
|
|
33409
|
+
checking: PALETTE.muted,
|
|
33410
|
+
ready: PALETTE.success,
|
|
33411
|
+
"not-found": PALETTE.error,
|
|
33412
|
+
"not-logged-in": PALETTE.error,
|
|
33413
|
+
unknown: PALETTE.muted
|
|
33191
33414
|
};
|
|
33192
|
-
asString = (value) => typeof value === "string" ? value : "";
|
|
33193
33415
|
}
|
|
33194
33416
|
});
|
|
33195
33417
|
|
|
33196
33418
|
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
33197
33419
|
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
33198
|
-
import { Box as
|
|
33199
|
-
import { Fragment as Fragment18, jsx as
|
|
33420
|
+
import { Box as Box46, Text as Text48, useInput as useInput12 } from "ink";
|
|
33421
|
+
import { Fragment as Fragment18, jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33200
33422
|
function AgentForm({
|
|
33201
33423
|
name,
|
|
33202
33424
|
config,
|
|
@@ -33204,29 +33426,53 @@ function AgentForm({
|
|
|
33204
33426
|
onBack
|
|
33205
33427
|
}) {
|
|
33206
33428
|
const [saving, setSaving] = useState30(false);
|
|
33429
|
+
const [testing, setTesting] = useState30(false);
|
|
33207
33430
|
const [notice, setNotice] = useState30(null);
|
|
33431
|
+
const [checks, setChecks] = useState30(void 0);
|
|
33432
|
+
const settings = config.agents[name];
|
|
33433
|
+
useEffect22(() => {
|
|
33434
|
+
let current = true;
|
|
33435
|
+
setChecks(void 0);
|
|
33436
|
+
void inspectAgent(name, settings.binary).then((result) => current && setChecks(result));
|
|
33437
|
+
return () => {
|
|
33438
|
+
current = false;
|
|
33439
|
+
};
|
|
33440
|
+
}, [name, settings.binary]);
|
|
33208
33441
|
const save = () => {
|
|
33209
33442
|
setSaving(true);
|
|
33210
33443
|
setNotice(null);
|
|
33211
|
-
writeAgentConfig(config).then(() =>
|
|
33444
|
+
writeAgentConfig(config).then(() => {
|
|
33445
|
+
applyBinaryOverrides(config);
|
|
33446
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} settings saved` });
|
|
33447
|
+
}).catch(
|
|
33212
33448
|
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
|
|
33213
33449
|
).finally(() => setSaving(false));
|
|
33214
33450
|
};
|
|
33215
|
-
|
|
33451
|
+
const runFullTest = () => {
|
|
33452
|
+
setTesting(true);
|
|
33453
|
+
setNotice(null);
|
|
33454
|
+
setChecks(void 0);
|
|
33455
|
+
testAgent(name, settings.binary, settings.model).then(setChecks).catch(
|
|
33456
|
+
(err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "The test could not run" })
|
|
33457
|
+
).finally(() => setTesting(false));
|
|
33458
|
+
};
|
|
33459
|
+
return /* @__PURE__ */ jsx57(
|
|
33216
33460
|
FieldForm,
|
|
33217
33461
|
{
|
|
33218
33462
|
title: AGENT_LABELS[name],
|
|
33219
33463
|
subtitle: `Runs the \`${AGENT_HINTS[name]}\` command. ${config.defaultAgent === name ? "This is the default agent." : ""}`.trim(),
|
|
33220
|
-
fields:
|
|
33221
|
-
values: { model:
|
|
33222
|
-
onChange: (
|
|
33223
|
-
setConfig({ ...config, agents: { ...config.agents, [name]: {
|
|
33464
|
+
fields: agentFields(name),
|
|
33465
|
+
values: { binary: settings.binary, model: settings.model },
|
|
33466
|
+
onChange: (key, value) => {
|
|
33467
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
33224
33468
|
setNotice(null);
|
|
33225
33469
|
},
|
|
33226
33470
|
onSave: save,
|
|
33227
33471
|
onQuit: onBack,
|
|
33228
33472
|
notice,
|
|
33229
|
-
busy: saving
|
|
33473
|
+
busy: saving || testing,
|
|
33474
|
+
footer: /* @__PURE__ */ jsx57(AgentChecks, { name, checks }),
|
|
33475
|
+
actions: [{ key: "t", label: "full test (uses a few tokens)", run: runFullTest }]
|
|
33230
33476
|
}
|
|
33231
33477
|
);
|
|
33232
33478
|
}
|
|
@@ -33235,9 +33481,18 @@ function AgentsScreen({ onDone }) {
|
|
|
33235
33481
|
const [focus, setFocus] = useState30(0);
|
|
33236
33482
|
const [open, setOpen] = useState30(null);
|
|
33237
33483
|
const [notice, setNotice] = useState30(null);
|
|
33484
|
+
const [checks, setChecks] = useState30({});
|
|
33485
|
+
const inspectAll = (loaded) => {
|
|
33486
|
+
for (const name of AGENT_NAMES) {
|
|
33487
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
33488
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
33489
|
+
);
|
|
33490
|
+
}
|
|
33491
|
+
};
|
|
33238
33492
|
useEffect22(() => {
|
|
33239
33493
|
void readAgentConfig().then((loaded) => {
|
|
33240
33494
|
setConfig(loaded);
|
|
33495
|
+
inspectAll(loaded);
|
|
33241
33496
|
startDebugRun({
|
|
33242
33497
|
flow: "settings/agents",
|
|
33243
33498
|
step: "01-agents",
|
|
@@ -33285,47 +33540,62 @@ function AgentsScreen({ onDone }) {
|
|
|
33285
33540
|
}
|
|
33286
33541
|
});
|
|
33287
33542
|
if (!config) {
|
|
33288
|
-
return /* @__PURE__ */
|
|
33289
|
-
/* @__PURE__ */
|
|
33290
|
-
/* @__PURE__ */
|
|
33291
|
-
/* @__PURE__ */
|
|
33543
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33544
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33545
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33546
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
33292
33547
|
] });
|
|
33293
33548
|
}
|
|
33294
33549
|
if (open) {
|
|
33295
|
-
return /* @__PURE__ */
|
|
33550
|
+
return /* @__PURE__ */ jsx57(
|
|
33551
|
+
AgentForm,
|
|
33552
|
+
{
|
|
33553
|
+
name: open,
|
|
33554
|
+
config,
|
|
33555
|
+
setConfig,
|
|
33556
|
+
onBack: () => {
|
|
33557
|
+
setOpen(null);
|
|
33558
|
+
void readAgentConfig().then((saved) => {
|
|
33559
|
+
setConfig(saved);
|
|
33560
|
+
inspectAll(saved);
|
|
33561
|
+
});
|
|
33562
|
+
}
|
|
33563
|
+
}
|
|
33564
|
+
);
|
|
33296
33565
|
}
|
|
33297
|
-
return /* @__PURE__ */
|
|
33298
|
-
/* @__PURE__ */
|
|
33299
|
-
/* @__PURE__ */
|
|
33300
|
-
/* @__PURE__ */
|
|
33566
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33567
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33568
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and the settings for each one." }),
|
|
33569
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33301
33570
|
ROWS.map((row, index) => {
|
|
33302
33571
|
const isFocused = index === focus;
|
|
33303
|
-
const pointer = /* @__PURE__ */
|
|
33572
|
+
const pointer = /* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
33304
33573
|
if (row.kind === "default") {
|
|
33305
|
-
return /* @__PURE__ */
|
|
33574
|
+
return /* @__PURE__ */ jsx57(Box46, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33306
33575
|
pointer,
|
|
33307
|
-
/* @__PURE__ */
|
|
33308
|
-
/* @__PURE__ */
|
|
33576
|
+
/* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: "Default agent" }),
|
|
33577
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: `\u2039 ${AGENT_LABELS[config.defaultAgent]} \u203A` })
|
|
33309
33578
|
] }) }, "default");
|
|
33310
33579
|
}
|
|
33311
33580
|
const model = config.agents[row.name].model;
|
|
33312
|
-
return /* @__PURE__ */
|
|
33581
|
+
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33313
33582
|
pointer,
|
|
33314
|
-
/* @__PURE__ */
|
|
33315
|
-
/* @__PURE__ */
|
|
33316
|
-
|
|
33583
|
+
/* @__PURE__ */ jsx57(Box46, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[row.name] }) }),
|
|
33584
|
+
/* @__PURE__ */ jsx57(Box46, { width: 26, flexShrink: 0, children: /* @__PURE__ */ jsx57(AgentStatusBadge, { name: row.name, checks: checks[row.name] }) }),
|
|
33585
|
+
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: `model: ${model || defaultModelLabel(row.name)}` }),
|
|
33586
|
+
row.name === config.defaultAgent && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: "(default)" })
|
|
33317
33587
|
] }, row.name);
|
|
33318
33588
|
}),
|
|
33319
|
-
notice && /* @__PURE__ */
|
|
33320
|
-
/* @__PURE__ */
|
|
33321
|
-
/* @__PURE__ */
|
|
33589
|
+
notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
33590
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33591
|
+
/* @__PURE__ */ jsxs47(Text48, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33322
33592
|
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33323
33593
|
" ",
|
|
33324
33594
|
notice.text
|
|
33325
33595
|
] })
|
|
33326
33596
|
] }),
|
|
33327
|
-
/* @__PURE__ */
|
|
33328
|
-
/* @__PURE__ */
|
|
33597
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33598
|
+
/* @__PURE__ */ jsx57(
|
|
33329
33599
|
ControlHints,
|
|
33330
33600
|
{
|
|
33331
33601
|
hints: ROWS[focus].kind === "default" ? [
|
|
@@ -33341,7 +33611,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33341
33611
|
)
|
|
33342
33612
|
] });
|
|
33343
33613
|
}
|
|
33344
|
-
var
|
|
33614
|
+
var agentFields, ROWS;
|
|
33345
33615
|
var init_AgentScreens = __esm({
|
|
33346
33616
|
"packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx"() {
|
|
33347
33617
|
"use strict";
|
|
@@ -33351,8 +33621,12 @@ var init_AgentScreens = __esm({
|
|
|
33351
33621
|
init_debug_store();
|
|
33352
33622
|
init_FieldForm();
|
|
33353
33623
|
init_agent_store();
|
|
33354
|
-
|
|
33355
|
-
|
|
33624
|
+
init_agent_status();
|
|
33625
|
+
init_AgentStatusLine();
|
|
33626
|
+
init_apply_binary_overrides();
|
|
33627
|
+
agentFields = (name) => [
|
|
33628
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` },
|
|
33629
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33356
33630
|
];
|
|
33357
33631
|
ROWS = [{ kind: "default" }, ...AGENT_NAMES.map((name) => ({ kind: "agent", name }))];
|
|
33358
33632
|
}
|
|
@@ -33391,8 +33665,8 @@ var init_config_store = __esm({
|
|
|
33391
33665
|
|
|
33392
33666
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
|
|
33393
33667
|
import { useEffect as useEffect23, useState as useState31 } from "react";
|
|
33394
|
-
import { Box as
|
|
33395
|
-
import { jsx as
|
|
33668
|
+
import { Box as Box47, Text as Text49 } from "ink";
|
|
33669
|
+
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33396
33670
|
function debugFields(config) {
|
|
33397
33671
|
return {
|
|
33398
33672
|
space_id: config?.spaceId ?? "",
|
|
@@ -33421,10 +33695,10 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
33421
33695
|
});
|
|
33422
33696
|
}, []);
|
|
33423
33697
|
if (!config) {
|
|
33424
|
-
return /* @__PURE__ */
|
|
33425
|
-
/* @__PURE__ */
|
|
33426
|
-
/* @__PURE__ */
|
|
33427
|
-
/* @__PURE__ */
|
|
33698
|
+
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33699
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Project" }),
|
|
33700
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33701
|
+
/* @__PURE__ */ jsx58(Text49, { color: PALETTE.accent, children: "Loading..." })
|
|
33428
33702
|
] });
|
|
33429
33703
|
}
|
|
33430
33704
|
const save = () => {
|
|
@@ -33444,7 +33718,7 @@ function ProjectConfigScreen({ onDone }) {
|
|
|
33444
33718
|
);
|
|
33445
33719
|
onDone();
|
|
33446
33720
|
};
|
|
33447
|
-
return /* @__PURE__ */
|
|
33721
|
+
return /* @__PURE__ */ jsx58(
|
|
33448
33722
|
FieldForm,
|
|
33449
33723
|
{
|
|
33450
33724
|
title: "Project",
|
|
@@ -33485,8 +33759,8 @@ var init_ProjectConfigScreen = __esm({
|
|
|
33485
33759
|
|
|
33486
33760
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
33487
33761
|
import { useState as useState32 } from "react";
|
|
33488
|
-
import { Box as
|
|
33489
|
-
import { jsx as
|
|
33762
|
+
import { Box as Box48, Text as Text50, useInput as useInput13 } from "ink";
|
|
33763
|
+
import { jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33490
33764
|
function ConfigurationScreen({ onDone }) {
|
|
33491
33765
|
const [focus, setFocus] = useState32(0);
|
|
33492
33766
|
const [open, setOpen] = useState32(null);
|
|
@@ -33507,18 +33781,18 @@ function ConfigurationScreen({ onDone }) {
|
|
|
33507
33781
|
}
|
|
33508
33782
|
if (key.escape || input === "q") onDone();
|
|
33509
33783
|
});
|
|
33510
|
-
if (open === "project") return /* @__PURE__ */
|
|
33511
|
-
if (open === "agents") return /* @__PURE__ */
|
|
33512
|
-
return /* @__PURE__ */
|
|
33513
|
-
/* @__PURE__ */
|
|
33514
|
-
/* @__PURE__ */
|
|
33515
|
-
SECTIONS.map((section, index) => /* @__PURE__ */
|
|
33516
|
-
/* @__PURE__ */
|
|
33517
|
-
/* @__PURE__ */
|
|
33518
|
-
/* @__PURE__ */
|
|
33784
|
+
if (open === "project") return /* @__PURE__ */ jsx59(ProjectConfigScreen, { onDone: close });
|
|
33785
|
+
if (open === "agents") return /* @__PURE__ */ jsx59(AgentsScreen, { onDone: close });
|
|
33786
|
+
return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33787
|
+
/* @__PURE__ */ jsx59(Text50, { bold: true, children: "Configuration" }),
|
|
33788
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33789
|
+
SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
|
|
33790
|
+
/* @__PURE__ */ jsx59(Text50, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
|
|
33791
|
+
/* @__PURE__ */ jsx59(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx59(Text50, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
|
|
33792
|
+
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: section.description })
|
|
33519
33793
|
] }, section.id)),
|
|
33520
|
-
/* @__PURE__ */
|
|
33521
|
-
/* @__PURE__ */
|
|
33794
|
+
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33795
|
+
/* @__PURE__ */ jsx59(
|
|
33522
33796
|
ControlHints,
|
|
33523
33797
|
{
|
|
33524
33798
|
hints: [
|
|
@@ -33551,8 +33825,8 @@ var init_ContentfulConfigScreen = __esm({
|
|
|
33551
33825
|
|
|
33552
33826
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
33553
33827
|
import { useEffect as useEffect24, useState as useState33 } from "react";
|
|
33554
|
-
import { Box as
|
|
33555
|
-
import { Fragment as Fragment19, jsx as
|
|
33828
|
+
import { Box as Box49, Text as Text51, useInput as useInput14 } from "ink";
|
|
33829
|
+
import { Fragment as Fragment19, jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
33556
33830
|
function OptInAnalyticsScreen({ onDone }) {
|
|
33557
33831
|
const [loading, setLoading] = useState33(true);
|
|
33558
33832
|
const [enabled, setEnabled] = useState33(true);
|
|
@@ -33583,21 +33857,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
33583
33857
|
onDone();
|
|
33584
33858
|
}
|
|
33585
33859
|
});
|
|
33586
|
-
return /* @__PURE__ */
|
|
33587
|
-
/* @__PURE__ */
|
|
33588
|
-
/* @__PURE__ */
|
|
33589
|
-
loading ? /* @__PURE__ */
|
|
33590
|
-
/* @__PURE__ */
|
|
33860
|
+
return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33861
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33862
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33863
|
+
loading ? /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment19, { children: [
|
|
33864
|
+
/* @__PURE__ */ jsxs50(Text51, { children: [
|
|
33591
33865
|
"Share anonymous usage data:",
|
|
33592
33866
|
" ",
|
|
33593
|
-
/* @__PURE__ */
|
|
33867
|
+
/* @__PURE__ */ jsx60(Text51, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33594
33868
|
] }),
|
|
33595
|
-
/* @__PURE__ */
|
|
33596
|
-
/* @__PURE__ */
|
|
33597
|
-
/* @__PURE__ */
|
|
33869
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33870
|
+
/* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
33871
|
+
/* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
33598
33872
|
] }),
|
|
33599
|
-
/* @__PURE__ */
|
|
33600
|
-
/* @__PURE__ */
|
|
33873
|
+
/* @__PURE__ */ jsx60(Text51, { children: " " }),
|
|
33874
|
+
/* @__PURE__ */ jsx60(
|
|
33601
33875
|
ControlHints,
|
|
33602
33876
|
{
|
|
33603
33877
|
hints: [
|
|
@@ -33620,8 +33894,8 @@ var init_screen11 = __esm({
|
|
|
33620
33894
|
|
|
33621
33895
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
33622
33896
|
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
33623
|
-
import { Box as
|
|
33624
|
-
import { jsx as
|
|
33897
|
+
import { Box as Box50, Text as Text52, useInput as useInput15 } from "ink";
|
|
33898
|
+
import { jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
33625
33899
|
function UpgradeScreen({ onDone }) {
|
|
33626
33900
|
const [upgradeCheck, setUpgradeCheck] = useState34();
|
|
33627
33901
|
useEffect25(() => {
|
|
@@ -33644,12 +33918,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
33644
33918
|
return;
|
|
33645
33919
|
}
|
|
33646
33920
|
});
|
|
33647
|
-
return /* @__PURE__ */
|
|
33648
|
-
/* @__PURE__ */
|
|
33649
|
-
/* @__PURE__ */
|
|
33921
|
+
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33922
|
+
/* @__PURE__ */ jsx61(Text52, { bold: true, children: "Upgrade" }),
|
|
33923
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33650
33924
|
renderBody(upgradeCheck),
|
|
33651
|
-
/* @__PURE__ */
|
|
33652
|
-
/* @__PURE__ */
|
|
33925
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33926
|
+
/* @__PURE__ */ jsxs51(Text52, { bold: true, color: PALETTE.accent, children: [
|
|
33653
33927
|
FOCUS_MARKER,
|
|
33654
33928
|
" Go Back"
|
|
33655
33929
|
] })
|
|
@@ -33657,34 +33931,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
33657
33931
|
}
|
|
33658
33932
|
function renderBody(upgradeCheck) {
|
|
33659
33933
|
if (!upgradeCheck) {
|
|
33660
|
-
return /* @__PURE__ */
|
|
33934
|
+
return /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
33661
33935
|
}
|
|
33662
33936
|
if (upgradeCheck.status === "error") {
|
|
33663
|
-
return /* @__PURE__ */
|
|
33937
|
+
return /* @__PURE__ */ jsx61(Text52, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
33664
33938
|
}
|
|
33665
33939
|
if (upgradeCheck.status === "up-to-date") {
|
|
33666
|
-
return /* @__PURE__ */
|
|
33940
|
+
return /* @__PURE__ */ jsxs51(Text52, { color: PALETTE.success, children: [
|
|
33667
33941
|
"You're already on the latest version (v",
|
|
33668
33942
|
upgradeCheck.current,
|
|
33669
33943
|
")."
|
|
33670
33944
|
] });
|
|
33671
33945
|
}
|
|
33672
|
-
return /* @__PURE__ */
|
|
33673
|
-
/* @__PURE__ */
|
|
33674
|
-
/* @__PURE__ */
|
|
33946
|
+
return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
|
|
33947
|
+
/* @__PURE__ */ jsxs51(Text52, { color: PALETTE.muted, children: [
|
|
33948
|
+
/* @__PURE__ */ jsxs51(Text52, { bold: true, color: PALETTE.success, children: [
|
|
33675
33949
|
"v",
|
|
33676
33950
|
upgradeCheck.latest
|
|
33677
33951
|
] }),
|
|
33678
33952
|
" ",
|
|
33679
33953
|
"is available (you're on ",
|
|
33680
|
-
/* @__PURE__ */
|
|
33954
|
+
/* @__PURE__ */ jsxs51(Text52, { bold: true, children: [
|
|
33681
33955
|
"v",
|
|
33682
33956
|
upgradeCheck.current
|
|
33683
33957
|
] }),
|
|
33684
33958
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
33685
33959
|
] }),
|
|
33686
|
-
/* @__PURE__ */
|
|
33687
|
-
/* @__PURE__ */
|
|
33960
|
+
/* @__PURE__ */ jsx61(Text52, { children: " " }),
|
|
33961
|
+
/* @__PURE__ */ jsx61(Box50, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx61(Text52, { bold: true, children: cmd }, cmd)) })
|
|
33688
33962
|
] });
|
|
33689
33963
|
}
|
|
33690
33964
|
var UPGRADE_COMMANDS;
|
|
@@ -33700,8 +33974,8 @@ var init_PageContainer4 = __esm({
|
|
|
33700
33974
|
|
|
33701
33975
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
33702
33976
|
import { useEffect as useEffect26, useState as useState35 } from "react";
|
|
33703
|
-
import { Box as
|
|
33704
|
-
import { jsx as
|
|
33977
|
+
import { Box as Box51, Text as Text53, useInput as useInput16 } from "ink";
|
|
33978
|
+
import { jsx as jsx62, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
33705
33979
|
function DebugModeScreen({ onDone }) {
|
|
33706
33980
|
const [loading, setLoading] = useState35(true);
|
|
33707
33981
|
const [enabled, setEnabled] = useState35(true);
|
|
@@ -33732,16 +34006,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
33732
34006
|
onDone();
|
|
33733
34007
|
}
|
|
33734
34008
|
});
|
|
33735
|
-
return /* @__PURE__ */
|
|
33736
|
-
/* @__PURE__ */
|
|
33737
|
-
/* @__PURE__ */
|
|
33738
|
-
loading ? /* @__PURE__ */
|
|
34009
|
+
return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
34010
|
+
/* @__PURE__ */ jsx62(Text53, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
34011
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34012
|
+
loading ? /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text53, { children: [
|
|
33739
34013
|
"Debug logging:",
|
|
33740
34014
|
" ",
|
|
33741
|
-
/* @__PURE__ */
|
|
34015
|
+
/* @__PURE__ */ jsx62(Text53, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
33742
34016
|
] }),
|
|
33743
|
-
/* @__PURE__ */
|
|
33744
|
-
/* @__PURE__ */
|
|
34017
|
+
/* @__PURE__ */ jsx62(Text53, { children: " " }),
|
|
34018
|
+
/* @__PURE__ */ jsx62(
|
|
33745
34019
|
ControlHints,
|
|
33746
34020
|
{
|
|
33747
34021
|
hints: [
|
|
@@ -33769,7 +34043,7 @@ __export(app_exports, {
|
|
|
33769
34043
|
});
|
|
33770
34044
|
import { join as join28 } from "node:path";
|
|
33771
34045
|
import { useEffect as useEffect27, useState as useState36 } from "react";
|
|
33772
|
-
import { Fragment as Fragment20, jsx as
|
|
34046
|
+
import { Fragment as Fragment20, jsx as jsx63 } from "react/jsx-runtime";
|
|
33773
34047
|
function App({ importOptions, inkClear }) {
|
|
33774
34048
|
const [screen, setScreen] = useState36("start");
|
|
33775
34049
|
const [importExitCode, setImportExitCode] = useState36();
|
|
@@ -33926,9 +34200,9 @@ function App({ importOptions, inkClear }) {
|
|
|
33926
34200
|
};
|
|
33927
34201
|
switch (screen) {
|
|
33928
34202
|
case "import":
|
|
33929
|
-
if (showImportResult) return /* @__PURE__ */
|
|
34203
|
+
if (showImportResult) return /* @__PURE__ */ jsx63(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
33930
34204
|
if (flow && flowStart) {
|
|
33931
|
-
return /* @__PURE__ */
|
|
34205
|
+
return /* @__PURE__ */ jsx63(
|
|
33932
34206
|
FlowScreen,
|
|
33933
34207
|
{
|
|
33934
34208
|
state: flow.state,
|
|
@@ -33938,12 +34212,12 @@ function App({ importOptions, inkClear }) {
|
|
|
33938
34212
|
}
|
|
33939
34213
|
);
|
|
33940
34214
|
}
|
|
33941
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
34215
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment20, {});
|
|
33942
34216
|
if (projectPath === void 0) {
|
|
33943
|
-
return /* @__PURE__ */
|
|
34217
|
+
return /* @__PURE__ */ jsx63(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
33944
34218
|
}
|
|
33945
34219
|
if (tokensPath === void 0) {
|
|
33946
|
-
return /* @__PURE__ */
|
|
34220
|
+
return /* @__PURE__ */ jsx63(
|
|
33947
34221
|
TokenInputScreen,
|
|
33948
34222
|
{
|
|
33949
34223
|
initialPath: importDefaults.tokenFile,
|
|
@@ -33953,7 +34227,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33953
34227
|
);
|
|
33954
34228
|
}
|
|
33955
34229
|
if (scannedFiles === void 0) {
|
|
33956
|
-
return /* @__PURE__ */
|
|
34230
|
+
return /* @__PURE__ */ jsx63(
|
|
33957
34231
|
PathValidationScreen,
|
|
33958
34232
|
{
|
|
33959
34233
|
projectPath,
|
|
@@ -33965,10 +34239,10 @@ function App({ importOptions, inkClear }) {
|
|
|
33965
34239
|
}
|
|
33966
34240
|
if (extractionRun) {
|
|
33967
34241
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
33968
|
-
return /* @__PURE__ */
|
|
34242
|
+
return /* @__PURE__ */ jsx63(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
33969
34243
|
}
|
|
33970
34244
|
if (extraction?.status === "running") {
|
|
33971
|
-
return /* @__PURE__ */
|
|
34245
|
+
return /* @__PURE__ */ jsx63(
|
|
33972
34246
|
ExtractionScreen,
|
|
33973
34247
|
{
|
|
33974
34248
|
progress: extraction.progress,
|
|
@@ -33977,14 +34251,14 @@ function App({ importOptions, inkClear }) {
|
|
|
33977
34251
|
}
|
|
33978
34252
|
);
|
|
33979
34253
|
}
|
|
33980
|
-
return /* @__PURE__ */
|
|
34254
|
+
return /* @__PURE__ */ jsx63(Fragment20, {});
|
|
33981
34255
|
}
|
|
33982
34256
|
if (scopeRun && scopeFlow) {
|
|
33983
34257
|
if (scopeFlow.status === "failed") {
|
|
33984
|
-
return /* @__PURE__ */
|
|
34258
|
+
return /* @__PURE__ */ jsx63(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
33985
34259
|
}
|
|
33986
34260
|
if (scopeFlow.status === "deciding") {
|
|
33987
|
-
return /* @__PURE__ */
|
|
34261
|
+
return /* @__PURE__ */ jsx63(
|
|
33988
34262
|
ScopeGateScreen,
|
|
33989
34263
|
{
|
|
33990
34264
|
components: scopeFlow.load.components,
|
|
@@ -33994,7 +34268,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33994
34268
|
);
|
|
33995
34269
|
}
|
|
33996
34270
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
33997
|
-
return /* @__PURE__ */
|
|
34271
|
+
return /* @__PURE__ */ jsx63(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
33998
34272
|
}
|
|
33999
34273
|
if (generation?.status === "running") {
|
|
34000
34274
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -34002,7 +34276,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34002
34276
|
hasRawTokens,
|
|
34003
34277
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
34004
34278
|
});
|
|
34005
|
-
return /* @__PURE__ */
|
|
34279
|
+
return /* @__PURE__ */ jsx63(
|
|
34006
34280
|
GenerationScreen,
|
|
34007
34281
|
{
|
|
34008
34282
|
progress: generation.progress,
|
|
@@ -34014,10 +34288,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34014
34288
|
}
|
|
34015
34289
|
);
|
|
34016
34290
|
}
|
|
34017
|
-
return /* @__PURE__ */
|
|
34291
|
+
return /* @__PURE__ */ jsx63(Fragment20, {});
|
|
34018
34292
|
}
|
|
34019
34293
|
if (pendingLaunch?.cached) {
|
|
34020
|
-
return /* @__PURE__ */
|
|
34294
|
+
return /* @__PURE__ */ jsx63(
|
|
34021
34295
|
TokenReuseScreen,
|
|
34022
34296
|
{
|
|
34023
34297
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -34028,7 +34302,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34028
34302
|
}
|
|
34029
34303
|
);
|
|
34030
34304
|
}
|
|
34031
|
-
return /* @__PURE__ */
|
|
34305
|
+
return /* @__PURE__ */ jsx63(
|
|
34032
34306
|
CredentialsScreen,
|
|
34033
34307
|
{
|
|
34034
34308
|
initial: importDefaults.credentials,
|
|
@@ -34037,19 +34311,19 @@ function App({ importOptions, inkClear }) {
|
|
|
34037
34311
|
}
|
|
34038
34312
|
);
|
|
34039
34313
|
case "help":
|
|
34040
|
-
return /* @__PURE__ */
|
|
34314
|
+
return /* @__PURE__ */ jsx63(HelpScreen, { onDone: goToStart });
|
|
34041
34315
|
case "upgrade":
|
|
34042
|
-
return /* @__PURE__ */
|
|
34316
|
+
return /* @__PURE__ */ jsx63(UpgradeScreen, { onDone: goToStart });
|
|
34043
34317
|
case "settings":
|
|
34044
|
-
return /* @__PURE__ */
|
|
34318
|
+
return /* @__PURE__ */ jsx63(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
34045
34319
|
case "settings-configuration":
|
|
34046
|
-
return /* @__PURE__ */
|
|
34320
|
+
return /* @__PURE__ */ jsx63(ConfigurationScreen, { onDone: goToSettings });
|
|
34047
34321
|
case "settings-opt-in-analytics":
|
|
34048
|
-
return /* @__PURE__ */
|
|
34322
|
+
return /* @__PURE__ */ jsx63(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
34049
34323
|
case "settings-debug-mode":
|
|
34050
|
-
return /* @__PURE__ */
|
|
34324
|
+
return /* @__PURE__ */ jsx63(DebugModeScreen, { onDone: goToSettings });
|
|
34051
34325
|
case "start":
|
|
34052
|
-
return /* @__PURE__ */
|
|
34326
|
+
return /* @__PURE__ */ jsx63(HomeScreen, { onNavigate: setScreen });
|
|
34053
34327
|
}
|
|
34054
34328
|
}
|
|
34055
34329
|
async function runApp(renderApp, importOptions) {
|
|
@@ -34057,7 +34331,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
34057
34331
|
instance.clear?.();
|
|
34058
34332
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
34059
34333
|
};
|
|
34060
|
-
const instance = renderApp(/* @__PURE__ */
|
|
34334
|
+
const instance = renderApp(/* @__PURE__ */ jsx63(App, { importOptions, inkClear }));
|
|
34061
34335
|
await instance.waitUntilExit();
|
|
34062
34336
|
}
|
|
34063
34337
|
var init_app = __esm({
|
|
@@ -34225,6 +34499,8 @@ function registerImportCommand(program, openTui) {
|
|
|
34225
34499
|
}
|
|
34226
34500
|
|
|
34227
34501
|
// packages/experience-design-system-cli/program.ts
|
|
34502
|
+
init_agent_store();
|
|
34503
|
+
init_apply_binary_overrides();
|
|
34228
34504
|
init_analytics_store();
|
|
34229
34505
|
init_package_root();
|
|
34230
34506
|
var pkg = JSON.parse(
|
|
@@ -34247,6 +34523,7 @@ function createProgram() {
|
|
|
34247
34523
|
const commandChain = chain.join(" ") || actionCommand.name();
|
|
34248
34524
|
const { enabled } = await readAnalyticsSetting();
|
|
34249
34525
|
setPersistedAnalyticsDisabled(!enabled);
|
|
34526
|
+
await readAgentConfig().then(applyBinaryOverrides, () => void 0);
|
|
34250
34527
|
setCliVersion(pkg.version);
|
|
34251
34528
|
noteCommandStart(commandChain);
|
|
34252
34529
|
});
|