@contentful/experience-design-system-cli 2.43.1-dev-build-044e6594.0 → 2.43.1-dev-build-30e824d7.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 +15027 -14951
- package/dist/index.js +424 -332
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +11 -3
- package/dist/src/tui/import/steps/00-preflight/log.d.ts +25 -0
- package/dist/src/tui/import/steps/00-preflight/logic.d.ts +2 -0
- package/dist/src/tui/import/steps/01-welcome/log.d.ts +13 -0
- package/dist/src/tui/settings/configuration/agents/agent-debug.d.ts +10 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -19592,12 +19592,11 @@ function startDebugRun({
|
|
|
19592
19592
|
flow,
|
|
19593
19593
|
step,
|
|
19594
19594
|
menuOption,
|
|
19595
|
-
inputs
|
|
19595
|
+
inputs = {}
|
|
19596
19596
|
}) {
|
|
19597
|
-
const runId = generateRunId();
|
|
19598
19597
|
const startedAt = Date.now();
|
|
19599
19598
|
const redactedInputs = redact(inputs);
|
|
19600
|
-
const run = { flow, step,
|
|
19599
|
+
const run = { flow, step, menuOption, inputs: redactedInputs, startedAt };
|
|
19601
19600
|
pendingRun = run;
|
|
19602
19601
|
void isDebugModeEnabled().then((enabled) => {
|
|
19603
19602
|
if (!enabled && pendingRun === run) pendingRun = void 0;
|
|
@@ -19618,11 +19617,7 @@ async function settleDebugLogs() {
|
|
|
19618
19617
|
function finishDebugRun(args) {
|
|
19619
19618
|
return track(finishRun(args));
|
|
19620
19619
|
}
|
|
19621
|
-
async function finishRun({
|
|
19622
|
-
outputs,
|
|
19623
|
-
status,
|
|
19624
|
-
exitMethod
|
|
19625
|
-
}) {
|
|
19620
|
+
async function finishRun({ outputs, summary, status, exitMethod }) {
|
|
19626
19621
|
const run = pendingRun;
|
|
19627
19622
|
if (!run) return;
|
|
19628
19623
|
pendingRun = void 0;
|
|
@@ -19631,7 +19626,7 @@ async function finishRun({
|
|
|
19631
19626
|
const log = {
|
|
19632
19627
|
folder: logFolder(run.flow, run.step),
|
|
19633
19628
|
menuOption: run.menuOption,
|
|
19634
|
-
content: renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs })
|
|
19629
|
+
content: renderMarkdown(run, { outputs: redact(outputs), summary, status, exitMethod, durationMs })
|
|
19635
19630
|
};
|
|
19636
19631
|
const root = currentDebugSessionDir();
|
|
19637
19632
|
if (!root) {
|
|
@@ -19671,22 +19666,26 @@ function nextAttemptFilename(dir, menuOption) {
|
|
|
19671
19666
|
return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
|
|
19672
19667
|
}
|
|
19673
19668
|
function renderMarkdown(run, finish) {
|
|
19674
|
-
const
|
|
19675
|
-
const
|
|
19676
|
-
const
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
- Duration on screen: ${finish.durationMs}ms
|
|
19687
|
-
- Status: ${finish.status}
|
|
19688
|
-
- Exit method: ${finish.exitMethod}
|
|
19669
|
+
const stepNumber = /^(\d+)-/.exec(run.step)?.[1];
|
|
19670
|
+
const title = stepNumber ? `${run.menuOption} \xB7 step ${stepNumber}` : run.menuOption;
|
|
19671
|
+
const when = (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
19672
|
+
const header = `# ${title}
|
|
19673
|
+
|
|
19674
|
+
${when} \xB7 ${finish.durationMs}ms on screen \xB7 ${finish.status} (${finish.exitMethod}) \xB7 CLI ${readPackageVersion()} \xB7 ${process.platform} / Node ${process.version}
|
|
19675
|
+
`;
|
|
19676
|
+
if (finish.summary) {
|
|
19677
|
+
const bullets = finish.summary.map((line) => line.startsWith(" ") ? ` - ${line.trim()}` : `- ${line}`);
|
|
19678
|
+
return `${header}
|
|
19679
|
+
## Summary (for people)
|
|
19680
|
+
${bullets.join("\n")}
|
|
19689
19681
|
|
|
19682
|
+
## Data (for AI)
|
|
19683
|
+
\`\`\`json
|
|
19684
|
+
${JSON.stringify(finish.outputs, null, 2)}
|
|
19685
|
+
\`\`\`
|
|
19686
|
+
`;
|
|
19687
|
+
}
|
|
19688
|
+
return `${header}
|
|
19690
19689
|
## Inputs
|
|
19691
19690
|
\`\`\`json
|
|
19692
19691
|
${JSON.stringify(run.inputs, null, 2)}
|
|
@@ -19759,6 +19758,9 @@ var init_debug_store = __esm({
|
|
|
19759
19758
|
});
|
|
19760
19759
|
|
|
19761
19760
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/logic.ts
|
|
19761
|
+
function importModeLabel(target) {
|
|
19762
|
+
return IMPORT_TARGET_OPTIONS.find((option) => option.target === target).label;
|
|
19763
|
+
}
|
|
19762
19764
|
function overviewFor(target) {
|
|
19763
19765
|
return target === "tokens" ? TOKENS_ONLY_OVERVIEW : COMPONENTS_OVERVIEW;
|
|
19764
19766
|
}
|
|
@@ -19874,6 +19876,329 @@ var init_controls = __esm({
|
|
|
19874
19876
|
}
|
|
19875
19877
|
});
|
|
19876
19878
|
|
|
19879
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
19880
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
19881
|
+
import { access as access5, constants } from "node:fs/promises";
|
|
19882
|
+
function effectiveBinary(name, savedBinary) {
|
|
19883
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
19884
|
+
}
|
|
19885
|
+
function defaultModelLabel(name) {
|
|
19886
|
+
const model = DEFAULT_MODELS[name];
|
|
19887
|
+
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
19888
|
+
}
|
|
19889
|
+
function resolveOnPath(binary) {
|
|
19890
|
+
if (binary.includes("/")) {
|
|
19891
|
+
return access5(binary, constants.X_OK).then(
|
|
19892
|
+
() => binary,
|
|
19893
|
+
() => null
|
|
19894
|
+
);
|
|
19895
|
+
}
|
|
19896
|
+
return new Promise((resolve29) => {
|
|
19897
|
+
execFile2(
|
|
19898
|
+
process.platform === "win32" ? "where" : "which",
|
|
19899
|
+
[binary],
|
|
19900
|
+
(error, stdout) => resolve29(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
19901
|
+
);
|
|
19902
|
+
});
|
|
19903
|
+
}
|
|
19904
|
+
function readVersion(binary) {
|
|
19905
|
+
return new Promise((resolve29) => {
|
|
19906
|
+
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
19907
|
+
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
19908
|
+
if (!error && line) resolve29(pass("version", line));
|
|
19909
|
+
else resolve29(fail("version", "runs, but did not report a version"));
|
|
19910
|
+
});
|
|
19911
|
+
});
|
|
19912
|
+
}
|
|
19913
|
+
async function inspect(name, binary) {
|
|
19914
|
+
const target = effectiveBinary(name, binary);
|
|
19915
|
+
const found = await resolveOnPath(target);
|
|
19916
|
+
if (!found) return { checks: [fail("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
19917
|
+
const checks = [pass("path", found)];
|
|
19918
|
+
checks.push(await readVersion(found));
|
|
19919
|
+
if (name === "claude") {
|
|
19920
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
19921
|
+
checks.push(
|
|
19922
|
+
auth === "ok" ? pass("login", "logged in") : fail("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
19923
|
+
);
|
|
19924
|
+
}
|
|
19925
|
+
return { checks, found };
|
|
19926
|
+
}
|
|
19927
|
+
async function inspectAgent(name, binary) {
|
|
19928
|
+
return (await inspect(name, binary)).checks;
|
|
19929
|
+
}
|
|
19930
|
+
async function testAgent(name, binary, model) {
|
|
19931
|
+
const { checks, found } = await inspect(name, binary);
|
|
19932
|
+
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
19933
|
+
const started = Date.now();
|
|
19934
|
+
const result = await withBinaryEnv(
|
|
19935
|
+
name,
|
|
19936
|
+
found,
|
|
19937
|
+
() => createLocalCliAgentInvoker().invoke({
|
|
19938
|
+
agent: name,
|
|
19939
|
+
...model.trim() ? { model: model.trim() } : {},
|
|
19940
|
+
prompt: TEST_PROMPT,
|
|
19941
|
+
timeoutMs: PROMPT_TIMEOUT_MS
|
|
19942
|
+
})
|
|
19943
|
+
);
|
|
19944
|
+
const seconds2 = ((Date.now() - started) / 1e3).toFixed(1);
|
|
19945
|
+
if (result.timedOut) {
|
|
19946
|
+
return [...checks, { ...fail("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
19947
|
+
}
|
|
19948
|
+
if (result.exitCode !== 0) {
|
|
19949
|
+
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
19950
|
+
return [...checks, fail("prompt", reason)];
|
|
19951
|
+
}
|
|
19952
|
+
return [...checks, pass("prompt", `answered in ${seconds2}s`)];
|
|
19953
|
+
}
|
|
19954
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
19955
|
+
if (checks.length === 0) return "checking";
|
|
19956
|
+
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
19957
|
+
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
19958
|
+
}
|
|
19959
|
+
const prompt = checks.find((check) => check.step === "prompt");
|
|
19960
|
+
if (prompt) {
|
|
19961
|
+
if (prompt.ok) return "ready";
|
|
19962
|
+
return prompt.timedOut ? "timed-out" : "test-failed";
|
|
19963
|
+
}
|
|
19964
|
+
const login = checks.find((check) => check.step === "login");
|
|
19965
|
+
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
19966
|
+
return name === "claude" ? "ready" : "unknown";
|
|
19967
|
+
}
|
|
19968
|
+
function setupHint(name, status) {
|
|
19969
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
19970
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
19971
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
19972
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
19973
|
+
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
19974
|
+
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
19975
|
+
return "";
|
|
19976
|
+
}
|
|
19977
|
+
function testOutcome(checks) {
|
|
19978
|
+
const prompt = checks?.find((check) => check.step === "prompt");
|
|
19979
|
+
if (!prompt) return void 0;
|
|
19980
|
+
if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
|
|
19981
|
+
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
19982
|
+
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
19983
|
+
}
|
|
19984
|
+
function modelLine(name, savedModel) {
|
|
19985
|
+
const model = savedModel.trim();
|
|
19986
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
19987
|
+
}
|
|
19988
|
+
function baseRows(name, checks, savedBinary) {
|
|
19989
|
+
const path5 = checks.find((check) => check.step === "path");
|
|
19990
|
+
const version2 = checks.find((check) => check.step === "version");
|
|
19991
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
19992
|
+
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
19993
|
+
if (!path5?.ok) {
|
|
19994
|
+
const saved = savedBinary.trim() !== "";
|
|
19995
|
+
const command = {
|
|
19996
|
+
label: "Command",
|
|
19997
|
+
value: saved ? path5?.detail ?? "not found" : "not configured (not on the PATH)",
|
|
19998
|
+
tone: saved ? "bad" : "muted"
|
|
19999
|
+
};
|
|
20000
|
+
return { command, version: void 0, setup, found: false };
|
|
20001
|
+
}
|
|
20002
|
+
return {
|
|
20003
|
+
command: { label: "Command", value: path5.detail, tone: "ok" },
|
|
20004
|
+
version: {
|
|
20005
|
+
label: "Version",
|
|
20006
|
+
value: version2?.ok ? version2.detail : "could not be read",
|
|
20007
|
+
tone: version2?.ok ? "ok" : "muted"
|
|
20008
|
+
},
|
|
20009
|
+
setup,
|
|
20010
|
+
found: true
|
|
20011
|
+
};
|
|
20012
|
+
}
|
|
20013
|
+
function panelRows(name, checks, settings) {
|
|
20014
|
+
if (!checks) return checking;
|
|
20015
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
20016
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
20017
|
+
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
20018
|
+
}
|
|
20019
|
+
function statusRows(name, checks, savedBinary) {
|
|
20020
|
+
if (!checks) return checking;
|
|
20021
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
20022
|
+
if (!found) return [command];
|
|
20023
|
+
const login = checks.find((check) => check.step === "login");
|
|
20024
|
+
const prompt = checks.find((check) => check.step === "prompt");
|
|
20025
|
+
let loginRow;
|
|
20026
|
+
if (login) {
|
|
20027
|
+
loginRow = { label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" };
|
|
20028
|
+
} else if (prompt) {
|
|
20029
|
+
loginRow = {
|
|
20030
|
+
label: "Login",
|
|
20031
|
+
value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
|
|
20032
|
+
tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
|
|
20033
|
+
};
|
|
20034
|
+
} else {
|
|
20035
|
+
loginRow = { label: "Login", value: "not checked (use Run test)", tone: "muted" };
|
|
20036
|
+
}
|
|
20037
|
+
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
20038
|
+
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
20039
|
+
}
|
|
20040
|
+
async function withBinaryEnv(name, binary, run) {
|
|
20041
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
20042
|
+
const previous = process.env[key];
|
|
20043
|
+
process.env[key] = binary;
|
|
20044
|
+
try {
|
|
20045
|
+
return await run();
|
|
20046
|
+
} finally {
|
|
20047
|
+
if (previous === void 0) delete process.env[key];
|
|
20048
|
+
else process.env[key] = previous;
|
|
20049
|
+
}
|
|
20050
|
+
}
|
|
20051
|
+
var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail, pass, LIST_STATUS, checking;
|
|
20052
|
+
var init_agent_status = __esm({
|
|
20053
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts"() {
|
|
20054
|
+
"use strict";
|
|
20055
|
+
init_src3();
|
|
20056
|
+
VERSION_TIMEOUT_MS = 5e3;
|
|
20057
|
+
PROMPT_TIMEOUT_MS = 6e4;
|
|
20058
|
+
TEST_PROMPT = "Reply with the single word: ok";
|
|
20059
|
+
INSTALL_HINTS = {
|
|
20060
|
+
claude: "npm install -g @anthropic-ai/claude-code",
|
|
20061
|
+
codex: "npm install -g @openai/codex",
|
|
20062
|
+
opencode: "npm install -g opencode-ai",
|
|
20063
|
+
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
20064
|
+
copilot: "npm install -g @github/copilot"
|
|
20065
|
+
};
|
|
20066
|
+
LOGIN_HINTS = {
|
|
20067
|
+
claude: "run `claude login`",
|
|
20068
|
+
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
20069
|
+
opencode: "run `opencode auth`",
|
|
20070
|
+
cursor: "sign in from Cursor",
|
|
20071
|
+
copilot: "run `copilot` and sign in"
|
|
20072
|
+
};
|
|
20073
|
+
fail = (step, detail) => ({ step, ok: false, detail });
|
|
20074
|
+
pass = (step, detail) => ({ step, ok: true, detail });
|
|
20075
|
+
LIST_STATUS = {
|
|
20076
|
+
checking: { symbol: "\u2026", text: "checking", tone: "muted" },
|
|
20077
|
+
ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
|
|
20078
|
+
"not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
|
|
20079
|
+
"not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
|
|
20080
|
+
"not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
|
|
20081
|
+
"test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
|
|
20082
|
+
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
20083
|
+
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
20084
|
+
};
|
|
20085
|
+
checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
20086
|
+
}
|
|
20087
|
+
});
|
|
20088
|
+
|
|
20089
|
+
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
20090
|
+
function agentSnapshot(config) {
|
|
20091
|
+
const snapshot = { default_agent: config.defaultAgent };
|
|
20092
|
+
for (const name of AGENT_NAMES) {
|
|
20093
|
+
snapshot[`${name}.model`] = config.agents[name].model;
|
|
20094
|
+
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
20095
|
+
}
|
|
20096
|
+
return snapshot;
|
|
20097
|
+
}
|
|
20098
|
+
function environmentFrom(checks, savedBinary, envValue) {
|
|
20099
|
+
const path5 = checks.find((check) => check.step === "path");
|
|
20100
|
+
const version2 = checks.find((check) => check.step === "version");
|
|
20101
|
+
const overridden = envValue !== void 0 && envValue !== "" && envValue !== savedBinary.trim();
|
|
20102
|
+
return {
|
|
20103
|
+
found: path5?.ok === true,
|
|
20104
|
+
resolved_path: path5?.ok ? path5.detail : "",
|
|
20105
|
+
version: version2?.ok ? version2.detail : "",
|
|
20106
|
+
env_override: overridden ? envValue : ""
|
|
20107
|
+
};
|
|
20108
|
+
}
|
|
20109
|
+
async function describeAgents(config) {
|
|
20110
|
+
const entries = await Promise.all(
|
|
20111
|
+
AGENT_NAMES.map(async (name) => {
|
|
20112
|
+
const saved = config.agents[name].binary;
|
|
20113
|
+
const checks = await inspectAgent(name, saved);
|
|
20114
|
+
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
20115
|
+
})
|
|
20116
|
+
);
|
|
20117
|
+
return Object.fromEntries(entries);
|
|
20118
|
+
}
|
|
20119
|
+
async function agentReadiness(config) {
|
|
20120
|
+
const entries = await Promise.all(
|
|
20121
|
+
AGENT_NAMES.map(async (name) => {
|
|
20122
|
+
const saved = config.agents[name].binary;
|
|
20123
|
+
const checks = await inspectAgent(name, saved);
|
|
20124
|
+
const version2 = checks.find((check) => check.step === "version");
|
|
20125
|
+
return [
|
|
20126
|
+
name,
|
|
20127
|
+
{ status: statusFromChecks(name, checks, saved), version: version2?.ok ? version2.detail : "" }
|
|
20128
|
+
];
|
|
20129
|
+
})
|
|
20130
|
+
);
|
|
20131
|
+
return Object.fromEntries(entries);
|
|
20132
|
+
}
|
|
20133
|
+
var init_agent_debug = __esm({
|
|
20134
|
+
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts"() {
|
|
20135
|
+
"use strict";
|
|
20136
|
+
init_src3();
|
|
20137
|
+
init_agent_status();
|
|
20138
|
+
}
|
|
20139
|
+
});
|
|
20140
|
+
|
|
20141
|
+
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/log.ts
|
|
20142
|
+
async function collectPreflightContext() {
|
|
20143
|
+
try {
|
|
20144
|
+
const [config, settings] = await Promise.all([readAgentConfig(), readSettings2()]);
|
|
20145
|
+
const baseDir = settings["contentfulBaseDir"];
|
|
20146
|
+
return {
|
|
20147
|
+
settings: {
|
|
20148
|
+
default_agent: config.defaultAgent,
|
|
20149
|
+
base_dir_set: typeof baseDir === "string" && baseDir !== "",
|
|
20150
|
+
analytics: analyticsEnabled()
|
|
20151
|
+
},
|
|
20152
|
+
agents: await agentReadiness(config)
|
|
20153
|
+
};
|
|
20154
|
+
} catch {
|
|
20155
|
+
return void 0;
|
|
20156
|
+
}
|
|
20157
|
+
}
|
|
20158
|
+
function preflightLog(chosen, terminal, context) {
|
|
20159
|
+
const { columns, rows } = terminal;
|
|
20160
|
+
const summary = [
|
|
20161
|
+
chosen ? `Chose: ${importModeLabel(chosen)}` : "Left the import without choosing",
|
|
20162
|
+
columns && rows ? `Terminal: ${columns} \xD7 ${rows}` : "Terminal: size unknown"
|
|
20163
|
+
];
|
|
20164
|
+
if (context) {
|
|
20165
|
+
const { settings, agents } = context;
|
|
20166
|
+
summary.push(
|
|
20167
|
+
"Settings:",
|
|
20168
|
+
` Default agent: ${AGENT_LABELS[settings.default_agent]}`,
|
|
20169
|
+
` Base directory: ${settings.base_dir_set ? "set" : "not set"}`,
|
|
20170
|
+
` Analytics: ${settings.analytics ? "on" : "off"}`,
|
|
20171
|
+
"Agents:",
|
|
20172
|
+
...AGENT_NAMES.map((name) => ` ${agentLine(name, agents[name])}`)
|
|
20173
|
+
);
|
|
20174
|
+
} else {
|
|
20175
|
+
summary.push("Settings and agents: not collected");
|
|
20176
|
+
}
|
|
20177
|
+
return {
|
|
20178
|
+
summary,
|
|
20179
|
+
data: {
|
|
20180
|
+
chosen,
|
|
20181
|
+
terminal: { columns: columns ?? null, rows: rows ?? null },
|
|
20182
|
+
...context ? { settings: context.settings, agents: context.agents } : {}
|
|
20183
|
+
}
|
|
20184
|
+
};
|
|
20185
|
+
}
|
|
20186
|
+
function agentLine(name, { status, version: version2 }) {
|
|
20187
|
+
const number = /\d+(?:\.\d+)+/.exec(version2)?.[0];
|
|
20188
|
+
return `${AGENT_LABELS[name]}: ${LIST_STATUS[status].text}${number ? ` (${number})` : ""}`;
|
|
20189
|
+
}
|
|
20190
|
+
var init_log = __esm({
|
|
20191
|
+
"packages/experience-design-system-cli/src/tui/import/steps/00-preflight/log.ts"() {
|
|
20192
|
+
"use strict";
|
|
20193
|
+
init_src3();
|
|
20194
|
+
init_config();
|
|
20195
|
+
init_agent_debug();
|
|
20196
|
+
init_agent_status();
|
|
20197
|
+
init_agent_store();
|
|
20198
|
+
init_logic();
|
|
20199
|
+
}
|
|
20200
|
+
});
|
|
20201
|
+
|
|
19877
20202
|
// packages/experience-design-system-cli/src/tui/zip.ts
|
|
19878
20203
|
import { crc32, deflateRawSync } from "node:zlib";
|
|
19879
20204
|
function dosDateTime(date) {
|
|
@@ -20442,32 +20767,30 @@ import { Box as Box9, Text as Text9 } from "ink";
|
|
|
20442
20767
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20443
20768
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
20444
20769
|
const [focus, setFocus] = useState5(0);
|
|
20445
|
-
const
|
|
20770
|
+
const context = useRef(void 0);
|
|
20446
20771
|
useEffect5(() => {
|
|
20447
|
-
startDebugRun({
|
|
20448
|
-
|
|
20449
|
-
|
|
20450
|
-
menuOption: "Preflight",
|
|
20451
|
-
inputs: { options: IMPORT_TARGET_OPTIONS.map((option) => option.target), initial_focus: optionAt(0) }
|
|
20772
|
+
startDebugRun({ flow: "import/preflight", step: "00-preflight", menuOption: "Preflight" });
|
|
20773
|
+
void collectPreflightContext().then((collected) => {
|
|
20774
|
+
context.current = collected;
|
|
20452
20775
|
});
|
|
20453
20776
|
}, []);
|
|
20454
|
-
const
|
|
20455
|
-
|
|
20456
|
-
|
|
20777
|
+
const finish = (chosen) => {
|
|
20778
|
+
const { summary, data } = preflightLog(
|
|
20779
|
+
chosen,
|
|
20780
|
+
{ columns: process.stdout.columns, rows: process.stdout.rows },
|
|
20781
|
+
context.current
|
|
20782
|
+
);
|
|
20783
|
+
void finishDebugRun({ summary, outputs: data, status: "success", exitMethod: chosen ? "saved" : "discarded" });
|
|
20457
20784
|
};
|
|
20458
20785
|
const choose = (target) => {
|
|
20459
|
-
|
|
20460
|
-
outputs: { chosen: target, viewed, steps_that_will_run: overviewFor(target).map((step) => step.description) },
|
|
20461
|
-
status: "success",
|
|
20462
|
-
exitMethod: "saved"
|
|
20463
|
-
});
|
|
20786
|
+
finish(target);
|
|
20464
20787
|
onChoose(target);
|
|
20465
20788
|
};
|
|
20466
20789
|
const quit = () => {
|
|
20467
|
-
|
|
20790
|
+
finish(null);
|
|
20468
20791
|
onQuit();
|
|
20469
20792
|
};
|
|
20470
|
-
usePreflightControls({ focus, onFocus:
|
|
20793
|
+
usePreflightControls({ focus, onFocus: setFocus, onChoose: choose, onQuit: quit });
|
|
20471
20794
|
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
20472
20795
|
/* @__PURE__ */ jsx9(StepHeader, { step: "setup" }),
|
|
20473
20796
|
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingBottom: 1, children: [
|
|
@@ -20491,6 +20814,7 @@ var init_screen = __esm({
|
|
|
20491
20814
|
init_theme();
|
|
20492
20815
|
init_debug_store();
|
|
20493
20816
|
init_controls();
|
|
20817
|
+
init_log();
|
|
20494
20818
|
init_logic();
|
|
20495
20819
|
init_shared2();
|
|
20496
20820
|
init_ControlHints();
|
|
@@ -20567,6 +20891,33 @@ var init_controls4 = __esm({
|
|
|
20567
20891
|
}
|
|
20568
20892
|
});
|
|
20569
20893
|
|
|
20894
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/log.ts
|
|
20895
|
+
function welcomeLog({
|
|
20896
|
+
mode,
|
|
20897
|
+
projectPath,
|
|
20898
|
+
initialPath,
|
|
20899
|
+
emptySubmits
|
|
20900
|
+
}) {
|
|
20901
|
+
const kept = projectPath !== null && initialPath.trim() !== "" && projectPath === initialPath.trim();
|
|
20902
|
+
const source = projectPath === null ? null : kept ? "prefilled" : "typed";
|
|
20903
|
+
const summary = [
|
|
20904
|
+
`Import mode: ${importModeLabel(mode)}`,
|
|
20905
|
+
projectPath === null ? "Project path: none (left the import)" : `Project path: ${projectPath}`,
|
|
20906
|
+
...source ? [`Path source: ${source === "prefilled" ? "pre-filled, kept as is" : "typed by the user"}`] : [],
|
|
20907
|
+
`Empty submits: ${emptySubmits}`
|
|
20908
|
+
];
|
|
20909
|
+
return {
|
|
20910
|
+
summary,
|
|
20911
|
+
data: { import_mode: mode, project_path: projectPath, path_source: source, empty_submits: emptySubmits }
|
|
20912
|
+
};
|
|
20913
|
+
}
|
|
20914
|
+
var init_log2 = __esm({
|
|
20915
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/log.ts"() {
|
|
20916
|
+
"use strict";
|
|
20917
|
+
init_logic();
|
|
20918
|
+
}
|
|
20919
|
+
});
|
|
20920
|
+
|
|
20570
20921
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
20571
20922
|
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
20572
20923
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
@@ -20575,23 +20926,19 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
20575
20926
|
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
20576
20927
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
20577
20928
|
useEffect6(() => {
|
|
20578
|
-
startDebugRun({
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
void finishDebugRun({
|
|
20587
|
-
outputs: {
|
|
20588
|
-
project_path: null,
|
|
20589
|
-
typed_something: toProjectPath(projectPath) !== null,
|
|
20590
|
-
empty_submits: visit.emptySubmits
|
|
20591
|
-
},
|
|
20592
|
-
status: "success",
|
|
20593
|
-
exitMethod: "discarded"
|
|
20929
|
+
startDebugRun({ flow: "import/welcome", step: "01-welcome", menuOption: "Welcome" });
|
|
20930
|
+
}, []);
|
|
20931
|
+
const finish = (path5) => {
|
|
20932
|
+
const { summary, data } = welcomeLog({
|
|
20933
|
+
mode,
|
|
20934
|
+
projectPath: path5,
|
|
20935
|
+
initialPath,
|
|
20936
|
+
emptySubmits: visit.emptySubmits
|
|
20594
20937
|
});
|
|
20938
|
+
void finishDebugRun({ summary, outputs: data, status: "success", exitMethod: path5 ? "saved" : "discarded" });
|
|
20939
|
+
};
|
|
20940
|
+
const quit = () => {
|
|
20941
|
+
finish(null);
|
|
20595
20942
|
onQuit();
|
|
20596
20943
|
};
|
|
20597
20944
|
useWelcomeControls(quit);
|
|
@@ -20601,15 +20948,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
20601
20948
|
visit.emptySubmits += 1;
|
|
20602
20949
|
return;
|
|
20603
20950
|
}
|
|
20604
|
-
|
|
20605
|
-
outputs: {
|
|
20606
|
-
project_path: path5,
|
|
20607
|
-
changed_from_initial: path5 !== initialPath.trim(),
|
|
20608
|
-
empty_submits: visit.emptySubmits
|
|
20609
|
-
},
|
|
20610
|
-
status: "success",
|
|
20611
|
-
exitMethod: "saved"
|
|
20612
|
-
});
|
|
20951
|
+
finish(path5);
|
|
20613
20952
|
onContinue(path5);
|
|
20614
20953
|
};
|
|
20615
20954
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
|
|
@@ -20634,6 +20973,7 @@ var init_screen2 = __esm({
|
|
|
20634
20973
|
init_debug_store();
|
|
20635
20974
|
init_ClearableTextInput();
|
|
20636
20975
|
init_controls4();
|
|
20976
|
+
init_log2();
|
|
20637
20977
|
init_logic5();
|
|
20638
20978
|
init_ControlHints();
|
|
20639
20979
|
init_StepHeader();
|
|
@@ -22143,13 +22483,13 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
22143
22483
|
onProgress(progress);
|
|
22144
22484
|
const auth = await deps.checkAgentAuth(input.agent);
|
|
22145
22485
|
if (auth === "not-found" || auth === "unauthenticated") {
|
|
22146
|
-
return
|
|
22486
|
+
return fail2(`${input.agent} auth check`, agentAuthMessage(input.agent, auth));
|
|
22147
22487
|
}
|
|
22148
22488
|
let selectionPrompt;
|
|
22149
22489
|
try {
|
|
22150
22490
|
selectionPrompt = await resolveSelectionPrompt(input.promptOverrides);
|
|
22151
22491
|
} catch (error) {
|
|
22152
|
-
return
|
|
22492
|
+
return fail2("selection agent", errorMessage2(error));
|
|
22153
22493
|
}
|
|
22154
22494
|
const tokenGeneration = input.rawTokensPath !== "" ? deps.runGenerateTokensSession({
|
|
22155
22495
|
rawTokensPath: input.rawTokensPath,
|
|
@@ -22212,14 +22552,14 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
22212
22552
|
onSessionCreated: (sessionId) => startSelection(sessionId)
|
|
22213
22553
|
});
|
|
22214
22554
|
} catch (error) {
|
|
22215
|
-
return
|
|
22555
|
+
return fail2("analyze extract", errorMessage2(error));
|
|
22216
22556
|
}
|
|
22217
22557
|
if (selection) await selection;
|
|
22218
22558
|
if (!selection && entities) await entities;
|
|
22219
|
-
if (extracted.components.length === 0) return
|
|
22220
|
-
if (selectionError) return
|
|
22559
|
+
if (extracted.components.length === 0) return fail2("analyze extract", noComponentsMessage(input.projectPath));
|
|
22560
|
+
if (selectionError) return fail2("selection agent", errorMessage2(selectionError));
|
|
22221
22561
|
const tokens = await tokenGeneration;
|
|
22222
|
-
if (tokens && !tokens.ok) return
|
|
22562
|
+
if (tokens && !tokens.ok) return fail2(tokens.step, tokens.message);
|
|
22223
22563
|
const extraction = {
|
|
22224
22564
|
sessionId: extracted.sessionId,
|
|
22225
22565
|
outDir,
|
|
@@ -22259,7 +22599,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
22259
22599
|
}
|
|
22260
22600
|
return {};
|
|
22261
22601
|
}
|
|
22262
|
-
var TOKENS_SKILL_PATH, realDeps,
|
|
22602
|
+
var TOKENS_SKILL_PATH, realDeps, fail2, errorMessage2;
|
|
22263
22603
|
var init_run = __esm({
|
|
22264
22604
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts"() {
|
|
22265
22605
|
"use strict";
|
|
@@ -22275,7 +22615,7 @@ var init_run = __esm({
|
|
|
22275
22615
|
runGenerateTokensSession,
|
|
22276
22616
|
runSelection
|
|
22277
22617
|
};
|
|
22278
|
-
|
|
22618
|
+
fail2 = (step, message) => ({ ok: false, step, message });
|
|
22279
22619
|
errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
22280
22620
|
}
|
|
22281
22621
|
});
|
|
@@ -22423,7 +22763,7 @@ function scopeGateLogOutputs(components, decisions) {
|
|
|
22423
22763
|
};
|
|
22424
22764
|
}
|
|
22425
22765
|
var MAX_NAMES, capped;
|
|
22426
|
-
var
|
|
22766
|
+
var init_log3 = __esm({
|
|
22427
22767
|
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts"() {
|
|
22428
22768
|
"use strict";
|
|
22429
22769
|
MAX_NAMES = 20;
|
|
@@ -25322,7 +25662,7 @@ var init_screen8 = __esm({
|
|
|
25322
25662
|
"use strict";
|
|
25323
25663
|
init_debug_store();
|
|
25324
25664
|
init_StepHeader();
|
|
25325
|
-
|
|
25665
|
+
init_log3();
|
|
25326
25666
|
init_tokens_column();
|
|
25327
25667
|
init_load();
|
|
25328
25668
|
init_logic10();
|
|
@@ -25649,12 +25989,12 @@ async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
|
25649
25989
|
try {
|
|
25650
25990
|
await deps.saveDecisions({ sessionId: input.sessionId, decisions: input.decisions });
|
|
25651
25991
|
} catch (error) {
|
|
25652
|
-
return
|
|
25992
|
+
return fail3("save decisions", errorMessage3(error));
|
|
25653
25993
|
}
|
|
25654
25994
|
if (accepted.length === 0) return { ok: true, generation: { route: "push", acceptedCount: 0 } };
|
|
25655
25995
|
const auth = await deps.checkAgentAuth(input.agent);
|
|
25656
25996
|
if (auth === "not-found" || auth === "unauthenticated") {
|
|
25657
|
-
return
|
|
25997
|
+
return fail3(`${input.agent} auth check`, agentAuthMessage(input.agent, auth));
|
|
25658
25998
|
}
|
|
25659
25999
|
let generated;
|
|
25660
26000
|
try {
|
|
@@ -25670,18 +26010,18 @@ async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
|
25670
26010
|
onProgress: (event) => update({ components: applyProgressEvent2(event, progress.components, accepted.length) })
|
|
25671
26011
|
});
|
|
25672
26012
|
} catch (error) {
|
|
25673
|
-
return
|
|
26013
|
+
return fail3("generate components", errorMessage3(error));
|
|
25674
26014
|
}
|
|
25675
|
-
if (generated.emptySession) return
|
|
26015
|
+
if (generated.emptySession) return fail3("generate components", "no raw components in session");
|
|
25676
26016
|
if (!generated.allOk) {
|
|
25677
26017
|
const firstFailure = generated.results.find((r) => r.failed);
|
|
25678
|
-
return
|
|
26018
|
+
return fail3("generate components", firstFailure?.error ?? "unknown error");
|
|
25679
26019
|
}
|
|
25680
26020
|
let plan;
|
|
25681
26021
|
try {
|
|
25682
26022
|
plan = await deps.prepareMapTokens(input, input.sessionId);
|
|
25683
26023
|
} catch (error) {
|
|
25684
|
-
return
|
|
26024
|
+
return fail3("map tokens", errorMessage3(error));
|
|
25685
26025
|
}
|
|
25686
26026
|
update({ mapTokensEligible: plan.eligible });
|
|
25687
26027
|
if (plan.eligible) {
|
|
@@ -25698,7 +26038,7 @@ async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
|
25698
26038
|
});
|
|
25699
26039
|
} catch (error) {
|
|
25700
26040
|
const message = error instanceof MapTokensRunFailure ? error.message : error instanceof Error ? error.message : String(error);
|
|
25701
|
-
return
|
|
26041
|
+
return fail3("map tokens", message);
|
|
25702
26042
|
}
|
|
25703
26043
|
}
|
|
25704
26044
|
update({ mapTokens: "complete" });
|
|
@@ -25752,7 +26092,7 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
25752
26092
|
}
|
|
25753
26093
|
return previous;
|
|
25754
26094
|
}
|
|
25755
|
-
var COMPONENTS_SKILL_PATH, MAP_TOKENS_SKILL_PATH, realDeps4,
|
|
26095
|
+
var COMPONENTS_SKILL_PATH, MAP_TOKENS_SKILL_PATH, realDeps4, fail3, errorMessage3;
|
|
25756
26096
|
var init_run2 = __esm({
|
|
25757
26097
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts"() {
|
|
25758
26098
|
"use strict";
|
|
@@ -25770,7 +26110,7 @@ var init_run2 = __esm({
|
|
|
25770
26110
|
runMapTokens,
|
|
25771
26111
|
prepareMapTokens
|
|
25772
26112
|
};
|
|
25773
|
-
|
|
26113
|
+
fail3 = (step, message) => ({ ok: false, step, message });
|
|
25774
26114
|
errorMessage3 = (error) => error instanceof Error ? error.message : String(error);
|
|
25775
26115
|
}
|
|
25776
26116
|
});
|
|
@@ -34567,254 +34907,6 @@ var init_PageContainer3 = __esm({
|
|
|
34567
34907
|
}
|
|
34568
34908
|
});
|
|
34569
34909
|
|
|
34570
|
-
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
34571
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
34572
|
-
import { access as access5, constants } from "node:fs/promises";
|
|
34573
|
-
function effectiveBinary(name, savedBinary) {
|
|
34574
|
-
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
34575
|
-
}
|
|
34576
|
-
function defaultModelLabel(name) {
|
|
34577
|
-
const model = DEFAULT_MODELS[name];
|
|
34578
|
-
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
34579
|
-
}
|
|
34580
|
-
function resolveOnPath(binary) {
|
|
34581
|
-
if (binary.includes("/")) {
|
|
34582
|
-
return access5(binary, constants.X_OK).then(
|
|
34583
|
-
() => binary,
|
|
34584
|
-
() => null
|
|
34585
|
-
);
|
|
34586
|
-
}
|
|
34587
|
-
return new Promise((resolve29) => {
|
|
34588
|
-
execFile2(
|
|
34589
|
-
process.platform === "win32" ? "where" : "which",
|
|
34590
|
-
[binary],
|
|
34591
|
-
(error, stdout) => resolve29(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
34592
|
-
);
|
|
34593
|
-
});
|
|
34594
|
-
}
|
|
34595
|
-
function readVersion(binary) {
|
|
34596
|
-
return new Promise((resolve29) => {
|
|
34597
|
-
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
34598
|
-
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
34599
|
-
if (!error && line) resolve29(pass("version", line));
|
|
34600
|
-
else resolve29(fail3("version", "runs, but did not report a version"));
|
|
34601
|
-
});
|
|
34602
|
-
});
|
|
34603
|
-
}
|
|
34604
|
-
async function inspect(name, binary) {
|
|
34605
|
-
const target = effectiveBinary(name, binary);
|
|
34606
|
-
const found = await resolveOnPath(target);
|
|
34607
|
-
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
34608
|
-
const checks = [pass("path", found)];
|
|
34609
|
-
checks.push(await readVersion(found));
|
|
34610
|
-
if (name === "claude") {
|
|
34611
|
-
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
34612
|
-
checks.push(
|
|
34613
|
-
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
34614
|
-
);
|
|
34615
|
-
}
|
|
34616
|
-
return { checks, found };
|
|
34617
|
-
}
|
|
34618
|
-
async function inspectAgent(name, binary) {
|
|
34619
|
-
return (await inspect(name, binary)).checks;
|
|
34620
|
-
}
|
|
34621
|
-
async function testAgent(name, binary, model) {
|
|
34622
|
-
const { checks, found } = await inspect(name, binary);
|
|
34623
|
-
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
34624
|
-
const started = Date.now();
|
|
34625
|
-
const result = await withBinaryEnv(
|
|
34626
|
-
name,
|
|
34627
|
-
found,
|
|
34628
|
-
() => createLocalCliAgentInvoker().invoke({
|
|
34629
|
-
agent: name,
|
|
34630
|
-
...model.trim() ? { model: model.trim() } : {},
|
|
34631
|
-
prompt: TEST_PROMPT,
|
|
34632
|
-
timeoutMs: PROMPT_TIMEOUT_MS
|
|
34633
|
-
})
|
|
34634
|
-
);
|
|
34635
|
-
const seconds2 = ((Date.now() - started) / 1e3).toFixed(1);
|
|
34636
|
-
if (result.timedOut) {
|
|
34637
|
-
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
34638
|
-
}
|
|
34639
|
-
if (result.exitCode !== 0) {
|
|
34640
|
-
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
34641
|
-
return [...checks, fail3("prompt", reason)];
|
|
34642
|
-
}
|
|
34643
|
-
return [...checks, pass("prompt", `answered in ${seconds2}s`)];
|
|
34644
|
-
}
|
|
34645
|
-
function statusFromChecks(name, checks, savedBinary) {
|
|
34646
|
-
if (checks.length === 0) return "checking";
|
|
34647
|
-
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
34648
|
-
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
34649
|
-
}
|
|
34650
|
-
const prompt = checks.find((check) => check.step === "prompt");
|
|
34651
|
-
if (prompt) {
|
|
34652
|
-
if (prompt.ok) return "ready";
|
|
34653
|
-
return prompt.timedOut ? "timed-out" : "test-failed";
|
|
34654
|
-
}
|
|
34655
|
-
const login = checks.find((check) => check.step === "login");
|
|
34656
|
-
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
34657
|
-
return name === "claude" ? "ready" : "unknown";
|
|
34658
|
-
}
|
|
34659
|
-
function setupHint(name, status) {
|
|
34660
|
-
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
34661
|
-
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
34662
|
-
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
34663
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
34664
|
-
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
34665
|
-
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
34666
|
-
return "";
|
|
34667
|
-
}
|
|
34668
|
-
function testOutcome(checks) {
|
|
34669
|
-
const prompt = checks?.find((check) => check.step === "prompt");
|
|
34670
|
-
if (!prompt) return void 0;
|
|
34671
|
-
if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
|
|
34672
|
-
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
34673
|
-
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
34674
|
-
}
|
|
34675
|
-
function modelLine(name, savedModel) {
|
|
34676
|
-
const model = savedModel.trim();
|
|
34677
|
-
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
34678
|
-
}
|
|
34679
|
-
function baseRows(name, checks, savedBinary) {
|
|
34680
|
-
const path5 = checks.find((check) => check.step === "path");
|
|
34681
|
-
const version2 = checks.find((check) => check.step === "version");
|
|
34682
|
-
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
34683
|
-
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
34684
|
-
if (!path5?.ok) {
|
|
34685
|
-
const saved = savedBinary.trim() !== "";
|
|
34686
|
-
const command = {
|
|
34687
|
-
label: "Command",
|
|
34688
|
-
value: saved ? path5?.detail ?? "not found" : "not configured (not on the PATH)",
|
|
34689
|
-
tone: saved ? "bad" : "muted"
|
|
34690
|
-
};
|
|
34691
|
-
return { command, version: void 0, setup, found: false };
|
|
34692
|
-
}
|
|
34693
|
-
return {
|
|
34694
|
-
command: { label: "Command", value: path5.detail, tone: "ok" },
|
|
34695
|
-
version: {
|
|
34696
|
-
label: "Version",
|
|
34697
|
-
value: version2?.ok ? version2.detail : "could not be read",
|
|
34698
|
-
tone: version2?.ok ? "ok" : "muted"
|
|
34699
|
-
},
|
|
34700
|
-
setup,
|
|
34701
|
-
found: true
|
|
34702
|
-
};
|
|
34703
|
-
}
|
|
34704
|
-
function panelRows(name, checks, settings) {
|
|
34705
|
-
if (!checks) return checking;
|
|
34706
|
-
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
34707
|
-
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
34708
|
-
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
34709
|
-
}
|
|
34710
|
-
function statusRows(name, checks, savedBinary) {
|
|
34711
|
-
if (!checks) return checking;
|
|
34712
|
-
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
34713
|
-
if (!found) return [command];
|
|
34714
|
-
const login = checks.find((check) => check.step === "login");
|
|
34715
|
-
const prompt = checks.find((check) => check.step === "prompt");
|
|
34716
|
-
let loginRow;
|
|
34717
|
-
if (login) {
|
|
34718
|
-
loginRow = { label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" };
|
|
34719
|
-
} else if (prompt) {
|
|
34720
|
-
loginRow = {
|
|
34721
|
-
label: "Login",
|
|
34722
|
-
value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
|
|
34723
|
-
tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
|
|
34724
|
-
};
|
|
34725
|
-
} else {
|
|
34726
|
-
loginRow = { label: "Login", value: "not checked (use Run test)", tone: "muted" };
|
|
34727
|
-
}
|
|
34728
|
-
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
34729
|
-
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
34730
|
-
}
|
|
34731
|
-
async function withBinaryEnv(name, binary, run) {
|
|
34732
|
-
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
34733
|
-
const previous = process.env[key];
|
|
34734
|
-
process.env[key] = binary;
|
|
34735
|
-
try {
|
|
34736
|
-
return await run();
|
|
34737
|
-
} finally {
|
|
34738
|
-
if (previous === void 0) delete process.env[key];
|
|
34739
|
-
else process.env[key] = previous;
|
|
34740
|
-
}
|
|
34741
|
-
}
|
|
34742
|
-
var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail3, pass, LIST_STATUS, checking;
|
|
34743
|
-
var init_agent_status = __esm({
|
|
34744
|
-
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts"() {
|
|
34745
|
-
"use strict";
|
|
34746
|
-
init_src3();
|
|
34747
|
-
VERSION_TIMEOUT_MS = 5e3;
|
|
34748
|
-
PROMPT_TIMEOUT_MS = 6e4;
|
|
34749
|
-
TEST_PROMPT = "Reply with the single word: ok";
|
|
34750
|
-
INSTALL_HINTS = {
|
|
34751
|
-
claude: "npm install -g @anthropic-ai/claude-code",
|
|
34752
|
-
codex: "npm install -g @openai/codex",
|
|
34753
|
-
opencode: "npm install -g opencode-ai",
|
|
34754
|
-
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
34755
|
-
copilot: "npm install -g @github/copilot"
|
|
34756
|
-
};
|
|
34757
|
-
LOGIN_HINTS = {
|
|
34758
|
-
claude: "run `claude login`",
|
|
34759
|
-
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
34760
|
-
opencode: "run `opencode auth`",
|
|
34761
|
-
cursor: "sign in from Cursor",
|
|
34762
|
-
copilot: "run `copilot` and sign in"
|
|
34763
|
-
};
|
|
34764
|
-
fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
34765
|
-
pass = (step, detail) => ({ step, ok: true, detail });
|
|
34766
|
-
LIST_STATUS = {
|
|
34767
|
-
checking: { symbol: "\u2026", text: "checking", tone: "muted" },
|
|
34768
|
-
ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
|
|
34769
|
-
"not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
|
|
34770
|
-
"not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
|
|
34771
|
-
"not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
|
|
34772
|
-
"test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
|
|
34773
|
-
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
34774
|
-
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
34775
|
-
};
|
|
34776
|
-
checking = [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
34777
|
-
}
|
|
34778
|
-
});
|
|
34779
|
-
|
|
34780
|
-
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
34781
|
-
function agentSnapshot(config) {
|
|
34782
|
-
const snapshot = { default_agent: config.defaultAgent };
|
|
34783
|
-
for (const name of AGENT_NAMES) {
|
|
34784
|
-
snapshot[`${name}.model`] = config.agents[name].model;
|
|
34785
|
-
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
34786
|
-
}
|
|
34787
|
-
return snapshot;
|
|
34788
|
-
}
|
|
34789
|
-
function environmentFrom(checks, savedBinary, envValue) {
|
|
34790
|
-
const path5 = checks.find((check) => check.step === "path");
|
|
34791
|
-
const version2 = checks.find((check) => check.step === "version");
|
|
34792
|
-
const overridden = envValue !== void 0 && envValue !== "" && envValue !== savedBinary.trim();
|
|
34793
|
-
return {
|
|
34794
|
-
found: path5?.ok === true,
|
|
34795
|
-
resolved_path: path5?.ok ? path5.detail : "",
|
|
34796
|
-
version: version2?.ok ? version2.detail : "",
|
|
34797
|
-
env_override: overridden ? envValue : ""
|
|
34798
|
-
};
|
|
34799
|
-
}
|
|
34800
|
-
async function describeAgents(config) {
|
|
34801
|
-
const entries = await Promise.all(
|
|
34802
|
-
AGENT_NAMES.map(async (name) => {
|
|
34803
|
-
const saved = config.agents[name].binary;
|
|
34804
|
-
const checks = await inspectAgent(name, saved);
|
|
34805
|
-
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
34806
|
-
})
|
|
34807
|
-
);
|
|
34808
|
-
return Object.fromEntries(entries);
|
|
34809
|
-
}
|
|
34810
|
-
var init_agent_debug = __esm({
|
|
34811
|
-
"packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts"() {
|
|
34812
|
-
"use strict";
|
|
34813
|
-
init_src3();
|
|
34814
|
-
init_agent_status();
|
|
34815
|
-
}
|
|
34816
|
-
});
|
|
34817
|
-
|
|
34818
34910
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
34819
34911
|
import { Text as Text49 } from "ink";
|
|
34820
34912
|
import { jsx as jsx59 } from "react/jsx-runtime";
|