@contentful/experience-design-system-cli 2.37.1-dev-build-91ca3bb8.0 → 2.37.1-dev-build-a7704a7f.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 +248 -999
- package/dist/index.js +319 -1217
- package/dist/package.json +1 -1
- package/dist/src/tui/settings/contentful-configuration/ContentfulConfigScreen.d.ts +0 -1
- package/package.json +3 -3
- package/dist/src/commands/forwarded.d.ts +0 -2
- package/dist/src/legacy/forwarded-import-args.d.ts +0 -1
- package/dist/src/legacy/legacy-cli-path.d.ts +0 -1
- package/dist/src/legacy/run-legacy.d.ts +0 -1
- package/dist/src/tui/help/file-locations.d.ts +0 -23
- package/dist/src/tui/settings/agents/AgentDetail.d.ts +0 -13
- package/dist/src/tui/settings/agents/AgentScreens.d.ts +0 -11
- package/dist/src/tui/settings/agents/AgentStatusBadge.d.ts +0 -10
- package/dist/src/tui/settings/agents/agent-status.d.ts +0 -80
- package/dist/src/tui/settings/agents/agent-store.d.ts +0 -17
- package/dist/src/tui/settings/agents/apply-binary-overrides.d.ts +0 -13
- package/dist/src/tui/settings/contentful-configuration/ProjectConfigScreen.d.ts +0 -5
- package/dist/src/tui/settings/shared/FieldForm.d.ts +0 -35
- package/legacy/bin/cli.js +0 -58
- package/legacy/dist/package.json +0 -76
- package/legacy/dist/src/analytics/exit.d.ts +0 -4
- package/legacy/dist/src/analytics/index.d.ts +0 -3
- package/legacy/dist/src/analyze/composite-closure.d.ts +0 -26
- package/legacy/dist/src/analyze/composition/apply-mapping.d.ts +0 -22
- package/legacy/dist/src/analyze/composition/candidate-files.d.ts +0 -34
- package/legacy/dist/src/analyze/composition/composition-cache-key.d.ts +0 -18
- package/legacy/dist/src/analyze/composition/interchange-schema.d.ts +0 -17
- package/legacy/dist/src/analyze/composition/manifest-doc-evidence.d.ts +0 -49
- package/legacy/dist/src/analyze/composition/merge-edges.d.ts +0 -19
- package/legacy/dist/src/analyze/composition/parse-map-edges.d.ts +0 -16
- package/legacy/dist/src/analyze/composition/prompt-loader.d.ts +0 -3
- package/legacy/dist/src/analyze/composition/resolve-mapping-cli.d.ts +0 -10
- package/legacy/dist/src/analyze/composition/resolve-mapping.d.ts +0 -59
- package/legacy/dist/src/analyze/cycle-detection.d.ts +0 -27
- package/legacy/dist/src/analyze/extract-command.d.ts +0 -7
- package/legacy/dist/src/analyze/fuzzy-search.d.ts +0 -3
- package/legacy/dist/src/analyze/issue-inheritance.d.ts +0 -8
- package/legacy/dist/src/analyze/lineage.d.ts +0 -29
- package/legacy/dist/src/analyze/search-neighborhood.d.ts +0 -3
- package/legacy/dist/src/analyze/select/command.d.ts +0 -27
- package/legacy/dist/src/analyze/select/parser.d.ts +0 -6
- package/legacy/dist/src/analyze/select/persistence.d.ts +0 -22
- package/legacy/dist/src/analyze/select/preview-annotations.d.ts +0 -26
- package/legacy/dist/src/analyze/select/tui/LegacySelectApp.d.ts +0 -8
- package/legacy/dist/src/analyze/select/tui/components/ComponentDetail.d.ts +0 -19
- package/legacy/dist/src/analyze/select/tui/components/ComponentRationalePanel.d.ts +0 -10
- package/legacy/dist/src/analyze/select/tui/components/FieldEditor.d.ts +0 -67
- package/legacy/dist/src/analyze/select/tui/components/FinalizeDialog.d.ts +0 -22
- package/legacy/dist/src/analyze/select/tui/components/GotoBanner.d.ts +0 -31
- package/legacy/dist/src/analyze/select/tui/components/GroupedSidebar.d.ts +0 -94
- package/legacy/dist/src/analyze/select/tui/components/HelpOverlay.d.ts +0 -21
- package/legacy/dist/src/analyze/select/tui/components/HighlightedLine.d.ts +0 -9
- package/legacy/dist/src/analyze/select/tui/components/JsonEditor.d.ts +0 -10
- package/legacy/dist/src/analyze/select/tui/components/JsonPanel.d.ts +0 -11
- package/legacy/dist/src/analyze/select/tui/components/PreviewSummaryBar.d.ts +0 -8
- package/legacy/dist/src/analyze/select/tui/components/QuitDialog.d.ts +0 -8
- package/legacy/dist/src/analyze/select/tui/components/RationaleLine.d.ts +0 -21
- package/legacy/dist/src/analyze/select/tui/components/RationalePanel.d.ts +0 -15
- package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +0 -14
- package/legacy/dist/src/analyze/select/tui/components/Sidebar.d.ts +0 -29
- package/legacy/dist/src/analyze/select/tui/components/SourcePanel.d.ts +0 -11
- package/legacy/dist/src/analyze/select/tui/components/StatusBar.d.ts +0 -11
- package/legacy/dist/src/analyze/select/tui/components/TokenReviewPanel.d.ts +0 -30
- package/legacy/dist/src/analyze/select/tui/components/TopBar.d.ts +0 -10
- package/legacy/dist/src/analyze/select/tui/components/removed-components-text.d.ts +0 -7
- package/legacy/dist/src/analyze/select/tui/components/wrap-text.d.ts +0 -1
- package/legacy/dist/src/analyze/select/tui/hooks/list-scroll-input.d.ts +0 -13
- package/legacy/dist/src/analyze/select/tui/hooks/scroll-offset.d.ts +0 -30
- package/legacy/dist/src/analyze/select/tui/hooks/useImmediateInput.d.ts +0 -19
- package/legacy/dist/src/analyze/select/tui/hooks/useKeymap.d.ts +0 -24
- package/legacy/dist/src/analyze/select/tui/hooks/useSession.d.ts +0 -19
- package/legacy/dist/src/analyze/select/tui/hooks/useUndo.d.ts +0 -8
- package/legacy/dist/src/analyze/select/tui/theme.d.ts +0 -18
- package/legacy/dist/src/analyze/select/types.d.ts +0 -54
- package/legacy/dist/src/analyze/selection-cascade.d.ts +0 -3
- package/legacy/dist/src/analyze/slot-graph.d.ts +0 -11
- package/legacy/dist/src/apply/api-client.d.ts +0 -64
- package/legacy/dist/src/apply/command.d.ts +0 -43
- package/legacy/dist/src/apply/preview-utils.d.ts +0 -12
- package/legacy/dist/src/apply/tokens.d.ts +0 -1
- package/legacy/dist/src/apply/tui/ServerApplyView.d.ts +0 -34
- package/legacy/dist/src/apply/tui/ServerPreviewView.d.ts +0 -9
- package/legacy/dist/src/credentials-store.d.ts +0 -18
- package/legacy/dist/src/doctor/checks.d.ts +0 -5
- package/legacy/dist/src/doctor/command.d.ts +0 -2
- package/legacy/dist/src/doctor/report.d.ts +0 -7
- package/legacy/dist/src/generate/command.d.ts +0 -2
- package/legacy/dist/src/generate/tui/GenerateView.d.ts +0 -12
- package/legacy/dist/src/helpers/build-contentful-management-client.d.ts +0 -7
- package/legacy/dist/src/helpers/fetch-and-persist-existing-contentful-entities.d.ts +0 -29
- package/legacy/dist/src/helpers/fetch-existing-contentful-entities.d.ts +0 -11
- package/legacy/dist/src/helpers/find-nearly-matching-component.d.ts +0 -7
- package/legacy/dist/src/helpers/read-existing-contentful-entities-from-session.d.ts +0 -7
- package/legacy/dist/src/helpers/summarize-existing-contentful-entities.d.ts +0 -50
- package/legacy/dist/src/host-utils.d.ts +0 -3
- package/legacy/dist/src/index.d.ts +0 -1
- package/legacy/dist/src/index.js +0 -25166
- package/legacy/dist/src/lib/agent-definitions.d.ts +0 -14
- package/legacy/dist/src/lib/agent-model-options.d.ts +0 -15
- package/legacy/dist/src/lib/agent-output.d.ts +0 -5
- package/legacy/dist/src/lib/cli-errors.d.ts +0 -2
- package/legacy/dist/src/lib/cli-path.d.ts +0 -4
- package/legacy/dist/src/lib/command-options.d.ts +0 -3
- package/legacy/dist/src/lib/component-patch.d.ts +0 -12
- package/legacy/dist/src/lib/contentful-urls.d.ts +0 -15
- package/legacy/dist/src/lib/debug-logger.d.ts +0 -39
- package/legacy/dist/src/lib/debug-preamble.d.ts +0 -7
- package/legacy/dist/src/lib/error-parser.d.ts +0 -40
- package/legacy/dist/src/lib/path-exists.d.ts +0 -1
- package/legacy/dist/src/lib/prompt-overrides.d.ts +0 -38
- package/legacy/dist/src/lib/terminal-capabilities.d.ts +0 -29
- package/legacy/dist/src/lib/user-agent.d.ts +0 -7
- package/legacy/dist/src/map-tokens/apply.d.ts +0 -12
- package/legacy/dist/src/map-tokens/command.d.ts +0 -2
- package/legacy/dist/src/map-tokens/resolve-defaults.d.ts +0 -32
- package/legacy/dist/src/map-tokens/tui/MapTokensView.d.ts +0 -13
- package/legacy/dist/src/output/format.d.ts +0 -23
- package/legacy/dist/src/print/command.d.ts +0 -11
- package/legacy/dist/src/print/validate/tui/ValidateView.d.ts +0 -15
- package/legacy/dist/src/print/validate/validators/cdf-validator.d.ts +0 -2
- package/legacy/dist/src/print/validate/validators/dtcg-validator.d.ts +0 -2
- package/legacy/dist/src/print/validate/validators/format-errors.d.ts +0 -12
- package/legacy/dist/src/print/validate/validators/read-json-file.d.ts +0 -10
- package/legacy/dist/src/program.d.ts +0 -25
- package/legacy/dist/src/runs/fingerprint.d.ts +0 -36
- package/legacy/dist/src/runs/save-path-resolver.d.ts +0 -11
- package/legacy/dist/src/runs/store.d.ts +0 -65
- package/legacy/dist/src/session/cache-keys.d.ts +0 -22
- package/legacy/dist/src/session/core/cdf/cdf-mappers.d.ts +0 -3
- package/legacy/dist/src/session/core/components/derive-component-id.d.ts +0 -1
- package/legacy/dist/src/session/core/components/hash-component-shape.d.ts +0 -5
- package/legacy/dist/src/session/core/shared/index-rows-by-key.d.ts +0 -1
- package/legacy/dist/src/session/core/tokens/build-dtcg-groups.d.ts +0 -12
- package/legacy/dist/src/session/core/tokens/build-dtcg-tokens.d.ts +0 -3
- package/legacy/dist/src/session/core/tokens/hash-token-content.d.ts +0 -1
- package/legacy/dist/src/session/db.d.ts +0 -200
- package/legacy/dist/src/session/migration.d.ts +0 -2
- package/legacy/dist/src/session/repositories/sessions/read.d.ts +0 -11
- package/legacy/dist/src/session/repositories/sessions/write.d.ts +0 -3
- package/legacy/dist/src/session/repositories/shared/with-transaction.d.ts +0 -2
- package/legacy/dist/src/session/repositories/steps/read.d.ts +0 -2
- package/legacy/dist/src/session/repositories/steps/write.d.ts +0 -5
- package/legacy/dist/src/session/repositories/tokens/read.d.ts +0 -15
- package/legacy/dist/src/session/repositories/tokens/write.d.ts +0 -16
- package/legacy/dist/src/session/resolve-session-id.d.ts +0 -1
- package/legacy/dist/src/session/services/session-resolver.d.ts +0 -9
- package/legacy/dist/src/session/services/tokens/apply-tool-calls.d.ts +0 -8
- package/legacy/dist/src/session/services/tokens/replace-raw-prop-token-paths.d.ts +0 -3
- package/legacy/dist/src/session/services/tokens/replace-raw-token-name-paths.d.ts +0 -3
- package/legacy/dist/src/session/services/tokens/store-dtcg-tokens.d.ts +0 -3
- package/legacy/dist/src/session/session-id.d.ts +0 -1
- package/legacy/dist/src/session/source-excerpt.d.ts +0 -26
- package/legacy/dist/src/setup/SetupScreen.d.ts +0 -28
- package/legacy/dist/src/setup/SetupStepper.d.ts +0 -7
- package/legacy/dist/src/setup/command.d.ts +0 -3
- package/legacy/dist/src/setup/lib/checks.d.ts +0 -57
- package/legacy/dist/src/setup/lib/shell.d.ts +0 -12
- package/legacy/dist/src/setup/steps/CodingAgentScreen.d.ts +0 -20
- package/legacy/dist/src/setup/steps/ContentfulCredentialsScreen.d.ts +0 -11
- package/legacy/dist/src/setup/steps/StepLayout.d.ts +0 -20
- package/legacy/dist/src/setup/steps/preferences/AnalyticsScreen.d.ts +0 -5
- package/legacy/dist/src/setup/steps/preferences/BooleanInput.d.ts +0 -21
- package/legacy/dist/src/setup/steps/preferences/ColorPreferenceScreen.d.ts +0 -5
- package/legacy/dist/src/setup/steps/preferences/CustomPromptScreen.d.ts +0 -14
- package/legacy/dist/src/setup/steps/preferences/DebugLogsScreen.d.ts +0 -5
- package/legacy/dist/src/setup/steps/preferences/PreferencesMenu.d.ts +0 -26
- package/legacy/dist/src/setup/steps/prerequisites/PrerequisitesScreen.d.ts +0 -16
- package/legacy/dist/src/setup/steps/prerequisites/build.d.ts +0 -2
- package/legacy/dist/src/setup/steps/prerequisites/deps.d.ts +0 -33
- package/legacy/dist/src/setup/steps/prerequisites/index.d.ts +0 -4
- package/legacy/dist/src/setup/steps/prerequisites/node.d.ts +0 -2
- package/legacy/dist/src/setup/steps/prerequisites/pnpm.d.ts +0 -2
- package/legacy/dist/src/tui/CommandCompletionView.d.ts +0 -13
- package/legacy/dist/src/tui/render-with-goodbye.d.ts +0 -7
- package/legacy/dist/src/tui/use-terminal-size.d.ts +0 -6
- package/legacy/dist/src/tui/windowed-panel.d.ts +0 -37
- package/legacy/dist/src/types.d.ts +0 -2
- package/legacy/package.json +0 -85
- package/legacy/prompts/composition-edges.md +0 -11
- package/legacy/skills/generate-components.md +0 -612
- package/legacy/skills/generate-tokens.md +0 -194
- package/legacy/skills/map-tokens.md +0 -102
- package/legacy/skills/select-components.md +0 -235
package/dist/index.js
CHANGED
|
@@ -1500,7 +1500,7 @@ async function runAgent(options) {
|
|
|
1500
1500
|
promptLen: prompt.length,
|
|
1501
1501
|
promptHead: prompt.slice(0, 500)
|
|
1502
1502
|
});
|
|
1503
|
-
return new Promise((
|
|
1503
|
+
return new Promise((resolve27) => {
|
|
1504
1504
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1505
1505
|
const child = spawn(binary, args, {
|
|
1506
1506
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1549,7 +1549,7 @@ async function runAgent(options) {
|
|
|
1549
1549
|
stderrLen: stderr.length,
|
|
1550
1550
|
stderrTail: stderr.slice(-1e3)
|
|
1551
1551
|
});
|
|
1552
|
-
|
|
1552
|
+
resolve27(result);
|
|
1553
1553
|
});
|
|
1554
1554
|
});
|
|
1555
1555
|
}
|
|
@@ -1571,7 +1571,7 @@ async function checkAgentAuth(agent) {
|
|
|
1571
1571
|
return "not-found";
|
|
1572
1572
|
if (agent !== "claude")
|
|
1573
1573
|
return "ok";
|
|
1574
|
-
return new Promise((
|
|
1574
|
+
return new Promise((resolve27) => {
|
|
1575
1575
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1576
1576
|
let stdout = "";
|
|
1577
1577
|
let done = false;
|
|
@@ -1580,7 +1580,7 @@ async function checkAgentAuth(agent) {
|
|
|
1580
1580
|
return;
|
|
1581
1581
|
done = true;
|
|
1582
1582
|
child.kill("SIGTERM");
|
|
1583
|
-
|
|
1583
|
+
resolve27("unauthenticated");
|
|
1584
1584
|
}, 5e3);
|
|
1585
1585
|
child.stdout?.on("data", (chunk) => {
|
|
1586
1586
|
stdout += chunk.toString();
|
|
@@ -1591,14 +1591,14 @@ async function checkAgentAuth(agent) {
|
|
|
1591
1591
|
done = true;
|
|
1592
1592
|
clearTimeout(timer);
|
|
1593
1593
|
if (code !== 0) {
|
|
1594
|
-
|
|
1594
|
+
resolve27("unauthenticated");
|
|
1595
1595
|
return;
|
|
1596
1596
|
}
|
|
1597
1597
|
try {
|
|
1598
1598
|
const status = JSON.parse(stdout);
|
|
1599
|
-
|
|
1599
|
+
resolve27(status.loggedIn ? "ok" : "unauthenticated");
|
|
1600
1600
|
} catch {
|
|
1601
|
-
|
|
1601
|
+
resolve27("unauthenticated");
|
|
1602
1602
|
}
|
|
1603
1603
|
});
|
|
1604
1604
|
});
|
|
@@ -1608,9 +1608,9 @@ async function binaryIsOnPath(binary) {
|
|
|
1608
1608
|
const fs = await import("node:fs/promises");
|
|
1609
1609
|
return fs.access(binary).then(() => true, () => false);
|
|
1610
1610
|
}
|
|
1611
|
-
return new Promise((
|
|
1611
|
+
return new Promise((resolve27) => {
|
|
1612
1612
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1613
|
-
child.on("close", (code) =>
|
|
1613
|
+
child.on("close", (code) => resolve27(code === 0));
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
1616
|
var init_check_agent_auth = __esm({
|
|
@@ -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 access6 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
|
|
7920
|
+
if (access6.getExpression().getText() !== slotsName)
|
|
7921
7921
|
continue;
|
|
7922
|
-
const slotName =
|
|
7922
|
+
const slotName = access6.getName();
|
|
7923
7923
|
if (!slotsByName.has(slotName)) {
|
|
7924
7924
|
slotsByName.set(slotName, {
|
|
7925
7925
|
name: slotName,
|
|
@@ -14333,7 +14333,7 @@ function errorMessage(error) {
|
|
|
14333
14333
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14334
14334
|
}
|
|
14335
14335
|
function defaultSleep(delayMs) {
|
|
14336
|
-
return new Promise((
|
|
14336
|
+
return new Promise((resolve27) => setTimeout(resolve27, delayMs));
|
|
14337
14337
|
}
|
|
14338
14338
|
var MAX_RETRY_AFTER_MS;
|
|
14339
14339
|
var init_http_utils = __esm({
|
|
@@ -14609,7 +14609,7 @@ var init_api_client = __esm({
|
|
|
14609
14609
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
14610
14610
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
14611
14611
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14612
|
-
await new Promise((
|
|
14612
|
+
await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
|
|
14613
14613
|
}
|
|
14614
14614
|
}
|
|
14615
14615
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -18527,7 +18527,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18527
18527
|
const message = error instanceof Error ? error.message : String(error);
|
|
18528
18528
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18529
18529
|
throw error;
|
|
18530
|
-
await new Promise((
|
|
18530
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
|
|
18531
18531
|
}
|
|
18532
18532
|
}
|
|
18533
18533
|
}
|
|
@@ -19446,7 +19446,6 @@ var init_src4 = __esm({
|
|
|
19446
19446
|
init_agents();
|
|
19447
19447
|
init_agent_name();
|
|
19448
19448
|
init_models();
|
|
19449
|
-
init_binaries();
|
|
19450
19449
|
init_is_agent_name();
|
|
19451
19450
|
init_agent_supports_bedrock();
|
|
19452
19451
|
init_check_agent_auth();
|
|
@@ -19523,9 +19522,9 @@ var init_package_root = __esm({
|
|
|
19523
19522
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
19524
19523
|
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
19525
19524
|
import { homedir as homedir2 } from "node:os";
|
|
19526
|
-
import { dirname as dirname13, join as
|
|
19525
|
+
import { dirname as dirname13, join as join16 } from "node:path";
|
|
19527
19526
|
function configRoot2() {
|
|
19528
|
-
return process.env["EDS_HOME"] ||
|
|
19527
|
+
return process.env["EDS_HOME"] || join16(homedir2(), ".contentful", "experience-design-system-cli");
|
|
19529
19528
|
}
|
|
19530
19529
|
async function readSettings2() {
|
|
19531
19530
|
try {
|
|
@@ -19549,9 +19548,9 @@ var configFilePath2, runsFilePath2, oldConfigDir2;
|
|
|
19549
19548
|
var init_config = __esm({
|
|
19550
19549
|
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
19551
19550
|
"use strict";
|
|
19552
|
-
configFilePath2 = () =>
|
|
19553
|
-
runsFilePath2 = () =>
|
|
19554
|
-
oldConfigDir2 = () =>
|
|
19551
|
+
configFilePath2 = () => join16(configRoot2(), "config.json");
|
|
19552
|
+
runsFilePath2 = () => join16(configRoot2(), "state", "runs.json");
|
|
19553
|
+
oldConfigDir2 = () => join16(homedir2(), ".config", "experiences");
|
|
19555
19554
|
}
|
|
19556
19555
|
});
|
|
19557
19556
|
|
|
@@ -19566,97 +19565,6 @@ var init_v1_store = __esm({
|
|
|
19566
19565
|
}
|
|
19567
19566
|
});
|
|
19568
19567
|
|
|
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
|
-
|
|
19660
19568
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
19661
19569
|
async function readAnalyticsSetting() {
|
|
19662
19570
|
const store = await readV1Store();
|
|
@@ -19717,11 +19625,11 @@ var init_home_theme = __esm({
|
|
|
19717
19625
|
|
|
19718
19626
|
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
19719
19627
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
19720
|
-
import { join as
|
|
19628
|
+
import { join as join17 } from "node:path";
|
|
19721
19629
|
import semver from "semver";
|
|
19722
19630
|
function readPackageVersion() {
|
|
19723
|
-
const root = findPackageRoot(import.meta.url,
|
|
19724
|
-
const pkg2 = JSON.parse(readFileSync8(
|
|
19631
|
+
const root = findPackageRoot(import.meta.url, PACKAGE_NAME2);
|
|
19632
|
+
const pkg2 = JSON.parse(readFileSync8(join17(root, "package.json"), "utf8"));
|
|
19725
19633
|
return pkg2.version ?? "unknown";
|
|
19726
19634
|
}
|
|
19727
19635
|
function parseVersionTag(tag) {
|
|
@@ -19746,12 +19654,12 @@ async function checkForUpgrade() {
|
|
|
19746
19654
|
return { status: "error" };
|
|
19747
19655
|
}
|
|
19748
19656
|
}
|
|
19749
|
-
var
|
|
19657
|
+
var PACKAGE_NAME2, TAGS_URL;
|
|
19750
19658
|
var init_version = __esm({
|
|
19751
19659
|
"packages/experience-design-system-cli/src/tui/upgrade/version.ts"() {
|
|
19752
19660
|
"use strict";
|
|
19753
19661
|
init_package_root();
|
|
19754
|
-
|
|
19662
|
+
PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
19755
19663
|
TAGS_URL = "https://api.github.com/repos/contentful/experience-design-system-sdk-public/tags?per_page=10";
|
|
19756
19664
|
}
|
|
19757
19665
|
});
|
|
@@ -20886,15 +20794,15 @@ var init_shared2 = __esm({
|
|
|
20886
20794
|
|
|
20887
20795
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
|
|
20888
20796
|
import { access as access5, readdir as readdir2, stat as stat4 } from "node:fs/promises";
|
|
20889
|
-
import { join as
|
|
20797
|
+
import { join as join18 } from "node:path";
|
|
20890
20798
|
async function findLatestTokens(contentfulDir) {
|
|
20891
|
-
const candidates = [
|
|
20799
|
+
const candidates = [join18(contentfulDir, "tokens.json")];
|
|
20892
20800
|
try {
|
|
20893
20801
|
for (const session of await readdir2(contentfulDir, { withFileTypes: true })) {
|
|
20894
20802
|
if (!session.isDirectory()) continue;
|
|
20895
|
-
for (const run of await readdir2(
|
|
20803
|
+
for (const run of await readdir2(join18(contentfulDir, session.name), { withFileTypes: true }).catch(() => [])) {
|
|
20896
20804
|
if (run.isDirectory() && /^dsi-import-\d+$/.test(run.name)) {
|
|
20897
|
-
candidates.push(
|
|
20805
|
+
candidates.push(join18(contentfulDir, session.name, run.name, "tokens.json"));
|
|
20898
20806
|
}
|
|
20899
20807
|
}
|
|
20900
20808
|
}
|
|
@@ -21102,15 +21010,15 @@ var init_steps = __esm({
|
|
|
21102
21010
|
});
|
|
21103
21011
|
|
|
21104
21012
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21105
|
-
import { existsSync as
|
|
21106
|
-
import { dirname as dirname14, join as
|
|
21013
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
21014
|
+
import { dirname as dirname14, join as join19, resolve as resolve20 } from "node:path";
|
|
21107
21015
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21108
21016
|
function findSkillPath(fileName) {
|
|
21109
21017
|
const thisDir = dirname14(fileURLToPath4(import.meta.url));
|
|
21110
21018
|
let dir = thisDir;
|
|
21111
21019
|
for (; ; ) {
|
|
21112
|
-
const candidate =
|
|
21113
|
-
if (
|
|
21020
|
+
const candidate = join19(dir, "skills", fileName);
|
|
21021
|
+
if (existsSync9(candidate)) return candidate;
|
|
21114
21022
|
const parent = resolve20(dir, "..");
|
|
21115
21023
|
if (parent === dir) {
|
|
21116
21024
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
@@ -21222,9 +21130,9 @@ var init_selection2 = __esm({
|
|
|
21222
21130
|
|
|
21223
21131
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
21224
21132
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
21225
|
-
import { join as
|
|
21133
|
+
import { join as join20, resolve as resolve22 } from "node:path";
|
|
21226
21134
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
21227
|
-
const outDir = input.outDir ??
|
|
21135
|
+
const outDir = input.outDir ?? join20(resolve22(input.projectPath), ".contentful");
|
|
21228
21136
|
let progress = initialProgress({
|
|
21229
21137
|
hasCredentials: input.credentials !== null,
|
|
21230
21138
|
hasRawTokens: input.rawTokensPath !== "",
|
|
@@ -21319,7 +21227,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
21319
21227
|
const extraction = {
|
|
21320
21228
|
sessionId: extracted.sessionId,
|
|
21321
21229
|
outDir,
|
|
21322
|
-
tokensPath: tokens?.ok ? tokens.tokensPath : hasTokenSource ?
|
|
21230
|
+
tokensPath: tokens?.ok ? tokens.tokensPath : hasTokenSource ? join20(outDir, "tokens.json") : "",
|
|
21323
21231
|
tokenSessionId: tokens?.ok ? tokens.tokenSessionId : null,
|
|
21324
21232
|
tokenCount: tokens?.ok ? tokens.tokenCount : 0,
|
|
21325
21233
|
existingEntitiesPath,
|
|
@@ -24799,7 +24707,7 @@ var init_use_generation = __esm({
|
|
|
24799
24707
|
});
|
|
24800
24708
|
|
|
24801
24709
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
24802
|
-
import { join as
|
|
24710
|
+
import { join as join21 } from "node:path";
|
|
24803
24711
|
function buildFlowStart(input) {
|
|
24804
24712
|
const { extraction, handoff, saved, generatePromptPath } = input;
|
|
24805
24713
|
const credentials = extraction.credentials ?? {
|
|
@@ -24812,7 +24720,7 @@ function buildFlowStart(input) {
|
|
|
24812
24720
|
handoff,
|
|
24813
24721
|
agent: extraction.agent,
|
|
24814
24722
|
projectPath: extraction.projectPath,
|
|
24815
|
-
outDir: extraction.projectPath ?
|
|
24723
|
+
outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
|
|
24816
24724
|
rawTokensPath: extraction.rawTokensPath,
|
|
24817
24725
|
credentials: {
|
|
24818
24726
|
spaceId: credentials.spaceId,
|
|
@@ -31050,7 +30958,7 @@ var init_use_blinking_cursor = __esm({
|
|
|
31050
30958
|
import { useState as useState24 } from "react";
|
|
31051
30959
|
import { Box as Box37, Text as Text40 } from "ink";
|
|
31052
30960
|
import { readdirSync as readdirSync3 } from "node:fs";
|
|
31053
|
-
import { dirname as dirname15, basename as basename6, join as
|
|
30961
|
+
import { dirname as dirname15, basename as basename6, join as join22 } from "node:path";
|
|
31054
30962
|
import { jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
31055
30963
|
function autocomplete(partial) {
|
|
31056
30964
|
if (!partial) return null;
|
|
@@ -31065,13 +30973,13 @@ function autocomplete(partial) {
|
|
|
31065
30973
|
}
|
|
31066
30974
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
31067
30975
|
if (matches.length === 0) return null;
|
|
31068
|
-
if (matches.length === 1) return
|
|
30976
|
+
if (matches.length === 1) return join22(dir, matches[0]);
|
|
31069
30977
|
let prefix = matches[0];
|
|
31070
30978
|
for (const m of matches) {
|
|
31071
30979
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
31072
30980
|
if (!prefix) break;
|
|
31073
30981
|
}
|
|
31074
|
-
return prefix.length > base.length ?
|
|
30982
|
+
return prefix.length > base.length ? join22(dir, prefix) : null;
|
|
31075
30983
|
}
|
|
31076
30984
|
function PathPrompt({
|
|
31077
30985
|
defaultPath,
|
|
@@ -32269,7 +32177,7 @@ var init_run_print_files_helpers = __esm({
|
|
|
32269
32177
|
|
|
32270
32178
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
32271
32179
|
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
32272
|
-
import { join as
|
|
32180
|
+
import { join as join23 } from "node:path";
|
|
32273
32181
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
32274
32182
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
32275
32183
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -32281,7 +32189,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
32281
32189
|
}
|
|
32282
32190
|
async function runPrintFiles(input, deps, onPatch) {
|
|
32283
32191
|
onPatch({ step: "printing" });
|
|
32284
|
-
const componentsPath =
|
|
32192
|
+
const componentsPath = join23(input.outDir, "components.json");
|
|
32285
32193
|
try {
|
|
32286
32194
|
const db = deps.openDb();
|
|
32287
32195
|
let components = [];
|
|
@@ -32368,7 +32276,7 @@ var init_save = __esm({
|
|
|
32368
32276
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32369
32277
|
appendRun,
|
|
32370
32278
|
buildSourceFingerprint,
|
|
32371
|
-
sleep: (ms) => new Promise((
|
|
32279
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
32372
32280
|
warn: (message) => process.stderr.write(message)
|
|
32373
32281
|
});
|
|
32374
32282
|
}
|
|
@@ -32390,7 +32298,7 @@ var init_types9 = __esm({
|
|
|
32390
32298
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
32391
32299
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
32392
32300
|
import { tmpdir } from "node:os";
|
|
32393
|
-
import { join as
|
|
32301
|
+
import { join as join24, resolve as resolve25 } from "node:path";
|
|
32394
32302
|
function appendWizardLog(entry) {
|
|
32395
32303
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
32396
32304
|
}
|
|
@@ -32670,7 +32578,7 @@ var init_controller = __esm({
|
|
|
32670
32578
|
init_push();
|
|
32671
32579
|
init_save();
|
|
32672
32580
|
init_types9();
|
|
32673
|
-
WIZARD_LOG =
|
|
32581
|
+
WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
|
|
32674
32582
|
}
|
|
32675
32583
|
});
|
|
32676
32584
|
|
|
@@ -32736,8 +32644,8 @@ __export(debug_store_exports, {
|
|
|
32736
32644
|
startImportRun: () => startImportRun
|
|
32737
32645
|
});
|
|
32738
32646
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32739
|
-
import { existsSync as
|
|
32740
|
-
import { join as
|
|
32647
|
+
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
32648
|
+
import { join as join25, resolve as resolve26 } from "node:path";
|
|
32741
32649
|
function generateRunId() {
|
|
32742
32650
|
const now = /* @__PURE__ */ new Date();
|
|
32743
32651
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -32760,7 +32668,7 @@ async function readBaseDir() {
|
|
|
32760
32668
|
}
|
|
32761
32669
|
function nextSessionId(contentfulDir) {
|
|
32762
32670
|
const today = datePrefix();
|
|
32763
|
-
const existing =
|
|
32671
|
+
const existing = existsSync10(contentfulDir) ? readdirSync4(contentfulDir) : [];
|
|
32764
32672
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
32765
32673
|
const maxSeq = existing.reduce((max, entry) => {
|
|
32766
32674
|
const match2 = seqPattern.exec(entry);
|
|
@@ -32769,12 +32677,12 @@ function nextSessionId(contentfulDir) {
|
|
|
32769
32677
|
return `${today}-session-${maxSeq + 1}`;
|
|
32770
32678
|
}
|
|
32771
32679
|
function startSession(base, { replace }) {
|
|
32772
|
-
const contentfulDir =
|
|
32773
|
-
if (replace || !sessionDir) sessionDir =
|
|
32680
|
+
const contentfulDir = join25(base, ".contentful");
|
|
32681
|
+
if (replace || !sessionDir) sessionDir = join25(contentfulDir, nextSessionId(contentfulDir));
|
|
32774
32682
|
return sessionDir;
|
|
32775
32683
|
}
|
|
32776
32684
|
function currentDebugSessionDir() {
|
|
32777
|
-
return sessionDir &&
|
|
32685
|
+
return sessionDir && join25(sessionDir, "debug");
|
|
32778
32686
|
}
|
|
32779
32687
|
function currentSessionDir() {
|
|
32780
32688
|
return sessionDir;
|
|
@@ -32782,21 +32690,21 @@ function currentSessionDir() {
|
|
|
32782
32690
|
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
32783
32691
|
try {
|
|
32784
32692
|
if (!await isDebugModeEnabled()) return;
|
|
32785
|
-
await mkdir9(
|
|
32693
|
+
await mkdir9(join25(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
|
|
32786
32694
|
} catch {
|
|
32787
32695
|
}
|
|
32788
32696
|
}
|
|
32789
32697
|
function nextImportRunDir(session) {
|
|
32790
|
-
const existing =
|
|
32698
|
+
const existing = existsSync10(session) ? readdirSync4(session) : [];
|
|
32791
32699
|
const maxRun = existing.reduce((max, entry) => {
|
|
32792
32700
|
const match2 = /^dsi-import-(\d+)$/.exec(entry);
|
|
32793
32701
|
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32794
32702
|
}, 0);
|
|
32795
|
-
return
|
|
32703
|
+
return join25(session, `dsi-import-${maxRun + 1}`);
|
|
32796
32704
|
}
|
|
32797
32705
|
async function startImportRun(projectPath) {
|
|
32798
32706
|
await startDebugSessionIn(projectPath);
|
|
32799
|
-
if (!sessionDir) return
|
|
32707
|
+
if (!sessionDir) return join25(resolve26(projectPath), ".contentful");
|
|
32800
32708
|
const dir = nextImportRunDir(sessionDir);
|
|
32801
32709
|
await mkdir9(dir, { recursive: true });
|
|
32802
32710
|
return dir;
|
|
@@ -32843,15 +32751,15 @@ async function finishDebugRun({
|
|
|
32843
32751
|
const root = currentDebugSessionDir();
|
|
32844
32752
|
if (!root) return;
|
|
32845
32753
|
const flowSegments = run.flow.split("/");
|
|
32846
|
-
const dir =
|
|
32754
|
+
const dir = join25(root, ...flowSegments);
|
|
32847
32755
|
await mkdir9(dir, { recursive: true });
|
|
32848
32756
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
32849
|
-
await writeFile8(
|
|
32757
|
+
await writeFile8(join25(dir, filename), content, { mode: 384 });
|
|
32850
32758
|
}
|
|
32851
32759
|
function nextAttemptFilename(dir, menuOption) {
|
|
32852
32760
|
const today = datePrefix();
|
|
32853
32761
|
const optionSlug = slugify(menuOption);
|
|
32854
|
-
const existing =
|
|
32762
|
+
const existing = existsSync10(dir) ? readdirSync4(dir) : [];
|
|
32855
32763
|
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
32856
32764
|
const maxAttempt = existing.reduce((max, entry) => {
|
|
32857
32765
|
const match2 = attemptPattern.exec(entry);
|
|
@@ -32899,7 +32807,7 @@ var init_debug_store = __esm({
|
|
|
32899
32807
|
init_debug_mode_store();
|
|
32900
32808
|
void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
|
|
32901
32809
|
if (!enabled || !base) return void 0;
|
|
32902
|
-
return mkdir9(
|
|
32810
|
+
return mkdir9(join25(startSession(base, { replace: false }), "debug"), { recursive: true });
|
|
32903
32811
|
});
|
|
32904
32812
|
process.once("uncaughtException", (err) => {
|
|
32905
32813
|
void handleCrash().finally(() => {
|
|
@@ -32919,48 +32827,13 @@ var init_debug_store = __esm({
|
|
|
32919
32827
|
}
|
|
32920
32828
|
});
|
|
32921
32829
|
|
|
32922
|
-
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
32923
|
-
import { join as join27, resolve as resolve27 } from "node:path";
|
|
32924
|
-
function describeFileLocations({
|
|
32925
|
-
contentfulBaseDir,
|
|
32926
|
-
debugModeEnabled,
|
|
32927
|
-
currentSessionDir: currentSessionDir2
|
|
32928
|
-
}) {
|
|
32929
|
-
if (!debugModeEnabled) {
|
|
32930
|
-
return {
|
|
32931
|
-
debugLogs: "none while Debug Mode is off",
|
|
32932
|
-
importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
32933
|
-
};
|
|
32934
|
-
}
|
|
32935
|
-
const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
|
|
32936
|
-
const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
|
|
32937
|
-
return {
|
|
32938
|
-
debugLogs: join27(session, "debug"),
|
|
32939
|
-
importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
32940
|
-
};
|
|
32941
|
-
}
|
|
32942
|
-
var init_file_locations = __esm({
|
|
32943
|
-
"packages/experience-design-system-cli/src/tui/help/file-locations.ts"() {
|
|
32944
|
-
"use strict";
|
|
32945
|
-
}
|
|
32946
|
-
});
|
|
32947
|
-
|
|
32948
32830
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32949
32831
|
async function readHelpInfo() {
|
|
32950
|
-
const
|
|
32951
|
-
const base = settings["contentfulBaseDir"];
|
|
32952
|
-
const locations = describeFileLocations({
|
|
32953
|
-
contentfulBaseDir: typeof base === "string" ? base : "",
|
|
32954
|
-
debugModeEnabled: debugMode.enabled,
|
|
32955
|
-
currentSessionDir: currentSessionDir()
|
|
32956
|
-
});
|
|
32832
|
+
const debugMode = await readDebugModeSetting();
|
|
32957
32833
|
return {
|
|
32958
32834
|
storage: [
|
|
32959
32835
|
{ label: "Config folder", value: configRoot2() },
|
|
32960
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
32961
|
-
{ label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
|
|
32962
|
-
{ label: "Debug logs", value: locations.debugLogs },
|
|
32963
|
-
{ label: "Import files", value: locations.importFiles }
|
|
32836
|
+
{ label: "Settings file", value: configFilePath2() }
|
|
32964
32837
|
],
|
|
32965
32838
|
troubleshooting: [
|
|
32966
32839
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32981,7 +32854,6 @@ var init_help_info = __esm({
|
|
|
32981
32854
|
init_debug_store();
|
|
32982
32855
|
init_debug_mode_store();
|
|
32983
32856
|
init_version();
|
|
32984
|
-
init_file_locations();
|
|
32985
32857
|
}
|
|
32986
32858
|
});
|
|
32987
32859
|
|
|
@@ -32993,7 +32865,7 @@ function Section({ title, rows }) {
|
|
|
32993
32865
|
return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
|
|
32994
32866
|
/* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
|
|
32995
32867
|
rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
|
|
32996
|
-
/* @__PURE__ */ jsx53(Box42, { width:
|
|
32868
|
+
/* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
|
|
32997
32869
|
/* @__PURE__ */ jsx53(Text44, { children: row.value })
|
|
32998
32870
|
] }, row.label))
|
|
32999
32871
|
] });
|
|
@@ -33107,730 +32979,6 @@ var init_PageContainer3 = __esm({
|
|
|
33107
32979
|
}
|
|
33108
32980
|
});
|
|
33109
32981
|
|
|
33110
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
|
|
33111
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
33112
|
-
import { access as access6, constants } from "node:fs/promises";
|
|
33113
|
-
function effectiveBinary(name, savedBinary) {
|
|
33114
|
-
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
33115
|
-
}
|
|
33116
|
-
function defaultModelLabel(name) {
|
|
33117
|
-
const model = DEFAULT_MODELS[name];
|
|
33118
|
-
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33119
|
-
}
|
|
33120
|
-
function resolveOnPath(binary) {
|
|
33121
|
-
if (binary.includes("/")) {
|
|
33122
|
-
return access6(binary, constants.X_OK).then(
|
|
33123
|
-
() => binary,
|
|
33124
|
-
() => null
|
|
33125
|
-
);
|
|
33126
|
-
}
|
|
33127
|
-
return new Promise((resolve28) => {
|
|
33128
|
-
execFile2(
|
|
33129
|
-
process.platform === "win32" ? "where" : "which",
|
|
33130
|
-
[binary],
|
|
33131
|
-
(error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
|
|
33132
|
-
);
|
|
33133
|
-
});
|
|
33134
|
-
}
|
|
33135
|
-
function readVersion(binary) {
|
|
33136
|
-
return new Promise((resolve28) => {
|
|
33137
|
-
execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
|
|
33138
|
-
const line = stdout.split("\n")[0]?.trim() ?? "";
|
|
33139
|
-
if (!error && line) resolve28(pass("version", line));
|
|
33140
|
-
else resolve28(fail3("version", "runs, but did not report a version"));
|
|
33141
|
-
});
|
|
33142
|
-
});
|
|
33143
|
-
}
|
|
33144
|
-
async function inspectAgent(name, binary) {
|
|
33145
|
-
const target = effectiveBinary(name, binary);
|
|
33146
|
-
const found = await resolveOnPath(target);
|
|
33147
|
-
if (!found) return [fail3("path", `\`${target}\` was not found or is not executable`)];
|
|
33148
|
-
const checks = [pass("path", found)];
|
|
33149
|
-
checks.push(await readVersion(found));
|
|
33150
|
-
if (name === "claude") {
|
|
33151
|
-
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
33152
|
-
checks.push(
|
|
33153
|
-
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33154
|
-
);
|
|
33155
|
-
}
|
|
33156
|
-
return checks;
|
|
33157
|
-
}
|
|
33158
|
-
async function testAgent(name, binary, model) {
|
|
33159
|
-
const checks = await inspectAgent(name, binary);
|
|
33160
|
-
if (!checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33161
|
-
const target = effectiveBinary(name, binary);
|
|
33162
|
-
const found = await resolveOnPath(target) ?? target;
|
|
33163
|
-
const started = Date.now();
|
|
33164
|
-
const result = await withBinaryEnv(
|
|
33165
|
-
name,
|
|
33166
|
-
found,
|
|
33167
|
-
() => createLocalCliAgentInvoker().invoke({
|
|
33168
|
-
agent: name,
|
|
33169
|
-
...model.trim() ? { model: model.trim() } : {},
|
|
33170
|
-
prompt: TEST_PROMPT,
|
|
33171
|
-
timeoutMs: PROMPT_TIMEOUT_MS
|
|
33172
|
-
})
|
|
33173
|
-
);
|
|
33174
|
-
const seconds = ((Date.now() - started) / 1e3).toFixed(1);
|
|
33175
|
-
if (result.timedOut) {
|
|
33176
|
-
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
33177
|
-
}
|
|
33178
|
-
if (result.exitCode !== 0) {
|
|
33179
|
-
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
33180
|
-
return [...checks, fail3("prompt", reason)];
|
|
33181
|
-
}
|
|
33182
|
-
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33183
|
-
}
|
|
33184
|
-
function statusFromChecks(name, checks, savedBinary) {
|
|
33185
|
-
if (checks.length === 0) return "checking";
|
|
33186
|
-
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33187
|
-
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
33188
|
-
}
|
|
33189
|
-
const prompt = checks.find((check) => check.step === "prompt");
|
|
33190
|
-
if (prompt) {
|
|
33191
|
-
if (prompt.ok) return "ready";
|
|
33192
|
-
return prompt.timedOut ? "timed-out" : "test-failed";
|
|
33193
|
-
}
|
|
33194
|
-
const login = checks.find((check) => check.step === "login");
|
|
33195
|
-
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33196
|
-
return name === "claude" ? "ready" : "unknown";
|
|
33197
|
-
}
|
|
33198
|
-
function setupHint(name, status) {
|
|
33199
|
-
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
33200
|
-
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
33201
|
-
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33202
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
33203
|
-
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
33204
|
-
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33205
|
-
return "";
|
|
33206
|
-
}
|
|
33207
|
-
function testOutcome(checks) {
|
|
33208
|
-
const prompt = checks?.find((check) => check.step === "prompt");
|
|
33209
|
-
if (!prompt) return void 0;
|
|
33210
|
-
if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
|
|
33211
|
-
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
33212
|
-
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
33213
|
-
}
|
|
33214
|
-
function modelLine(name, savedModel) {
|
|
33215
|
-
const model = savedModel.trim();
|
|
33216
|
-
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
33217
|
-
}
|
|
33218
|
-
function panelRows(name, checks, settings) {
|
|
33219
|
-
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
33220
|
-
const status = statusFromChecks(name, checks, settings.binary);
|
|
33221
|
-
const path5 = checks.find((check) => check.step === "path");
|
|
33222
|
-
if (!path5?.ok) {
|
|
33223
|
-
const rows2 = [
|
|
33224
|
-
{
|
|
33225
|
-
label: "Command",
|
|
33226
|
-
value: settings.binary.trim() ? path5?.detail ?? "not found" : "not found on your PATH",
|
|
33227
|
-
tone: settings.binary.trim() ? "bad" : "muted"
|
|
33228
|
-
}
|
|
33229
|
-
];
|
|
33230
|
-
const hint2 = setupHint(name, status);
|
|
33231
|
-
if (hint2) rows2.push({ label: "Setup", value: hint2, tone: "muted" });
|
|
33232
|
-
return rows2;
|
|
33233
|
-
}
|
|
33234
|
-
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
33235
|
-
const version = checks.find((check) => check.step === "version");
|
|
33236
|
-
if (version?.ok) rows.push({ label: "Version", value: version.detail, tone: "ok" });
|
|
33237
|
-
rows.push({ label: "Model", value: modelLine(name, settings.model), tone: "muted" });
|
|
33238
|
-
const hint = setupHint(name, status);
|
|
33239
|
-
if (hint) rows.push({ label: "Setup", value: hint, tone: "muted" });
|
|
33240
|
-
return rows;
|
|
33241
|
-
}
|
|
33242
|
-
function statusRows(_name, checks, savedBinary) {
|
|
33243
|
-
if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
|
|
33244
|
-
const find = (step) => checks.find((check) => check.step === step);
|
|
33245
|
-
const path5 = find("path");
|
|
33246
|
-
if (!path5?.ok) {
|
|
33247
|
-
if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
|
|
33248
|
-
return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
|
|
33249
|
-
}
|
|
33250
|
-
const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
|
|
33251
|
-
const version = find("version");
|
|
33252
|
-
if (version) {
|
|
33253
|
-
rows.push({
|
|
33254
|
-
label: "Version",
|
|
33255
|
-
value: version.ok ? version.detail : "could not be read",
|
|
33256
|
-
tone: version.ok ? "ok" : "muted"
|
|
33257
|
-
});
|
|
33258
|
-
}
|
|
33259
|
-
const login = find("login");
|
|
33260
|
-
const prompt = find("prompt");
|
|
33261
|
-
if (login) {
|
|
33262
|
-
rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
|
|
33263
|
-
} else if (prompt) {
|
|
33264
|
-
rows.push({
|
|
33265
|
-
label: "Login",
|
|
33266
|
-
value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
|
|
33267
|
-
tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
|
|
33268
|
-
});
|
|
33269
|
-
} else {
|
|
33270
|
-
rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
|
|
33271
|
-
}
|
|
33272
|
-
if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
|
|
33273
|
-
return rows;
|
|
33274
|
-
}
|
|
33275
|
-
async function withBinaryEnv(name, binary, run) {
|
|
33276
|
-
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33277
|
-
const previous = process.env[key];
|
|
33278
|
-
process.env[key] = binary;
|
|
33279
|
-
try {
|
|
33280
|
-
return await run();
|
|
33281
|
-
} finally {
|
|
33282
|
-
if (previous === void 0) delete process.env[key];
|
|
33283
|
-
else process.env[key] = previous;
|
|
33284
|
-
}
|
|
33285
|
-
}
|
|
33286
|
-
var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail3, pass, LIST_STATUS;
|
|
33287
|
-
var init_agent_status = __esm({
|
|
33288
|
-
"packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts"() {
|
|
33289
|
-
"use strict";
|
|
33290
|
-
init_src4();
|
|
33291
|
-
VERSION_TIMEOUT_MS = 5e3;
|
|
33292
|
-
PROMPT_TIMEOUT_MS = 6e4;
|
|
33293
|
-
TEST_PROMPT = "Reply with the single word: ok";
|
|
33294
|
-
INSTALL_HINTS = {
|
|
33295
|
-
claude: "npm install -g @anthropic-ai/claude-code",
|
|
33296
|
-
codex: "npm install -g @openai/codex",
|
|
33297
|
-
opencode: "npm install -g opencode-ai",
|
|
33298
|
-
cursor: "install Cursor\u2019s `cursor-agent` command",
|
|
33299
|
-
copilot: "npm install -g @github/copilot"
|
|
33300
|
-
};
|
|
33301
|
-
LOGIN_HINTS = {
|
|
33302
|
-
claude: "run `claude login`",
|
|
33303
|
-
codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
|
|
33304
|
-
opencode: "run `opencode auth`",
|
|
33305
|
-
cursor: "sign in from Cursor",
|
|
33306
|
-
copilot: "run `copilot` and sign in"
|
|
33307
|
-
};
|
|
33308
|
-
fail3 = (step, detail) => ({ step, ok: false, detail });
|
|
33309
|
-
pass = (step, detail) => ({ step, ok: true, detail });
|
|
33310
|
-
LIST_STATUS = {
|
|
33311
|
-
checking: { symbol: "\u2026", text: "checking", tone: "muted" },
|
|
33312
|
-
ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
|
|
33313
|
-
"not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
|
|
33314
|
-
"not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
|
|
33315
|
-
"not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
|
|
33316
|
-
"test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
|
|
33317
|
-
"timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
|
|
33318
|
-
unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
|
|
33319
|
-
};
|
|
33320
|
-
}
|
|
33321
|
-
});
|
|
33322
|
-
|
|
33323
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
|
|
33324
|
-
import { Text as Text46 } from "ink";
|
|
33325
|
-
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
33326
|
-
function AgentStatusBadge({
|
|
33327
|
-
name,
|
|
33328
|
-
checks,
|
|
33329
|
-
binary
|
|
33330
|
-
}) {
|
|
33331
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
33332
|
-
return /* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
33333
|
-
}
|
|
33334
|
-
var TONE_COLOR;
|
|
33335
|
-
var init_AgentStatusBadge = __esm({
|
|
33336
|
-
"packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx"() {
|
|
33337
|
-
"use strict";
|
|
33338
|
-
init_home_theme();
|
|
33339
|
-
init_agent_status();
|
|
33340
|
-
TONE_COLOR = {
|
|
33341
|
-
ok: PALETTE.success,
|
|
33342
|
-
bad: PALETTE.error,
|
|
33343
|
-
muted: PALETTE.muted
|
|
33344
|
-
};
|
|
33345
|
-
}
|
|
33346
|
-
});
|
|
33347
|
-
|
|
33348
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
|
|
33349
|
-
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
33350
|
-
import { Box as Box44, Text as Text47, useInput as useInput11 } from "ink";
|
|
33351
|
-
import TextInput4 from "ink-text-input";
|
|
33352
|
-
import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33353
|
-
function Row2({
|
|
33354
|
-
pointer,
|
|
33355
|
-
label,
|
|
33356
|
-
labelProps,
|
|
33357
|
-
children
|
|
33358
|
-
}) {
|
|
33359
|
-
return /* @__PURE__ */ jsxs45(Box44, { children: [
|
|
33360
|
-
/* @__PURE__ */ jsx56(Box44, { width: POINTER_WIDTH, flexShrink: 0, children: pointer }),
|
|
33361
|
-
/* @__PURE__ */ jsx56(Box44, { width: LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, ...labelProps, children: label }) }),
|
|
33362
|
-
children
|
|
33363
|
-
] });
|
|
33364
|
-
}
|
|
33365
|
-
function Section2({
|
|
33366
|
-
title,
|
|
33367
|
-
note,
|
|
33368
|
-
interactive = false,
|
|
33369
|
-
children
|
|
33370
|
-
}) {
|
|
33371
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
|
|
33372
|
-
/* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33373
|
-
/* @__PURE__ */ jsx56(Text47, { bold: true, color: interactive ? PALETTE.accent : PALETTE.muted, children: title }),
|
|
33374
|
-
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: `\xB7 ${note}` })
|
|
33375
|
-
] }),
|
|
33376
|
-
children
|
|
33377
|
-
] });
|
|
33378
|
-
}
|
|
33379
|
-
function AgentDetail({
|
|
33380
|
-
name,
|
|
33381
|
-
config,
|
|
33382
|
-
setConfig,
|
|
33383
|
-
onBack
|
|
33384
|
-
}) {
|
|
33385
|
-
const settings = config.agents[name];
|
|
33386
|
-
const [focusIndex, setFocusIndex] = useState29(0);
|
|
33387
|
-
const [editing, setEditing] = useState29(false);
|
|
33388
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33389
|
-
const [saving, setSaving] = useState29(false);
|
|
33390
|
-
const [testing, setTesting] = useState29(false);
|
|
33391
|
-
const [notice, setNotice] = useState29(null);
|
|
33392
|
-
const [checks, setChecks] = useState29(void 0);
|
|
33393
|
-
useEffect22(() => {
|
|
33394
|
-
let active = true;
|
|
33395
|
-
setChecks(void 0);
|
|
33396
|
-
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33397
|
-
return () => {
|
|
33398
|
-
active = false;
|
|
33399
|
-
};
|
|
33400
|
-
}, [name, settings.binary]);
|
|
33401
|
-
const setField = (field, value) => {
|
|
33402
|
-
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
|
|
33403
|
-
setNotice(null);
|
|
33404
|
-
};
|
|
33405
|
-
const save = () => {
|
|
33406
|
-
setSaving(true);
|
|
33407
|
-
setNotice(null);
|
|
33408
|
-
writeAgentConfig(config).then(() => {
|
|
33409
|
-
applyBinaryOverrides(config);
|
|
33410
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
33411
|
-
}).catch(
|
|
33412
|
-
(err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
|
|
33413
|
-
).finally(() => setSaving(false));
|
|
33414
|
-
};
|
|
33415
|
-
const runTest = () => {
|
|
33416
|
-
setTesting(true);
|
|
33417
|
-
setNotice(null);
|
|
33418
|
-
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
33419
|
-
setChecks(result);
|
|
33420
|
-
const outcome = testOutcome(result);
|
|
33421
|
-
setNotice(
|
|
33422
|
-
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
33423
|
-
);
|
|
33424
|
-
}).catch(
|
|
33425
|
-
(err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
|
|
33426
|
-
).finally(() => setTesting(false));
|
|
33427
|
-
};
|
|
33428
|
-
const focused = FOCUS_ORDER[focusIndex];
|
|
33429
|
-
const focusedField = focused === "test" ? null : focused;
|
|
33430
|
-
useInput11((input, key) => {
|
|
33431
|
-
if (saving || testing) return;
|
|
33432
|
-
if (editing) {
|
|
33433
|
-
if (key.escape && focusedField) {
|
|
33434
|
-
setField(focusedField, valueBeforeEdit);
|
|
33435
|
-
setEditing(false);
|
|
33436
|
-
}
|
|
33437
|
-
return;
|
|
33438
|
-
}
|
|
33439
|
-
if (key.escape || input === "q") {
|
|
33440
|
-
onBack();
|
|
33441
|
-
return;
|
|
33442
|
-
}
|
|
33443
|
-
if (input === "s") {
|
|
33444
|
-
save();
|
|
33445
|
-
return;
|
|
33446
|
-
}
|
|
33447
|
-
if (key.upArrow) {
|
|
33448
|
-
setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
|
|
33449
|
-
return;
|
|
33450
|
-
}
|
|
33451
|
-
if (key.downArrow || key.tab) {
|
|
33452
|
-
setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
|
|
33453
|
-
return;
|
|
33454
|
-
}
|
|
33455
|
-
if (input === "c" && focusedField) {
|
|
33456
|
-
setField(focusedField, "");
|
|
33457
|
-
return;
|
|
33458
|
-
}
|
|
33459
|
-
if (key.return) {
|
|
33460
|
-
if (focusedField) {
|
|
33461
|
-
setValueBeforeEdit(settings[focusedField]);
|
|
33462
|
-
setEditing(true);
|
|
33463
|
-
} else {
|
|
33464
|
-
runTest();
|
|
33465
|
-
}
|
|
33466
|
-
}
|
|
33467
|
-
});
|
|
33468
|
-
const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
|
|
33469
|
-
const hint = setupHint(name, status);
|
|
33470
|
-
const pointer = (isFocused) => /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
|
|
33471
|
-
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33472
|
-
/* @__PURE__ */ jsx56(Text47, { bold: true, children: AGENT_LABELS[name] }),
|
|
33473
|
-
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
|
|
33474
|
-
(notice || testing || saving) && /* @__PURE__ */ jsx56(Box44, { marginTop: 1, children: testing || saving ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: testing ? "\u2026 Running the test (up to 60s)" : "\u2026 Saving" }) : notice && /* @__PURE__ */ jsxs45(Text47, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33475
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33476
|
-
" ",
|
|
33477
|
-
notice.text
|
|
33478
|
-
] }) }),
|
|
33479
|
-
/* @__PURE__ */ jsxs45(Section2, { title: "CONFIGURE", note: "you can change these", interactive: true, children: [
|
|
33480
|
-
FIELDS2.map((field) => {
|
|
33481
|
-
const isFocused = focused === field;
|
|
33482
|
-
const value = settings[field];
|
|
33483
|
-
const display = isFocused && editing ? /* @__PURE__ */ jsx56(TextInput4, { value, onChange: (next) => setField(field, next), onSubmit: () => setEditing(false) }) : value ? /* @__PURE__ */ jsx56(Text47, { bold: true, children: value }) : /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: fieldHint(name, field) });
|
|
33484
|
-
return /* @__PURE__ */ jsx56(
|
|
33485
|
-
Row2,
|
|
33486
|
-
{
|
|
33487
|
-
pointer: pointer(isFocused),
|
|
33488
|
-
label: FIELD_LABEL[field],
|
|
33489
|
-
labelProps: { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted },
|
|
33490
|
-
children: display
|
|
33491
|
-
},
|
|
33492
|
-
field
|
|
33493
|
-
);
|
|
33494
|
-
}),
|
|
33495
|
-
/* @__PURE__ */ jsx56(
|
|
33496
|
-
Row2,
|
|
33497
|
-
{
|
|
33498
|
-
pointer: pointer(focused === "test"),
|
|
33499
|
-
label: "Run test",
|
|
33500
|
-
labelProps: { bold: focused === "test", color: focused === "test" ? PALETTE.accent : PALETTE.muted },
|
|
33501
|
-
children: /* @__PURE__ */ jsx56(Text47, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
|
|
33502
|
-
}
|
|
33503
|
-
)
|
|
33504
|
-
] }),
|
|
33505
|
-
/* @__PURE__ */ jsxs45(Section2, { title: "STATUS", note: "read only", children: [
|
|
33506
|
-
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx56(Row2, { pointer: null, label: row.label, children: /* @__PURE__ */ jsx56(Text47, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label)),
|
|
33507
|
-
hint && /* @__PURE__ */ jsx56(Row2, { pointer: null, label: "Setup", children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: hint }) })
|
|
33508
|
-
] }),
|
|
33509
|
-
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33510
|
-
/* @__PURE__ */ jsx56(
|
|
33511
|
-
ControlHints,
|
|
33512
|
-
{
|
|
33513
|
-
hints: editing ? [
|
|
33514
|
-
{ keys: "type", label: "edit" },
|
|
33515
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33516
|
-
{ keys: "\u23CE", label: "done" },
|
|
33517
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33518
|
-
] : [
|
|
33519
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
33520
|
-
{ keys: "\u23CE", label: focusedField ? "edit" : "run test" },
|
|
33521
|
-
...focusedField ? [{ keys: "c", label: "clear" }] : [],
|
|
33522
|
-
{ keys: "s", label: "save" },
|
|
33523
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
33524
|
-
]
|
|
33525
|
-
}
|
|
33526
|
-
)
|
|
33527
|
-
] });
|
|
33528
|
-
}
|
|
33529
|
-
var FOCUS_ORDER, FIELDS2, FIELD_LABEL, LABEL_WIDTH, LABEL_GAP, POINTER_WIDTH, fieldHint;
|
|
33530
|
-
var init_AgentDetail = __esm({
|
|
33531
|
-
"packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx"() {
|
|
33532
|
-
"use strict";
|
|
33533
|
-
init_home_theme();
|
|
33534
|
-
init_control_hints();
|
|
33535
|
-
init_agent_store();
|
|
33536
|
-
init_agent_status();
|
|
33537
|
-
init_AgentStatusBadge();
|
|
33538
|
-
init_apply_binary_overrides();
|
|
33539
|
-
FOCUS_ORDER = ["binary", "model", "test"];
|
|
33540
|
-
FIELDS2 = ["binary", "model"];
|
|
33541
|
-
FIELD_LABEL = { binary: "Command path", model: "Model" };
|
|
33542
|
-
LABEL_WIDTH = "Command path".length;
|
|
33543
|
-
LABEL_GAP = 2;
|
|
33544
|
-
POINTER_WIDTH = 2;
|
|
33545
|
-
fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
|
|
33546
|
-
}
|
|
33547
|
-
});
|
|
33548
|
-
|
|
33549
|
-
// packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
|
|
33550
|
-
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
33551
|
-
import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
|
|
33552
|
-
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33553
|
-
function AgentsScreen({ onDone }) {
|
|
33554
|
-
const [config, setConfig] = useState30(null);
|
|
33555
|
-
const [focus, setFocus] = useState30(0);
|
|
33556
|
-
const [open, setOpen] = useState30(null);
|
|
33557
|
-
const [notice, setNotice] = useState30(null);
|
|
33558
|
-
const [saving, setSaving] = useState30(false);
|
|
33559
|
-
const [checks, setChecks] = useState30({});
|
|
33560
|
-
const inspectAll = (loaded) => {
|
|
33561
|
-
for (const name of AGENT_NAMES) {
|
|
33562
|
-
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
33563
|
-
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
33564
|
-
);
|
|
33565
|
-
}
|
|
33566
|
-
};
|
|
33567
|
-
useEffect23(() => {
|
|
33568
|
-
void readAgentConfig().then((loaded) => {
|
|
33569
|
-
setConfig(loaded);
|
|
33570
|
-
inspectAll(loaded);
|
|
33571
|
-
startDebugRun({
|
|
33572
|
-
flow: "settings/agents",
|
|
33573
|
-
step: "01-agents",
|
|
33574
|
-
menuOption: "Configuration > Agents",
|
|
33575
|
-
inputs: { default_agent: loaded.defaultAgent }
|
|
33576
|
-
});
|
|
33577
|
-
});
|
|
33578
|
-
}, []);
|
|
33579
|
-
const makeDefault = (name) => {
|
|
33580
|
-
if (!config || saving) return;
|
|
33581
|
-
if (name === config.defaultAgent) {
|
|
33582
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
33583
|
-
return;
|
|
33584
|
-
}
|
|
33585
|
-
setSaving(true);
|
|
33586
|
-
setNotice(null);
|
|
33587
|
-
writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
|
|
33588
|
-
setConfig((current) => current ? { ...current, defaultAgent: name } : current);
|
|
33589
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
33590
|
-
}).catch(
|
|
33591
|
-
(err) => setNotice({
|
|
33592
|
-
kind: "error",
|
|
33593
|
-
text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
|
|
33594
|
-
})
|
|
33595
|
-
).finally(() => setSaving(false));
|
|
33596
|
-
};
|
|
33597
|
-
useInput12((input, key) => {
|
|
33598
|
-
if (!config || open || saving) return;
|
|
33599
|
-
const focused = AGENT_NAMES[focus];
|
|
33600
|
-
if (key.upArrow || key.downArrow || key.tab) setNotice(null);
|
|
33601
|
-
if (key.upArrow) {
|
|
33602
|
-
setFocus((i) => (i - 1 + AGENT_NAMES.length) % AGENT_NAMES.length);
|
|
33603
|
-
return;
|
|
33604
|
-
}
|
|
33605
|
-
if (key.downArrow || key.tab) {
|
|
33606
|
-
setFocus((i) => (i + 1) % AGENT_NAMES.length);
|
|
33607
|
-
return;
|
|
33608
|
-
}
|
|
33609
|
-
if (key.return) {
|
|
33610
|
-
makeDefault(focused);
|
|
33611
|
-
return;
|
|
33612
|
-
}
|
|
33613
|
-
if (key.rightArrow) {
|
|
33614
|
-
setNotice(null);
|
|
33615
|
-
setOpen(focused);
|
|
33616
|
-
return;
|
|
33617
|
-
}
|
|
33618
|
-
if (key.escape || input === "q") {
|
|
33619
|
-
void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
|
|
33620
|
-
onDone();
|
|
33621
|
-
}
|
|
33622
|
-
});
|
|
33623
|
-
if (!config) {
|
|
33624
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33625
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33626
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33627
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
|
|
33628
|
-
] });
|
|
33629
|
-
}
|
|
33630
|
-
if (open) {
|
|
33631
|
-
return /* @__PURE__ */ jsx57(
|
|
33632
|
-
AgentDetail,
|
|
33633
|
-
{
|
|
33634
|
-
name: open,
|
|
33635
|
-
config,
|
|
33636
|
-
setConfig,
|
|
33637
|
-
onBack: () => {
|
|
33638
|
-
setOpen(null);
|
|
33639
|
-
void readAgentConfig().then((saved) => {
|
|
33640
|
-
setConfig(saved);
|
|
33641
|
-
inspectAll(saved);
|
|
33642
|
-
});
|
|
33643
|
-
}
|
|
33644
|
-
}
|
|
33645
|
-
);
|
|
33646
|
-
}
|
|
33647
|
-
const focusedAgent = AGENT_NAMES[focus];
|
|
33648
|
-
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33649
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
|
|
33650
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
|
|
33651
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33652
|
-
/* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33653
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Default agent" }),
|
|
33654
|
-
/* @__PURE__ */ jsx57(Text48, { bold: true, children: AGENT_LABELS[config.defaultAgent] }),
|
|
33655
|
-
saving && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "\u2026 saving" })
|
|
33656
|
-
] }),
|
|
33657
|
-
/* @__PURE__ */ jsxs46(Box45, { marginTop: 1, gap: 1, children: [
|
|
33658
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33659
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33660
|
-
/* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
33661
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "STATUS" })
|
|
33662
|
-
] }),
|
|
33663
|
-
AGENT_NAMES.map((name) => {
|
|
33664
|
-
const isFocused = focusedAgent === name;
|
|
33665
|
-
return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
|
|
33666
|
-
/* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
33667
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
33668
|
-
/* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
33669
|
-
/* @__PURE__ */ jsx57(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
33670
|
-
] }, name);
|
|
33671
|
-
}),
|
|
33672
|
-
/* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
|
|
33673
|
-
/* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|
|
33674
|
-
panelRows(focusedAgent, checks[focusedAgent], config.agents[focusedAgent]).map((row) => /* @__PURE__ */ jsxs46(Box45, { gap: 1, paddingLeft: 1, children: [
|
|
33675
|
-
/* @__PURE__ */ jsx57(Box45, { width: PANEL_LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: row.label }) }),
|
|
33676
|
-
/* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value })
|
|
33677
|
-
] }, row.label))
|
|
33678
|
-
] }),
|
|
33679
|
-
notice && /* @__PURE__ */ jsxs46(Fragment17, { children: [
|
|
33680
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33681
|
-
/* @__PURE__ */ jsxs46(Text48, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33682
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33683
|
-
" ",
|
|
33684
|
-
notice.text
|
|
33685
|
-
] })
|
|
33686
|
-
] }),
|
|
33687
|
-
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33688
|
-
/* @__PURE__ */ jsx57(
|
|
33689
|
-
ControlHints,
|
|
33690
|
-
{
|
|
33691
|
-
hints: [
|
|
33692
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
33693
|
-
{ keys: "\u23CE", label: "make default" },
|
|
33694
|
-
{ keys: "\u2192", label: "settings and test" },
|
|
33695
|
-
{ keys: "Esc/q", label: "back" }
|
|
33696
|
-
]
|
|
33697
|
-
}
|
|
33698
|
-
)
|
|
33699
|
-
] });
|
|
33700
|
-
}
|
|
33701
|
-
var NAME_WIDTH, PANEL_LABEL_WIDTH;
|
|
33702
|
-
var init_AgentScreens = __esm({
|
|
33703
|
-
"packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx"() {
|
|
33704
|
-
"use strict";
|
|
33705
|
-
init_src4();
|
|
33706
|
-
init_home_theme();
|
|
33707
|
-
init_control_hints();
|
|
33708
|
-
init_debug_store();
|
|
33709
|
-
init_agent_store();
|
|
33710
|
-
init_agent_status();
|
|
33711
|
-
init_AgentDetail();
|
|
33712
|
-
init_AgentStatusBadge();
|
|
33713
|
-
NAME_WIDTH = 16;
|
|
33714
|
-
PANEL_LABEL_WIDTH = "Command".length;
|
|
33715
|
-
}
|
|
33716
|
-
});
|
|
33717
|
-
|
|
33718
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
|
|
33719
|
-
import { useState as useState31 } from "react";
|
|
33720
|
-
import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
|
|
33721
|
-
import TextInput5 from "ink-text-input";
|
|
33722
|
-
import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
33723
|
-
function FieldForm({
|
|
33724
|
-
title,
|
|
33725
|
-
subtitle,
|
|
33726
|
-
fields,
|
|
33727
|
-
values,
|
|
33728
|
-
onChange,
|
|
33729
|
-
onSave,
|
|
33730
|
-
onQuit,
|
|
33731
|
-
notice,
|
|
33732
|
-
busy = false,
|
|
33733
|
-
footer
|
|
33734
|
-
}) {
|
|
33735
|
-
const [active, setActive] = useState31(0);
|
|
33736
|
-
const [editing, setEditing] = useState31(false);
|
|
33737
|
-
const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
|
|
33738
|
-
const labelWidth = Math.max(...fields.map((field) => field.label.length));
|
|
33739
|
-
const current = fields[active];
|
|
33740
|
-
useInput13((input, key) => {
|
|
33741
|
-
if (busy) return;
|
|
33742
|
-
if (editing) {
|
|
33743
|
-
if (key.escape) {
|
|
33744
|
-
onChange(current.key, valueBeforeEdit);
|
|
33745
|
-
setEditing(false);
|
|
33746
|
-
}
|
|
33747
|
-
return;
|
|
33748
|
-
}
|
|
33749
|
-
if (key.escape || input === "q") {
|
|
33750
|
-
onQuit();
|
|
33751
|
-
return;
|
|
33752
|
-
}
|
|
33753
|
-
if (input === "s") {
|
|
33754
|
-
onSave();
|
|
33755
|
-
return;
|
|
33756
|
-
}
|
|
33757
|
-
if (input === "c") {
|
|
33758
|
-
onChange(current.key, "");
|
|
33759
|
-
return;
|
|
33760
|
-
}
|
|
33761
|
-
if (key.tab || key.downArrow) {
|
|
33762
|
-
setActive((i) => (i + 1) % fields.length);
|
|
33763
|
-
return;
|
|
33764
|
-
}
|
|
33765
|
-
if (key.upArrow) {
|
|
33766
|
-
setActive((i) => (i - 1 + fields.length) % fields.length);
|
|
33767
|
-
return;
|
|
33768
|
-
}
|
|
33769
|
-
if (key.return) {
|
|
33770
|
-
setValueBeforeEdit(values[current.key]);
|
|
33771
|
-
setEditing(true);
|
|
33772
|
-
}
|
|
33773
|
-
});
|
|
33774
|
-
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33775
|
-
/* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
|
|
33776
|
-
subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
|
|
33777
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33778
|
-
/* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
|
|
33779
|
-
const isActive = index === active;
|
|
33780
|
-
const value = values[field.key];
|
|
33781
|
-
const display = field.masked ? "\u2022".repeat(value.length) : value;
|
|
33782
|
-
return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
|
|
33783
|
-
/* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33784
|
-
/* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
|
|
33785
|
-
isActive && editing ? /* @__PURE__ */ jsx58(
|
|
33786
|
-
TextInput5,
|
|
33787
|
-
{
|
|
33788
|
-
value,
|
|
33789
|
-
onChange: (next) => onChange(field.key, next),
|
|
33790
|
-
onSubmit: () => setEditing(false),
|
|
33791
|
-
mask: field.masked ? "\u2022" : void 0
|
|
33792
|
-
}
|
|
33793
|
-
) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33794
|
-
field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
|
|
33795
|
-
] }, field.key);
|
|
33796
|
-
}) }),
|
|
33797
|
-
notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
|
|
33798
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33799
|
-
/* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33800
|
-
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33801
|
-
" ",
|
|
33802
|
-
notice.text
|
|
33803
|
-
] })
|
|
33804
|
-
] }),
|
|
33805
|
-
footer,
|
|
33806
|
-
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33807
|
-
/* @__PURE__ */ jsx58(
|
|
33808
|
-
ControlHints,
|
|
33809
|
-
{
|
|
33810
|
-
hints: editing ? [
|
|
33811
|
-
{ keys: "type", label: "edit" },
|
|
33812
|
-
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33813
|
-
{ keys: "\u23CE", label: "done" },
|
|
33814
|
-
{ keys: "Esc", label: "cancel edit" }
|
|
33815
|
-
] : [
|
|
33816
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
33817
|
-
{ keys: "\u23CE", label: "edit" },
|
|
33818
|
-
{ keys: "c", label: "clear" },
|
|
33819
|
-
{ keys: "s", label: "save" },
|
|
33820
|
-
{ keys: "Esc/q", label: "back without saving" }
|
|
33821
|
-
]
|
|
33822
|
-
}
|
|
33823
|
-
)
|
|
33824
|
-
] });
|
|
33825
|
-
}
|
|
33826
|
-
var init_FieldForm = __esm({
|
|
33827
|
-
"packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
|
|
33828
|
-
"use strict";
|
|
33829
|
-
init_home_theme();
|
|
33830
|
-
init_control_hints();
|
|
33831
|
-
}
|
|
33832
|
-
});
|
|
33833
|
-
|
|
33834
32982
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
33835
32983
|
async function readCredentials() {
|
|
33836
32984
|
const store = await readV1Store();
|
|
@@ -33862,10 +33010,11 @@ var init_config_store = __esm({
|
|
|
33862
33010
|
}
|
|
33863
33011
|
});
|
|
33864
33012
|
|
|
33865
|
-
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/
|
|
33866
|
-
import { useEffect as
|
|
33867
|
-
import { Box as
|
|
33868
|
-
import
|
|
33013
|
+
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
|
|
33014
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
33015
|
+
import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
|
|
33016
|
+
import TextInput4 from "ink-text-input";
|
|
33017
|
+
import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
33869
33018
|
function debugFields(config) {
|
|
33870
33019
|
return {
|
|
33871
33020
|
space_id: config?.spaceId ?? "",
|
|
@@ -33877,159 +33026,189 @@ function debugFields(config) {
|
|
|
33877
33026
|
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
33878
33027
|
};
|
|
33879
33028
|
}
|
|
33880
|
-
function
|
|
33881
|
-
const [
|
|
33882
|
-
const [
|
|
33883
|
-
const [
|
|
33884
|
-
const [
|
|
33885
|
-
|
|
33886
|
-
|
|
33029
|
+
function ConfigurationScreen({ onDone }) {
|
|
33030
|
+
const [stage, setStage] = useState29("loading");
|
|
33031
|
+
const [config, setConfig] = useState29(null);
|
|
33032
|
+
const [activeField, setActiveField] = useState29("spaceId");
|
|
33033
|
+
const [notice, setNotice] = useState29(null);
|
|
33034
|
+
const [lastSaved, setLastSaved] = useState29(null);
|
|
33035
|
+
const [editing, setEditing] = useState29(false);
|
|
33036
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
|
|
33037
|
+
useEffect22(() => {
|
|
33038
|
+
readCredentials().then((cfg) => {
|
|
33887
33039
|
setConfig(cfg);
|
|
33040
|
+
setStage("form");
|
|
33888
33041
|
startDebugRun({
|
|
33889
33042
|
flow: "settings/contentful-configuration",
|
|
33890
33043
|
step: "01-configuration",
|
|
33891
|
-
menuOption: "Configuration
|
|
33044
|
+
menuOption: "Configuration",
|
|
33892
33045
|
inputs: debugFields(cfg)
|
|
33893
33046
|
});
|
|
33894
33047
|
});
|
|
33895
33048
|
}, []);
|
|
33896
|
-
|
|
33897
|
-
|
|
33898
|
-
|
|
33899
|
-
/* @__PURE__ */ jsx59(Text50, { children: " " }),
|
|
33900
|
-
/* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
|
|
33901
|
-
] });
|
|
33049
|
+
function fieldValue(field) {
|
|
33050
|
+
if (!config) return "";
|
|
33051
|
+
return config[field] || "";
|
|
33902
33052
|
}
|
|
33903
|
-
|
|
33904
|
-
|
|
33053
|
+
function setFieldValue(field, value) {
|
|
33054
|
+
if (!config) return;
|
|
33055
|
+
setConfig({ ...config, [field]: value });
|
|
33056
|
+
setNotice(null);
|
|
33057
|
+
}
|
|
33058
|
+
function handleSave() {
|
|
33059
|
+
if (!config) return;
|
|
33060
|
+
setStage("saving");
|
|
33905
33061
|
setNotice(null);
|
|
33906
33062
|
writeCredentials(config).then(() => {
|
|
33907
33063
|
setLastSaved(config);
|
|
33908
33064
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
33909
|
-
setNotice({ kind: "success", text: "
|
|
33065
|
+
setNotice({ kind: "success", text: "Configuration saved" });
|
|
33066
|
+
setStage("form");
|
|
33910
33067
|
}).catch((err) => {
|
|
33911
33068
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
33912
|
-
|
|
33913
|
-
|
|
33914
|
-
|
|
33069
|
+
setStage("form");
|
|
33070
|
+
});
|
|
33071
|
+
}
|
|
33072
|
+
function quit() {
|
|
33915
33073
|
void finishDebugRun(
|
|
33916
33074
|
lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
|
|
33917
33075
|
);
|
|
33918
33076
|
onDone();
|
|
33919
|
-
};
|
|
33920
|
-
return /* @__PURE__ */ jsx59(
|
|
33921
|
-
FieldForm,
|
|
33922
|
-
{
|
|
33923
|
-
title: "Project",
|
|
33924
|
-
subtitle: "The Contentful space and where the CLI keeps its files.",
|
|
33925
|
-
fields: FIELDS3,
|
|
33926
|
-
values: valuesOf(config),
|
|
33927
|
-
onChange: (key, value) => {
|
|
33928
|
-
setConfig({ ...config, [key]: value });
|
|
33929
|
-
setNotice(null);
|
|
33930
|
-
},
|
|
33931
|
-
onSave: save,
|
|
33932
|
-
onQuit: quit,
|
|
33933
|
-
notice,
|
|
33934
|
-
busy: saving
|
|
33935
|
-
}
|
|
33936
|
-
);
|
|
33937
|
-
}
|
|
33938
|
-
var FIELDS3, valuesOf;
|
|
33939
|
-
var init_ProjectConfigScreen = __esm({
|
|
33940
|
-
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx"() {
|
|
33941
|
-
"use strict";
|
|
33942
|
-
init_home_theme();
|
|
33943
|
-
init_debug_store();
|
|
33944
|
-
init_FieldForm();
|
|
33945
|
-
init_config_store();
|
|
33946
|
-
FIELDS3 = [
|
|
33947
|
-
{ key: "spaceId", label: "Space ID" },
|
|
33948
|
-
{ key: "environmentId", label: "Environment ID" },
|
|
33949
|
-
{ key: "cmaToken", label: "CMA Token", masked: true },
|
|
33950
|
-
{ key: "host", label: "API Host" },
|
|
33951
|
-
{ key: "defaultComponentDir", label: "Default component directory" },
|
|
33952
|
-
{ key: "defaultTokenFile", label: "Default token file" },
|
|
33953
|
-
{ key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
|
|
33954
|
-
];
|
|
33955
|
-
valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
33956
33077
|
}
|
|
33957
|
-
|
|
33958
|
-
|
|
33959
|
-
|
|
33960
|
-
|
|
33961
|
-
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
const [focus, setFocus] = useState33(0);
|
|
33965
|
-
const [open, setOpen] = useState33(null);
|
|
33966
|
-
const close = () => setOpen(null);
|
|
33967
|
-
useInput14((input, key) => {
|
|
33968
|
-
if (open) return;
|
|
33969
|
-
if (key.upArrow) {
|
|
33970
|
-
setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
|
|
33078
|
+
useInput11((input, key) => {
|
|
33079
|
+
if (stage === "loading" || stage === "saving") return;
|
|
33080
|
+
if (editing) {
|
|
33081
|
+
if (key.escape) {
|
|
33082
|
+
setFieldValue(activeField, valueBeforeEdit);
|
|
33083
|
+
setEditing(false);
|
|
33084
|
+
}
|
|
33971
33085
|
return;
|
|
33972
33086
|
}
|
|
33973
|
-
if (key.
|
|
33974
|
-
|
|
33087
|
+
if (key.escape || input === "q") {
|
|
33088
|
+
quit();
|
|
33975
33089
|
return;
|
|
33976
33090
|
}
|
|
33977
|
-
if (
|
|
33978
|
-
|
|
33091
|
+
if (input === "s") {
|
|
33092
|
+
handleSave();
|
|
33093
|
+
return;
|
|
33094
|
+
}
|
|
33095
|
+
if (input === "c") {
|
|
33096
|
+
setFieldValue(activeField, "");
|
|
33097
|
+
return;
|
|
33098
|
+
}
|
|
33099
|
+
if (key.tab || key.downArrow) {
|
|
33100
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
33101
|
+
setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
|
|
33979
33102
|
return;
|
|
33980
33103
|
}
|
|
33981
|
-
if (key.
|
|
33104
|
+
if (key.upArrow) {
|
|
33105
|
+
const idx = FIELD_ORDER.indexOf(activeField);
|
|
33106
|
+
setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
|
|
33107
|
+
return;
|
|
33108
|
+
}
|
|
33109
|
+
if (key.return) {
|
|
33110
|
+
setValueBeforeEdit(fieldValue(activeField));
|
|
33111
|
+
setEditing(true);
|
|
33112
|
+
}
|
|
33982
33113
|
});
|
|
33983
|
-
if (
|
|
33984
|
-
|
|
33985
|
-
|
|
33986
|
-
|
|
33987
|
-
|
|
33988
|
-
|
|
33989
|
-
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
|
|
33993
|
-
/* @__PURE__ */
|
|
33994
|
-
|
|
33114
|
+
if (stage === "loading") {
|
|
33115
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33116
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
33117
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33118
|
+
/* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
|
|
33119
|
+
] });
|
|
33120
|
+
}
|
|
33121
|
+
return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33122
|
+
/* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
|
|
33123
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33124
|
+
/* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
|
|
33125
|
+
const isActive = activeField === field;
|
|
33126
|
+
const value = fieldValue(field);
|
|
33127
|
+
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
33128
|
+
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
33129
|
+
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
33130
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
33131
|
+
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
33132
|
+
TextInput4,
|
|
33133
|
+
{
|
|
33134
|
+
value,
|
|
33135
|
+
onChange: (next) => setFieldValue(field, next),
|
|
33136
|
+
onSubmit: () => setEditing(false),
|
|
33137
|
+
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
33138
|
+
}
|
|
33139
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
33140
|
+
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
33141
|
+
] }, field);
|
|
33142
|
+
}) }),
|
|
33143
|
+
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
33144
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33145
|
+
/* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
|
|
33146
|
+
notice.kind === "success" ? "\u2713" : "\u2717",
|
|
33147
|
+
" ",
|
|
33148
|
+
notice.text
|
|
33149
|
+
] })
|
|
33150
|
+
] }),
|
|
33151
|
+
/* @__PURE__ */ jsx55(Text46, { children: " " }),
|
|
33152
|
+
/* @__PURE__ */ jsx55(
|
|
33995
33153
|
ControlHints,
|
|
33996
33154
|
{
|
|
33997
|
-
hints: [
|
|
33155
|
+
hints: editing ? [
|
|
33156
|
+
{ keys: "type", label: "edit" },
|
|
33157
|
+
{ keys: "\u2190/\u2192", label: "move cursor" },
|
|
33158
|
+
{ keys: "\u23CE", label: "done" },
|
|
33159
|
+
{ keys: "Esc", label: "cancel edit" }
|
|
33160
|
+
] : [
|
|
33998
33161
|
{ keys: "\u2191/\u2193", label: "move" },
|
|
33999
|
-
{ keys: "\u23CE", label: "
|
|
34000
|
-
{ keys: "
|
|
33162
|
+
{ keys: "\u23CE", label: "edit" },
|
|
33163
|
+
{ keys: "c", label: "clear" },
|
|
33164
|
+
{ keys: "s", label: "save" },
|
|
33165
|
+
{ keys: "Esc/q", label: "quit without saving" }
|
|
34001
33166
|
]
|
|
34002
33167
|
}
|
|
34003
33168
|
)
|
|
34004
33169
|
] });
|
|
34005
33170
|
}
|
|
34006
|
-
var
|
|
33171
|
+
var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
|
|
34007
33172
|
var init_ContentfulConfigScreen = __esm({
|
|
34008
33173
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
34009
33174
|
"use strict";
|
|
34010
33175
|
init_home_theme();
|
|
33176
|
+
init_config_store();
|
|
33177
|
+
init_debug_store();
|
|
34011
33178
|
init_control_hints();
|
|
34012
|
-
|
|
34013
|
-
|
|
34014
|
-
|
|
34015
|
-
|
|
34016
|
-
|
|
34017
|
-
|
|
34018
|
-
|
|
34019
|
-
|
|
34020
|
-
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
33179
|
+
FIELD_ORDER = [
|
|
33180
|
+
"spaceId",
|
|
33181
|
+
"environmentId",
|
|
33182
|
+
"cmaToken",
|
|
33183
|
+
"host",
|
|
33184
|
+
"defaultComponentDir",
|
|
33185
|
+
"defaultTokenFile",
|
|
33186
|
+
"contentfulBaseDir"
|
|
34021
33187
|
];
|
|
33188
|
+
FIELD_LABELS = {
|
|
33189
|
+
spaceId: "Space ID",
|
|
33190
|
+
environmentId: "Environment ID",
|
|
33191
|
+
cmaToken: "CMA Token",
|
|
33192
|
+
host: "API Host",
|
|
33193
|
+
defaultComponentDir: "Default component directory",
|
|
33194
|
+
defaultTokenFile: "Default token file",
|
|
33195
|
+
contentfulBaseDir: "Root Project Directory"
|
|
33196
|
+
};
|
|
33197
|
+
FIELD_HINTS = {
|
|
33198
|
+
contentfulBaseDir: "(where .contentful goes)"
|
|
33199
|
+
};
|
|
33200
|
+
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
34022
33201
|
}
|
|
34023
33202
|
});
|
|
34024
33203
|
|
|
34025
33204
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
34026
|
-
import { useEffect as
|
|
34027
|
-
import { Box as
|
|
34028
|
-
import { Fragment as
|
|
33205
|
+
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
33206
|
+
import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
|
|
33207
|
+
import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
34029
33208
|
function OptInAnalyticsScreen({ onDone }) {
|
|
34030
|
-
const [loading, setLoading] =
|
|
34031
|
-
const [enabled, setEnabled] =
|
|
34032
|
-
|
|
33209
|
+
const [loading, setLoading] = useState30(true);
|
|
33210
|
+
const [enabled, setEnabled] = useState30(true);
|
|
33211
|
+
useEffect23(() => {
|
|
34033
33212
|
readAnalyticsSetting().then((setting) => {
|
|
34034
33213
|
setEnabled(setting.enabled);
|
|
34035
33214
|
setLoading(false);
|
|
@@ -34041,7 +33220,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
34041
33220
|
});
|
|
34042
33221
|
});
|
|
34043
33222
|
}, []);
|
|
34044
|
-
|
|
33223
|
+
useInput12((input, key) => {
|
|
34045
33224
|
if (loading) return;
|
|
34046
33225
|
if (key.return || input === " ") {
|
|
34047
33226
|
setEnabled((current) => {
|
|
@@ -34056,21 +33235,21 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
34056
33235
|
onDone();
|
|
34057
33236
|
}
|
|
34058
33237
|
});
|
|
34059
|
-
return /* @__PURE__ */
|
|
34060
|
-
/* @__PURE__ */
|
|
34061
|
-
/* @__PURE__ */
|
|
34062
|
-
loading ? /* @__PURE__ */
|
|
34063
|
-
/* @__PURE__ */
|
|
33238
|
+
return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33239
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
|
|
33240
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33241
|
+
loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
33242
|
+
/* @__PURE__ */ jsxs46(Text47, { children: [
|
|
34064
33243
|
"Share anonymous usage data:",
|
|
34065
33244
|
" ",
|
|
34066
|
-
/* @__PURE__ */
|
|
33245
|
+
/* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
34067
33246
|
] }),
|
|
34068
|
-
/* @__PURE__ */
|
|
34069
|
-
/* @__PURE__ */
|
|
34070
|
-
/* @__PURE__ */
|
|
33247
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33248
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
33249
|
+
/* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
34071
33250
|
] }),
|
|
34072
|
-
/* @__PURE__ */
|
|
34073
|
-
/* @__PURE__ */
|
|
33251
|
+
/* @__PURE__ */ jsx56(Text47, { children: " " }),
|
|
33252
|
+
/* @__PURE__ */ jsx56(
|
|
34074
33253
|
ControlHints,
|
|
34075
33254
|
{
|
|
34076
33255
|
hints: [
|
|
@@ -34092,12 +33271,12 @@ var init_screen11 = __esm({
|
|
|
34092
33271
|
});
|
|
34093
33272
|
|
|
34094
33273
|
// packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
|
|
34095
|
-
import { useEffect as
|
|
34096
|
-
import { Box as
|
|
34097
|
-
import { jsx as
|
|
33274
|
+
import { useEffect as useEffect24, useState as useState31 } from "react";
|
|
33275
|
+
import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
|
|
33276
|
+
import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
34098
33277
|
function UpgradeScreen({ onDone }) {
|
|
34099
|
-
const [upgradeCheck, setUpgradeCheck] =
|
|
34100
|
-
|
|
33278
|
+
const [upgradeCheck, setUpgradeCheck] = useState31();
|
|
33279
|
+
useEffect24(() => {
|
|
34101
33280
|
startDebugRun({
|
|
34102
33281
|
flow: "upgrade",
|
|
34103
33282
|
step: "01-upgrade",
|
|
@@ -34106,7 +33285,7 @@ function UpgradeScreen({ onDone }) {
|
|
|
34106
33285
|
});
|
|
34107
33286
|
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
34108
33287
|
}, []);
|
|
34109
|
-
|
|
33288
|
+
useInput13((_input, key) => {
|
|
34110
33289
|
if (key.return) {
|
|
34111
33290
|
void finishDebugRun({
|
|
34112
33291
|
outputs: upgradeCheck ?? {},
|
|
@@ -34117,12 +33296,12 @@ function UpgradeScreen({ onDone }) {
|
|
|
34117
33296
|
return;
|
|
34118
33297
|
}
|
|
34119
33298
|
});
|
|
34120
|
-
return /* @__PURE__ */
|
|
34121
|
-
/* @__PURE__ */
|
|
34122
|
-
/* @__PURE__ */
|
|
33299
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33300
|
+
/* @__PURE__ */ jsx57(Text48, { bold: true, children: "Upgrade" }),
|
|
33301
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
34123
33302
|
renderBody(upgradeCheck),
|
|
34124
|
-
/* @__PURE__ */
|
|
34125
|
-
/* @__PURE__ */
|
|
33303
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33304
|
+
/* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.accent, children: [
|
|
34126
33305
|
FOCUS_MARKER,
|
|
34127
33306
|
" Go Back"
|
|
34128
33307
|
] })
|
|
@@ -34130,34 +33309,34 @@ function UpgradeScreen({ onDone }) {
|
|
|
34130
33309
|
}
|
|
34131
33310
|
function renderBody(upgradeCheck) {
|
|
34132
33311
|
if (!upgradeCheck) {
|
|
34133
|
-
return /* @__PURE__ */
|
|
33312
|
+
return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Checking for updates\u2026" });
|
|
34134
33313
|
}
|
|
34135
33314
|
if (upgradeCheck.status === "error") {
|
|
34136
|
-
return /* @__PURE__ */
|
|
33315
|
+
return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
|
|
34137
33316
|
}
|
|
34138
33317
|
if (upgradeCheck.status === "up-to-date") {
|
|
34139
|
-
return /* @__PURE__ */
|
|
33318
|
+
return /* @__PURE__ */ jsxs47(Text48, { color: PALETTE.success, children: [
|
|
34140
33319
|
"You're already on the latest version (v",
|
|
34141
33320
|
upgradeCheck.current,
|
|
34142
33321
|
")."
|
|
34143
33322
|
] });
|
|
34144
33323
|
}
|
|
34145
|
-
return /* @__PURE__ */
|
|
34146
|
-
/* @__PURE__ */
|
|
34147
|
-
/* @__PURE__ */
|
|
33324
|
+
return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", children: [
|
|
33325
|
+
/* @__PURE__ */ jsxs47(Text48, { color: PALETTE.muted, children: [
|
|
33326
|
+
/* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.success, children: [
|
|
34148
33327
|
"v",
|
|
34149
33328
|
upgradeCheck.latest
|
|
34150
33329
|
] }),
|
|
34151
33330
|
" ",
|
|
34152
33331
|
"is available (you're on ",
|
|
34153
|
-
/* @__PURE__ */
|
|
33332
|
+
/* @__PURE__ */ jsxs47(Text48, { bold: true, children: [
|
|
34154
33333
|
"v",
|
|
34155
33334
|
upgradeCheck.current
|
|
34156
33335
|
] }),
|
|
34157
33336
|
"). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
|
|
34158
33337
|
] }),
|
|
34159
|
-
/* @__PURE__ */
|
|
34160
|
-
/* @__PURE__ */
|
|
33338
|
+
/* @__PURE__ */ jsx57(Text48, { children: " " }),
|
|
33339
|
+
/* @__PURE__ */ jsx57(Box46, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx57(Text48, { bold: true, children: cmd }, cmd)) })
|
|
34161
33340
|
] });
|
|
34162
33341
|
}
|
|
34163
33342
|
var UPGRADE_COMMANDS;
|
|
@@ -34172,13 +33351,13 @@ var init_PageContainer4 = __esm({
|
|
|
34172
33351
|
});
|
|
34173
33352
|
|
|
34174
33353
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
34175
|
-
import { useEffect as
|
|
34176
|
-
import { Box as
|
|
34177
|
-
import { jsx as
|
|
33354
|
+
import { useEffect as useEffect25, useState as useState32 } from "react";
|
|
33355
|
+
import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
|
|
33356
|
+
import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
34178
33357
|
function DebugModeScreen({ onDone }) {
|
|
34179
|
-
const [loading, setLoading] =
|
|
34180
|
-
const [enabled, setEnabled] =
|
|
34181
|
-
|
|
33358
|
+
const [loading, setLoading] = useState32(true);
|
|
33359
|
+
const [enabled, setEnabled] = useState32(true);
|
|
33360
|
+
useEffect25(() => {
|
|
34182
33361
|
readDebugModeSetting().then((setting) => {
|
|
34183
33362
|
setEnabled(setting.enabled);
|
|
34184
33363
|
setLoading(false);
|
|
@@ -34190,7 +33369,7 @@ function DebugModeScreen({ onDone }) {
|
|
|
34190
33369
|
});
|
|
34191
33370
|
});
|
|
34192
33371
|
}, []);
|
|
34193
|
-
|
|
33372
|
+
useInput14((input, key) => {
|
|
34194
33373
|
if (loading) return;
|
|
34195
33374
|
if (key.return || input === " ") {
|
|
34196
33375
|
setEnabled((current) => {
|
|
@@ -34205,16 +33384,16 @@ function DebugModeScreen({ onDone }) {
|
|
|
34205
33384
|
onDone();
|
|
34206
33385
|
}
|
|
34207
33386
|
});
|
|
34208
|
-
return /* @__PURE__ */
|
|
34209
|
-
/* @__PURE__ */
|
|
34210
|
-
/* @__PURE__ */
|
|
34211
|
-
loading ? /* @__PURE__ */
|
|
33387
|
+
return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
33388
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, children: "Settings \u203A Debug Mode" }),
|
|
33389
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33390
|
+
loading ? /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs48(Text49, { children: [
|
|
34212
33391
|
"Debug logging:",
|
|
34213
33392
|
" ",
|
|
34214
|
-
/* @__PURE__ */
|
|
33393
|
+
/* @__PURE__ */ jsx58(Text49, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
34215
33394
|
] }),
|
|
34216
|
-
/* @__PURE__ */
|
|
34217
|
-
/* @__PURE__ */
|
|
33395
|
+
/* @__PURE__ */ jsx58(Text49, { children: " " }),
|
|
33396
|
+
/* @__PURE__ */ jsx58(
|
|
34218
33397
|
ControlHints,
|
|
34219
33398
|
{
|
|
34220
33399
|
hints: [
|
|
@@ -34240,20 +33419,20 @@ var app_exports = {};
|
|
|
34240
33419
|
__export(app_exports, {
|
|
34241
33420
|
runApp: () => runApp
|
|
34242
33421
|
});
|
|
34243
|
-
import { join as
|
|
34244
|
-
import { useEffect as
|
|
34245
|
-
import { Fragment as
|
|
33422
|
+
import { join as join26 } from "node:path";
|
|
33423
|
+
import { useEffect as useEffect26, useState as useState33 } from "react";
|
|
33424
|
+
import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
|
|
34246
33425
|
function App({ importOptions, inkClear }) {
|
|
34247
|
-
const [screen, setScreen] =
|
|
34248
|
-
const [importExitCode, setImportExitCode] =
|
|
33426
|
+
const [screen, setScreen] = useState33("start");
|
|
33427
|
+
const [importExitCode, setImportExitCode] = useState33();
|
|
34249
33428
|
const showImportResult = importExitCode !== void 0;
|
|
34250
|
-
const [projectPath, setProjectPath] =
|
|
34251
|
-
const [tokensPath, setTokensPath] =
|
|
34252
|
-
const [scannedFiles, setScannedFiles] =
|
|
34253
|
-
const [pendingLaunch, setPendingLaunch] =
|
|
34254
|
-
const [extractionRun, setExtractionRun] =
|
|
33429
|
+
const [projectPath, setProjectPath] = useState33();
|
|
33430
|
+
const [tokensPath, setTokensPath] = useState33();
|
|
33431
|
+
const [scannedFiles, setScannedFiles] = useState33();
|
|
33432
|
+
const [pendingLaunch, setPendingLaunch] = useState33();
|
|
33433
|
+
const [extractionRun, setExtractionRun] = useState33();
|
|
34255
33434
|
const extraction = useExtraction(extractionRun?.input);
|
|
34256
|
-
const [scopeRun, setScopeRun] =
|
|
33435
|
+
const [scopeRun, setScopeRun] = useState33();
|
|
34257
33436
|
const scopeFlow = useScopeGateFlow(
|
|
34258
33437
|
scopeRun && {
|
|
34259
33438
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -34268,12 +33447,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34268
33447
|
}
|
|
34269
33448
|
}
|
|
34270
33449
|
);
|
|
34271
|
-
const [generationInput, setGenerationInput] =
|
|
33450
|
+
const [generationInput, setGenerationInput] = useState33();
|
|
34272
33451
|
const generation = useGeneration(generationInput);
|
|
34273
|
-
const [flowStart, setFlowStart] =
|
|
33452
|
+
const [flowStart, setFlowStart] = useState33();
|
|
34274
33453
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34275
|
-
const [importDefaults, setImportDefaults] =
|
|
34276
|
-
|
|
33454
|
+
const [importDefaults, setImportDefaults] = useState33();
|
|
33455
|
+
useEffect26(() => {
|
|
34277
33456
|
if (screen !== "import") {
|
|
34278
33457
|
setImportDefaults(void 0);
|
|
34279
33458
|
return;
|
|
@@ -34291,7 +33470,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34291
33470
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
34292
33471
|
const state2 = await inspectTokens({
|
|
34293
33472
|
rawTokensPath: tokens,
|
|
34294
|
-
contentfulDir:
|
|
33473
|
+
contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
|
|
34295
33474
|
cache: importOptions.cache
|
|
34296
33475
|
});
|
|
34297
33476
|
if (state2.kind === "cached") {
|
|
@@ -34333,12 +33512,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34333
33512
|
}
|
|
34334
33513
|
});
|
|
34335
33514
|
};
|
|
34336
|
-
|
|
33515
|
+
useEffect26(() => {
|
|
34337
33516
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34338
33517
|
setExtractionRun(void 0);
|
|
34339
33518
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34340
33519
|
}, [extraction, extractionRun]);
|
|
34341
|
-
|
|
33520
|
+
useEffect26(() => {
|
|
34342
33521
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34343
33522
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34344
33523
|
setGenerationInput({
|
|
@@ -34356,7 +33535,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34356
33535
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34357
33536
|
});
|
|
34358
33537
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34359
|
-
|
|
33538
|
+
useEffect26(() => {
|
|
34360
33539
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34361
33540
|
const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34362
33541
|
inkClear();
|
|
@@ -34399,9 +33578,9 @@ function App({ importOptions, inkClear }) {
|
|
|
34399
33578
|
};
|
|
34400
33579
|
switch (screen) {
|
|
34401
33580
|
case "import":
|
|
34402
|
-
if (showImportResult) return /* @__PURE__ */
|
|
33581
|
+
if (showImportResult) return /* @__PURE__ */ jsx59(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
|
|
34403
33582
|
if (flow && flowStart) {
|
|
34404
|
-
return /* @__PURE__ */
|
|
33583
|
+
return /* @__PURE__ */ jsx59(
|
|
34405
33584
|
FlowScreen,
|
|
34406
33585
|
{
|
|
34407
33586
|
state: flow.state,
|
|
@@ -34411,12 +33590,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34411
33590
|
}
|
|
34412
33591
|
);
|
|
34413
33592
|
}
|
|
34414
|
-
if (importDefaults === void 0) return /* @__PURE__ */
|
|
33593
|
+
if (importDefaults === void 0) return /* @__PURE__ */ jsx59(Fragment19, {});
|
|
34415
33594
|
if (projectPath === void 0) {
|
|
34416
|
-
return /* @__PURE__ */
|
|
33595
|
+
return /* @__PURE__ */ jsx59(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
|
|
34417
33596
|
}
|
|
34418
33597
|
if (tokensPath === void 0) {
|
|
34419
|
-
return /* @__PURE__ */
|
|
33598
|
+
return /* @__PURE__ */ jsx59(
|
|
34420
33599
|
TokenInputScreen,
|
|
34421
33600
|
{
|
|
34422
33601
|
initialPath: importDefaults.tokenFile,
|
|
@@ -34426,7 +33605,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34426
33605
|
);
|
|
34427
33606
|
}
|
|
34428
33607
|
if (scannedFiles === void 0) {
|
|
34429
|
-
return /* @__PURE__ */
|
|
33608
|
+
return /* @__PURE__ */ jsx59(
|
|
34430
33609
|
PathValidationScreen,
|
|
34431
33610
|
{
|
|
34432
33611
|
projectPath,
|
|
@@ -34438,10 +33617,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34438
33617
|
}
|
|
34439
33618
|
if (extractionRun) {
|
|
34440
33619
|
if (extraction?.status === "done" && !extraction.result.ok) {
|
|
34441
|
-
return /* @__PURE__ */
|
|
33620
|
+
return /* @__PURE__ */ jsx59(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
34442
33621
|
}
|
|
34443
33622
|
if (extraction?.status === "running") {
|
|
34444
|
-
return /* @__PURE__ */
|
|
33623
|
+
return /* @__PURE__ */ jsx59(
|
|
34445
33624
|
ExtractionScreen,
|
|
34446
33625
|
{
|
|
34447
33626
|
progress: extraction.progress,
|
|
@@ -34450,14 +33629,14 @@ function App({ importOptions, inkClear }) {
|
|
|
34450
33629
|
}
|
|
34451
33630
|
);
|
|
34452
33631
|
}
|
|
34453
|
-
return /* @__PURE__ */
|
|
33632
|
+
return /* @__PURE__ */ jsx59(Fragment19, {});
|
|
34454
33633
|
}
|
|
34455
33634
|
if (scopeRun && scopeFlow) {
|
|
34456
33635
|
if (scopeFlow.status === "failed") {
|
|
34457
|
-
return /* @__PURE__ */
|
|
33636
|
+
return /* @__PURE__ */ jsx59(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
|
|
34458
33637
|
}
|
|
34459
33638
|
if (scopeFlow.status === "deciding") {
|
|
34460
|
-
return /* @__PURE__ */
|
|
33639
|
+
return /* @__PURE__ */ jsx59(
|
|
34461
33640
|
ScopeGateScreen,
|
|
34462
33641
|
{
|
|
34463
33642
|
components: scopeFlow.load.components,
|
|
@@ -34467,7 +33646,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34467
33646
|
);
|
|
34468
33647
|
}
|
|
34469
33648
|
if (generation?.status === "done" && !generation.result.ok) {
|
|
34470
|
-
return /* @__PURE__ */
|
|
33649
|
+
return /* @__PURE__ */ jsx59(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
|
|
34471
33650
|
}
|
|
34472
33651
|
if (generation?.status === "running") {
|
|
34473
33652
|
const hasRawTokens = scopeRun.input.rawTokensPath !== "";
|
|
@@ -34475,7 +33654,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34475
33654
|
hasRawTokens,
|
|
34476
33655
|
mapTokensEligible: generation.progress.mapTokensEligible
|
|
34477
33656
|
});
|
|
34478
|
-
return /* @__PURE__ */
|
|
33657
|
+
return /* @__PURE__ */ jsx59(
|
|
34479
33658
|
GenerationScreen,
|
|
34480
33659
|
{
|
|
34481
33660
|
progress: generation.progress,
|
|
@@ -34487,10 +33666,10 @@ function App({ importOptions, inkClear }) {
|
|
|
34487
33666
|
}
|
|
34488
33667
|
);
|
|
34489
33668
|
}
|
|
34490
|
-
return /* @__PURE__ */
|
|
33669
|
+
return /* @__PURE__ */ jsx59(Fragment19, {});
|
|
34491
33670
|
}
|
|
34492
33671
|
if (pendingLaunch?.cached) {
|
|
34493
|
-
return /* @__PURE__ */
|
|
33672
|
+
return /* @__PURE__ */ jsx59(
|
|
34494
33673
|
TokenReuseScreen,
|
|
34495
33674
|
{
|
|
34496
33675
|
tokensPath: pendingLaunch.cached.tokensPath,
|
|
@@ -34501,7 +33680,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34501
33680
|
}
|
|
34502
33681
|
);
|
|
34503
33682
|
}
|
|
34504
|
-
return /* @__PURE__ */
|
|
33683
|
+
return /* @__PURE__ */ jsx59(
|
|
34505
33684
|
CredentialsScreen,
|
|
34506
33685
|
{
|
|
34507
33686
|
initial: importDefaults.credentials,
|
|
@@ -34510,19 +33689,19 @@ function App({ importOptions, inkClear }) {
|
|
|
34510
33689
|
}
|
|
34511
33690
|
);
|
|
34512
33691
|
case "help":
|
|
34513
|
-
return /* @__PURE__ */
|
|
33692
|
+
return /* @__PURE__ */ jsx59(HelpScreen, { onDone: goToStart });
|
|
34514
33693
|
case "upgrade":
|
|
34515
|
-
return /* @__PURE__ */
|
|
33694
|
+
return /* @__PURE__ */ jsx59(UpgradeScreen, { onDone: goToStart });
|
|
34516
33695
|
case "settings":
|
|
34517
|
-
return /* @__PURE__ */
|
|
33696
|
+
return /* @__PURE__ */ jsx59(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
|
|
34518
33697
|
case "settings-configuration":
|
|
34519
|
-
return /* @__PURE__ */
|
|
33698
|
+
return /* @__PURE__ */ jsx59(ConfigurationScreen, { onDone: goToSettings });
|
|
34520
33699
|
case "settings-opt-in-analytics":
|
|
34521
|
-
return /* @__PURE__ */
|
|
33700
|
+
return /* @__PURE__ */ jsx59(OptInAnalyticsScreen, { onDone: goToSettings });
|
|
34522
33701
|
case "settings-debug-mode":
|
|
34523
|
-
return /* @__PURE__ */
|
|
33702
|
+
return /* @__PURE__ */ jsx59(DebugModeScreen, { onDone: goToSettings });
|
|
34524
33703
|
case "start":
|
|
34525
|
-
return /* @__PURE__ */
|
|
33704
|
+
return /* @__PURE__ */ jsx59(HomeScreen, { onNavigate: setScreen });
|
|
34526
33705
|
}
|
|
34527
33706
|
}
|
|
34528
33707
|
async function runApp(renderApp, importOptions) {
|
|
@@ -34530,7 +33709,7 @@ async function runApp(renderApp, importOptions) {
|
|
|
34530
33709
|
instance.clear?.();
|
|
34531
33710
|
process.stdout.write("\x1B[H\x1B[0J");
|
|
34532
33711
|
};
|
|
34533
|
-
const instance = renderApp(/* @__PURE__ */
|
|
33712
|
+
const instance = renderApp(/* @__PURE__ */ jsx59(App, { importOptions, inkClear }));
|
|
34534
33713
|
await instance.waitUntilExit();
|
|
34535
33714
|
}
|
|
34536
33715
|
var init_app = __esm({
|
|
@@ -34565,85 +33744,9 @@ var init_app = __esm({
|
|
|
34565
33744
|
// packages/experience-design-system-cli/program.ts
|
|
34566
33745
|
init_src4();
|
|
34567
33746
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
34568
|
-
import { join as
|
|
33747
|
+
import { join as join27 } from "node:path";
|
|
34569
33748
|
import { Command } from "commander";
|
|
34570
33749
|
|
|
34571
|
-
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
34572
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
34573
|
-
|
|
34574
|
-
// packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
|
|
34575
|
-
init_package_root();
|
|
34576
|
-
import { existsSync as existsSync8 } from "node:fs";
|
|
34577
|
-
import { join as join15 } from "node:path";
|
|
34578
|
-
var PACKAGE_NAME = "@contentful/experience-design-system-cli";
|
|
34579
|
-
function findLegacyCliPath() {
|
|
34580
|
-
const root = findPackageRoot(import.meta.url, PACKAGE_NAME);
|
|
34581
|
-
const candidates = [
|
|
34582
|
-
join15(root, "legacy", "bin", "cli.js"),
|
|
34583
|
-
join15(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
|
|
34584
|
-
];
|
|
34585
|
-
const found = candidates.find((candidate) => existsSync8(candidate));
|
|
34586
|
-
if (!found) {
|
|
34587
|
-
throw new Error(`Legacy CLI not found. Looked in:
|
|
34588
|
-
${candidates.join("\n")}`);
|
|
34589
|
-
}
|
|
34590
|
-
return found;
|
|
34591
|
-
}
|
|
34592
|
-
|
|
34593
|
-
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
34594
|
-
function runLegacy(args) {
|
|
34595
|
-
return new Promise((resolvePromise) => {
|
|
34596
|
-
let cliPath;
|
|
34597
|
-
try {
|
|
34598
|
-
cliPath = findLegacyCliPath();
|
|
34599
|
-
} catch (err) {
|
|
34600
|
-
process.stderr.write(`${err instanceof Error ? err.message : String(err)}
|
|
34601
|
-
`);
|
|
34602
|
-
resolvePromise(1);
|
|
34603
|
-
return;
|
|
34604
|
-
}
|
|
34605
|
-
const child = spawn3("node", [cliPath, ...args], { stdio: "inherit" });
|
|
34606
|
-
child.on("close", (code) => resolvePromise(code ?? 1));
|
|
34607
|
-
child.on("error", (err) => {
|
|
34608
|
-
process.stderr.write(`${err.message}
|
|
34609
|
-
`);
|
|
34610
|
-
resolvePromise(1);
|
|
34611
|
-
});
|
|
34612
|
-
});
|
|
34613
|
-
}
|
|
34614
|
-
|
|
34615
|
-
// packages/experience-design-system-cli/src/commands/forwarded.ts
|
|
34616
|
-
var FORWARDED_COMMANDS = [
|
|
34617
|
-
{
|
|
34618
|
-
name: "apply",
|
|
34619
|
-
description: "Apply a CDF file of components and design tokens to Contentful"
|
|
34620
|
-
},
|
|
34621
|
-
{
|
|
34622
|
-
name: "setup",
|
|
34623
|
-
description: "Configure prerequisites, credentials and the coding agent"
|
|
34624
|
-
},
|
|
34625
|
-
{ name: "doctor", description: "Check prerequisites and configuration" },
|
|
34626
|
-
{ name: "print", hidden: true },
|
|
34627
|
-
{ name: "map", hidden: true },
|
|
34628
|
-
{ name: "__extract", hidden: true },
|
|
34629
|
-
{ name: "__generate", hidden: true }
|
|
34630
|
-
];
|
|
34631
|
-
function registerForwardedCommands(program) {
|
|
34632
|
-
for (const entry of FORWARDED_COMMANDS) {
|
|
34633
|
-
const hidden = "hidden" in entry;
|
|
34634
|
-
const command = program.command(entry.name, { hidden });
|
|
34635
|
-
if (!hidden) command.description(entry.description);
|
|
34636
|
-
command.allowUnknownOption().allowExcessArguments().helpOption(false).argument("[args...]").action(async () => {
|
|
34637
|
-
process.exit(await runLegacy(process.argv.slice(2)));
|
|
34638
|
-
});
|
|
34639
|
-
}
|
|
34640
|
-
}
|
|
34641
|
-
|
|
34642
|
-
// packages/experience-design-system-cli/src/legacy/forwarded-import-args.ts
|
|
34643
|
-
function forwardedImportArgs(argv) {
|
|
34644
|
-
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
34645
|
-
}
|
|
34646
|
-
|
|
34647
33750
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
34648
33751
|
function toImportOptions(raw) {
|
|
34649
33752
|
return {
|
|
@@ -34655,33 +33758,36 @@ function toImportOptions(raw) {
|
|
|
34655
33758
|
|
|
34656
33759
|
// packages/experience-design-system-cli/src/commands/watch.ts
|
|
34657
33760
|
init_package_root();
|
|
34658
|
-
import { spawn as
|
|
34659
|
-
import { existsSync as
|
|
34660
|
-
import { join as
|
|
34661
|
-
var
|
|
33761
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
33762
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
33763
|
+
import { join as join15 } from "node:path";
|
|
33764
|
+
var PACKAGE_NAME = "@contentful/experience-design-system-cli";
|
|
34662
33765
|
function extractWatchFlag(args) {
|
|
34663
33766
|
const rest = args.filter((arg) => arg !== "--watch");
|
|
34664
33767
|
return { watch: rest.length !== args.length, rest };
|
|
34665
33768
|
}
|
|
34666
33769
|
function runDevWatch(args) {
|
|
34667
|
-
const script =
|
|
34668
|
-
if (!
|
|
33770
|
+
const script = join15(findPackageRoot(import.meta.url, PACKAGE_NAME), "scripts", "dev.mjs");
|
|
33771
|
+
if (!existsSync8(script)) {
|
|
34669
33772
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
34670
33773
|
return Promise.resolve(1);
|
|
34671
33774
|
}
|
|
34672
|
-
return new Promise((
|
|
34673
|
-
const child =
|
|
33775
|
+
return new Promise((resolve27) => {
|
|
33776
|
+
const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
34674
33777
|
process.on("SIGINT", () => void 0);
|
|
34675
|
-
child.on("exit", (code) =>
|
|
33778
|
+
child.on("exit", (code) => resolve27(code ?? 0));
|
|
34676
33779
|
child.on("error", (err) => {
|
|
34677
33780
|
process.stderr.write(`${err.message}
|
|
34678
33781
|
`);
|
|
34679
|
-
|
|
33782
|
+
resolve27(1);
|
|
34680
33783
|
});
|
|
34681
33784
|
});
|
|
34682
33785
|
}
|
|
34683
33786
|
|
|
34684
33787
|
// packages/experience-design-system-cli/src/commands/import.ts
|
|
33788
|
+
function stripImportArg(argv) {
|
|
33789
|
+
return argv[0] === "import" ? argv.slice(1) : argv;
|
|
33790
|
+
}
|
|
34685
33791
|
function registerImportCommand(program, openTui) {
|
|
34686
33792
|
program.command("import", { isDefault: true }).description("Launch the Experiences CLI").allowUnknownOption().allowExcessArguments().helpOption(false).argument("[args...]").option("--agent <name>", "Agent (or agent:model) the import runs its steps with").option(
|
|
34687
33793
|
"--prompt <stage=value>",
|
|
@@ -34689,7 +33795,7 @@ function registerImportCommand(program, openTui) {
|
|
|
34689
33795
|
(value, previous) => [...previous, value],
|
|
34690
33796
|
[]
|
|
34691
33797
|
).option("--no-cache", "Re-run every step even if its output already exists").action(async (_args, raw) => {
|
|
34692
|
-
const { watch, rest: forwarded } = extractWatchFlag(
|
|
33798
|
+
const { watch, rest: forwarded } = extractWatchFlag(stripImportArg(process.argv.slice(2)));
|
|
34693
33799
|
if (watch) {
|
|
34694
33800
|
process.exit(await runDevWatch(forwarded));
|
|
34695
33801
|
}
|
|
@@ -34698,13 +33804,11 @@ function registerImportCommand(program, openTui) {
|
|
|
34698
33804
|
}
|
|
34699
33805
|
|
|
34700
33806
|
// packages/experience-design-system-cli/program.ts
|
|
34701
|
-
init_agent_store();
|
|
34702
|
-
init_apply_binary_overrides();
|
|
34703
33807
|
init_analytics_store();
|
|
34704
33808
|
init_package_root();
|
|
34705
33809
|
var pkg = JSON.parse(
|
|
34706
33810
|
readFileSync9(
|
|
34707
|
-
|
|
33811
|
+
join27(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
34708
33812
|
"utf8"
|
|
34709
33813
|
)
|
|
34710
33814
|
);
|
|
@@ -34715,14 +33819,12 @@ function createProgram() {
|
|
|
34715
33819
|
const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
34716
33820
|
await runApp2(render, options);
|
|
34717
33821
|
});
|
|
34718
|
-
registerForwardedCommands(program);
|
|
34719
33822
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
34720
33823
|
const chain = [];
|
|
34721
33824
|
for (let c2 = actionCommand; c2 && c2.parent; c2 = c2.parent) chain.unshift(c2.name());
|
|
34722
33825
|
const commandChain = chain.join(" ") || actionCommand.name();
|
|
34723
33826
|
const { enabled } = await readAnalyticsSetting();
|
|
34724
33827
|
setPersistedAnalyticsDisabled(!enabled);
|
|
34725
|
-
await readAgentConfig().then(applyBinaryOverrides, () => void 0);
|
|
34726
33828
|
setCliVersion(pkg.version);
|
|
34727
33829
|
noteCommandStart(commandChain);
|
|
34728
33830
|
});
|
|
@@ -34744,10 +33846,10 @@ function createProgram() {
|
|
|
34744
33846
|
// packages/experience-design-system-cli/src/config/migrate.ts
|
|
34745
33847
|
init_config();
|
|
34746
33848
|
init_package_root();
|
|
34747
|
-
import { existsSync as
|
|
33849
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
34748
33850
|
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
34749
|
-
import { dirname as dirname16, join as
|
|
34750
|
-
var
|
|
33851
|
+
import { dirname as dirname16, join as join28 } from "node:path";
|
|
33852
|
+
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
34751
33853
|
async function readJson(path5) {
|
|
34752
33854
|
try {
|
|
34753
33855
|
return JSON.parse(await readFile19(path5, "utf8"));
|
|
@@ -34757,10 +33859,10 @@ async function readJson(path5) {
|
|
|
34757
33859
|
}
|
|
34758
33860
|
async function migrateOldConfig() {
|
|
34759
33861
|
try {
|
|
34760
|
-
const oldCredentials =
|
|
34761
|
-
const oldRuns =
|
|
34762
|
-
const oldDebugMode =
|
|
34763
|
-
findPackageRoot(import.meta.url,
|
|
33862
|
+
const oldCredentials = join28(oldConfigDir2(), "credentials.json");
|
|
33863
|
+
const oldRuns = join28(oldConfigDir2(), "runs.json");
|
|
33864
|
+
const oldDebugMode = join28(
|
|
33865
|
+
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
34764
33866
|
".contentful",
|
|
34765
33867
|
"config",
|
|
34766
33868
|
"debug_mode.json"
|
|
@@ -34770,8 +33872,8 @@ async function migrateOldConfig() {
|
|
|
34770
33872
|
if (debugMode) migrated["debugMode"] = debugMode;
|
|
34771
33873
|
Object.assign(migrated, await readJson(oldCredentials));
|
|
34772
33874
|
if (Object.keys(migrated).length > 0) await updateSettings2({ ...migrated, ...await readSettings2() });
|
|
34773
|
-
if (
|
|
34774
|
-
if (!
|
|
33875
|
+
if (existsSync11(oldRuns)) {
|
|
33876
|
+
if (!existsSync11(runsFilePath2())) {
|
|
34775
33877
|
await mkdir10(dirname16(runsFilePath2()), { recursive: true });
|
|
34776
33878
|
await rename3(oldRuns, runsFilePath2());
|
|
34777
33879
|
} else {
|