@contentful/experience-design-system-cli 2.37.1-dev-build-c3f4df22.0 → 2.37.1-dev-build-e611e80b.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 +398 -276
- package/dist/index.js +131 -57
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +18 -1
- package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +3 -2
- package/dist/src/tui/import/steps/06-extraction/types.d.ts +2 -0
- package/dist/src/tui/settings/contentful-configuration/config-store.d.ts +1 -0
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2121,7 +2121,7 @@ async function runAgent(options) {
|
|
|
2121
2121
|
promptLen: prompt.length,
|
|
2122
2122
|
promptHead: prompt.slice(0, 500)
|
|
2123
2123
|
});
|
|
2124
|
-
return new Promise((
|
|
2124
|
+
return new Promise((resolve27) => {
|
|
2125
2125
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
2126
2126
|
const child = spawn3(binary, args, {
|
|
2127
2127
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -2170,7 +2170,7 @@ async function runAgent(options) {
|
|
|
2170
2170
|
stderrLen: stderr.length,
|
|
2171
2171
|
stderrTail: stderr.slice(-1e3)
|
|
2172
2172
|
});
|
|
2173
|
-
|
|
2173
|
+
resolve27(result);
|
|
2174
2174
|
});
|
|
2175
2175
|
});
|
|
2176
2176
|
}
|
|
@@ -2192,7 +2192,7 @@ async function checkAgentAuth(agent) {
|
|
|
2192
2192
|
return "not-found";
|
|
2193
2193
|
if (agent !== "claude")
|
|
2194
2194
|
return "ok";
|
|
2195
|
-
return new Promise((
|
|
2195
|
+
return new Promise((resolve27) => {
|
|
2196
2196
|
const child = spawn4(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
2197
2197
|
let stdout = "";
|
|
2198
2198
|
let done = false;
|
|
@@ -2201,7 +2201,7 @@ async function checkAgentAuth(agent) {
|
|
|
2201
2201
|
return;
|
|
2202
2202
|
done = true;
|
|
2203
2203
|
child.kill("SIGTERM");
|
|
2204
|
-
|
|
2204
|
+
resolve27("unauthenticated");
|
|
2205
2205
|
}, 5e3);
|
|
2206
2206
|
child.stdout?.on("data", (chunk) => {
|
|
2207
2207
|
stdout += chunk.toString();
|
|
@@ -2212,14 +2212,14 @@ async function checkAgentAuth(agent) {
|
|
|
2212
2212
|
done = true;
|
|
2213
2213
|
clearTimeout(timer);
|
|
2214
2214
|
if (code !== 0) {
|
|
2215
|
-
|
|
2215
|
+
resolve27("unauthenticated");
|
|
2216
2216
|
return;
|
|
2217
2217
|
}
|
|
2218
2218
|
try {
|
|
2219
2219
|
const status = JSON.parse(stdout);
|
|
2220
|
-
|
|
2220
|
+
resolve27(status.loggedIn ? "ok" : "unauthenticated");
|
|
2221
2221
|
} catch {
|
|
2222
|
-
|
|
2222
|
+
resolve27("unauthenticated");
|
|
2223
2223
|
}
|
|
2224
2224
|
});
|
|
2225
2225
|
});
|
|
@@ -2229,9 +2229,9 @@ async function binaryIsOnPath(binary) {
|
|
|
2229
2229
|
const fs = await import("node:fs/promises");
|
|
2230
2230
|
return fs.access(binary).then(() => true, () => false);
|
|
2231
2231
|
}
|
|
2232
|
-
return new Promise((
|
|
2232
|
+
return new Promise((resolve27) => {
|
|
2233
2233
|
const child = spawn4(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
2234
|
-
child.on("close", (code) =>
|
|
2234
|
+
child.on("close", (code) => resolve27(code === 0));
|
|
2235
2235
|
});
|
|
2236
2236
|
}
|
|
2237
2237
|
var init_check_agent_auth = __esm({
|
|
@@ -13144,11 +13144,11 @@ var init_load_and_validate_for_review = __esm({
|
|
|
13144
13144
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
13145
13145
|
import { resolve as resolve15 } from "node:path";
|
|
13146
13146
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
13147
|
-
const
|
|
13147
|
+
const sessionDir2 = resolve15(artifactsRoot, sessionId);
|
|
13148
13148
|
return {
|
|
13149
|
-
sessionDir,
|
|
13150
|
-
eventsPath: resolve15(
|
|
13151
|
-
statePath: resolve15(
|
|
13149
|
+
sessionDir: sessionDir2,
|
|
13150
|
+
eventsPath: resolve15(sessionDir2, "events.jsonl"),
|
|
13151
|
+
statePath: resolve15(sessionDir2, "current-review-state.json")
|
|
13152
13152
|
};
|
|
13153
13153
|
}
|
|
13154
13154
|
var init_review_session_paths = __esm({
|
|
@@ -14901,7 +14901,7 @@ function errorMessage(error) {
|
|
|
14901
14901
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14902
14902
|
}
|
|
14903
14903
|
function defaultSleep(delayMs) {
|
|
14904
|
-
return new Promise((
|
|
14904
|
+
return new Promise((resolve27) => setTimeout(resolve27, delayMs));
|
|
14905
14905
|
}
|
|
14906
14906
|
var MAX_RETRY_AFTER_MS;
|
|
14907
14907
|
var init_http_utils = __esm({
|
|
@@ -15177,7 +15177,7 @@ var init_api_client = __esm({
|
|
|
15177
15177
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
15178
15178
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
15179
15179
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
15180
|
-
await new Promise((
|
|
15180
|
+
await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
|
|
15181
15181
|
}
|
|
15182
15182
|
}
|
|
15183
15183
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -18734,7 +18734,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18734
18734
|
const message = error instanceof Error ? error.message : String(error);
|
|
18735
18735
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18736
18736
|
throw error;
|
|
18737
|
-
await new Promise((
|
|
18737
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
|
|
18738
18738
|
}
|
|
18739
18739
|
}
|
|
18740
18740
|
}
|
|
@@ -20301,11 +20301,34 @@ var init_shared2 = __esm({
|
|
|
20301
20301
|
});
|
|
20302
20302
|
|
|
20303
20303
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
|
|
20304
|
-
import { access as access5, stat as stat4 } from "node:fs/promises";
|
|
20304
|
+
import { access as access5, readdir as readdir2, stat as stat4 } from "node:fs/promises";
|
|
20305
20305
|
import { join as join18 } from "node:path";
|
|
20306
|
-
async function
|
|
20306
|
+
async function findLatestTokens(contentfulDir) {
|
|
20307
|
+
const candidates = [join18(contentfulDir, "tokens.json")];
|
|
20308
|
+
try {
|
|
20309
|
+
for (const session of await readdir2(contentfulDir, { withFileTypes: true })) {
|
|
20310
|
+
if (!session.isDirectory()) continue;
|
|
20311
|
+
for (const run of await readdir2(join18(contentfulDir, session.name), { withFileTypes: true }).catch(() => [])) {
|
|
20312
|
+
if (run.isDirectory() && /^dsi-import-\d+$/.test(run.name)) {
|
|
20313
|
+
candidates.push(join18(contentfulDir, session.name, run.name, "tokens.json"));
|
|
20314
|
+
}
|
|
20315
|
+
}
|
|
20316
|
+
}
|
|
20317
|
+
} catch {
|
|
20318
|
+
}
|
|
20319
|
+
const found = [];
|
|
20320
|
+
for (const path5 of candidates) {
|
|
20321
|
+
try {
|
|
20322
|
+
found.push({ path: path5, mtimeMs: (await stat4(path5)).mtimeMs });
|
|
20323
|
+
} catch {
|
|
20324
|
+
}
|
|
20325
|
+
}
|
|
20326
|
+
return found.sort((a, b) => b.mtimeMs - a.mtimeMs)[0]?.path ?? null;
|
|
20327
|
+
}
|
|
20328
|
+
async function inspectTokens({ rawTokensPath, contentfulDir, cache }) {
|
|
20307
20329
|
if (!cache) return { kind: "none" };
|
|
20308
|
-
const tokensPath =
|
|
20330
|
+
const tokensPath = await findLatestTokens(contentfulDir);
|
|
20331
|
+
if (!tokensPath) return { kind: "none" };
|
|
20309
20332
|
try {
|
|
20310
20333
|
await access5(tokensPath);
|
|
20311
20334
|
} catch {
|
|
@@ -20520,13 +20543,12 @@ async function writeSettings2(settings) {
|
|
|
20520
20543
|
async function updateSettings2(patch) {
|
|
20521
20544
|
await writeSettings2({ ...await readSettings2(), ...patch });
|
|
20522
20545
|
}
|
|
20523
|
-
var configFilePath2, runsFilePath2,
|
|
20546
|
+
var configFilePath2, runsFilePath2, oldConfigDir2;
|
|
20524
20547
|
var init_config = __esm({
|
|
20525
20548
|
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
20526
20549
|
"use strict";
|
|
20527
20550
|
configFilePath2 = () => join19(configRoot2(), "config.json");
|
|
20528
20551
|
runsFilePath2 = () => join19(configRoot2(), "state", "runs.json");
|
|
20529
|
-
debugSessionsDir2 = () => join19(configRoot2(), "debug", "sessions");
|
|
20530
20552
|
oldConfigDir2 = () => join19(homedir3(), ".config", "experiences");
|
|
20531
20553
|
}
|
|
20532
20554
|
});
|
|
@@ -20654,7 +20676,7 @@ var init_selection2 = __esm({
|
|
|
20654
20676
|
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
20655
20677
|
import { join as join21, resolve as resolve22 } from "node:path";
|
|
20656
20678
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
20657
|
-
const outDir = join21(resolve22(input.projectPath), ".contentful");
|
|
20679
|
+
const outDir = input.outDir ?? join21(resolve22(input.projectPath), ".contentful");
|
|
20658
20680
|
let progress = initialProgress({
|
|
20659
20681
|
hasCredentials: input.credentials !== null,
|
|
20660
20682
|
hasRawTokens: input.rawTokensPath !== "",
|
|
@@ -31774,7 +31796,7 @@ var init_save = __esm({
|
|
|
31774
31796
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
31775
31797
|
appendRun,
|
|
31776
31798
|
buildSourceFingerprint,
|
|
31777
|
-
sleep: (ms) => new Promise((
|
|
31799
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
31778
31800
|
warn: (message) => process.stderr.write(message)
|
|
31779
31801
|
});
|
|
31780
31802
|
}
|
|
@@ -31796,7 +31818,7 @@ var init_types9 = __esm({
|
|
|
31796
31818
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
31797
31819
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
31798
31820
|
import { tmpdir } from "node:os";
|
|
31799
|
-
import { join as join25 } from "node:path";
|
|
31821
|
+
import { join as join25, resolve as resolve25 } from "node:path";
|
|
31800
31822
|
function appendWizardLog(entry) {
|
|
31801
31823
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
31802
31824
|
}
|
|
@@ -32044,7 +32066,7 @@ function createFlowController(start, deps) {
|
|
|
32044
32066
|
},
|
|
32045
32067
|
async submitPath(submitted) {
|
|
32046
32068
|
await deps.mkdir(submitted);
|
|
32047
|
-
if (await deps.detectSaveConflict(submitted)) {
|
|
32069
|
+
if (resolve25(submitted) !== resolve25(state.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
32048
32070
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
32049
32071
|
await deps.mkdir(subdir);
|
|
32050
32072
|
await proceedToWrite(subdir);
|
|
@@ -32132,9 +32154,18 @@ var init_debug_mode_store = __esm({
|
|
|
32132
32154
|
});
|
|
32133
32155
|
|
|
32134
32156
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
32157
|
+
var debug_store_exports = {};
|
|
32158
|
+
__export(debug_store_exports, {
|
|
32159
|
+
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
32160
|
+
currentSessionDir: () => currentSessionDir,
|
|
32161
|
+
finishDebugRun: () => finishDebugRun,
|
|
32162
|
+
startDebugRun: () => startDebugRun,
|
|
32163
|
+
startDebugSessionIn: () => startDebugSessionIn,
|
|
32164
|
+
startImportRun: () => startImportRun
|
|
32165
|
+
});
|
|
32135
32166
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32136
32167
|
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
32137
|
-
import { join as join26 } from "node:path";
|
|
32168
|
+
import { join as join26, resolve as resolve26 } from "node:path";
|
|
32138
32169
|
function generateRunId() {
|
|
32139
32170
|
const now = /* @__PURE__ */ new Date();
|
|
32140
32171
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -32147,10 +32178,17 @@ function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
|
32147
32178
|
function slugify(value) {
|
|
32148
32179
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
32149
32180
|
}
|
|
32150
|
-
function
|
|
32181
|
+
async function readBaseDir() {
|
|
32182
|
+
try {
|
|
32183
|
+
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
32184
|
+
return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
|
|
32185
|
+
} catch {
|
|
32186
|
+
return void 0;
|
|
32187
|
+
}
|
|
32188
|
+
}
|
|
32189
|
+
function nextSessionId(contentfulDir) {
|
|
32151
32190
|
const today = datePrefix();
|
|
32152
|
-
const
|
|
32153
|
-
const existing = existsSync11(root) ? readdirSync4(root) : [];
|
|
32191
|
+
const existing = existsSync11(contentfulDir) ? readdirSync4(contentfulDir) : [];
|
|
32154
32192
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
32155
32193
|
const maxSeq = existing.reduce((max, entry) => {
|
|
32156
32194
|
const match2 = seqPattern.exec(entry);
|
|
@@ -32158,11 +32196,38 @@ function generateSessionId3() {
|
|
|
32158
32196
|
}, 0);
|
|
32159
32197
|
return `${today}-session-${maxSeq + 1}`;
|
|
32160
32198
|
}
|
|
32161
|
-
function
|
|
32162
|
-
|
|
32199
|
+
function startSession(base, { replace }) {
|
|
32200
|
+
const contentfulDir = join26(base, ".contentful");
|
|
32201
|
+
if (replace || !sessionDir) sessionDir = join26(contentfulDir, nextSessionId(contentfulDir));
|
|
32202
|
+
return sessionDir;
|
|
32163
32203
|
}
|
|
32164
32204
|
function currentDebugSessionDir() {
|
|
32165
|
-
return
|
|
32205
|
+
return sessionDir && join26(sessionDir, "debug");
|
|
32206
|
+
}
|
|
32207
|
+
function currentSessionDir() {
|
|
32208
|
+
return sessionDir;
|
|
32209
|
+
}
|
|
32210
|
+
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
32211
|
+
try {
|
|
32212
|
+
if (!await isDebugModeEnabled()) return;
|
|
32213
|
+
await mkdir9(join26(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
|
|
32214
|
+
} catch {
|
|
32215
|
+
}
|
|
32216
|
+
}
|
|
32217
|
+
function nextImportRunDir(session) {
|
|
32218
|
+
const existing = existsSync11(session) ? readdirSync4(session) : [];
|
|
32219
|
+
const maxRun = existing.reduce((max, entry) => {
|
|
32220
|
+
const match2 = /^dsi-import-(\d+)$/.exec(entry);
|
|
32221
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32222
|
+
}, 0);
|
|
32223
|
+
return join26(session, `dsi-import-${maxRun + 1}`);
|
|
32224
|
+
}
|
|
32225
|
+
async function startImportRun(projectPath) {
|
|
32226
|
+
await startDebugSessionIn(projectPath);
|
|
32227
|
+
if (!sessionDir) return join26(resolve26(projectPath), ".contentful");
|
|
32228
|
+
const dir = nextImportRunDir(sessionDir);
|
|
32229
|
+
await mkdir9(dir, { recursive: true });
|
|
32230
|
+
return dir;
|
|
32166
32231
|
}
|
|
32167
32232
|
async function isDebugModeEnabled() {
|
|
32168
32233
|
try {
|
|
@@ -32203,8 +32268,10 @@ async function finishDebugRun({
|
|
|
32203
32268
|
pendingRun = void 0;
|
|
32204
32269
|
const durationMs = Date.now() - run.startedAt;
|
|
32205
32270
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
32271
|
+
const root = currentDebugSessionDir();
|
|
32272
|
+
if (!root) return;
|
|
32206
32273
|
const flowSegments = run.flow.split("/");
|
|
32207
|
-
const dir = join26(
|
|
32274
|
+
const dir = join26(root, ...flowSegments);
|
|
32208
32275
|
await mkdir9(dir, { recursive: true });
|
|
32209
32276
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
32210
32277
|
await writeFile8(join26(dir, filename), content, { mode: 384 });
|
|
@@ -32251,17 +32318,16 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
32251
32318
|
function handleCrash() {
|
|
32252
32319
|
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
32253
32320
|
}
|
|
32254
|
-
var pendingRun,
|
|
32321
|
+
var pendingRun, sessionDir;
|
|
32255
32322
|
var init_debug_store = __esm({
|
|
32256
32323
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
32257
32324
|
"use strict";
|
|
32258
32325
|
init_config();
|
|
32259
32326
|
init_version();
|
|
32260
32327
|
init_debug_mode_store();
|
|
32261
|
-
|
|
32262
|
-
|
|
32263
|
-
|
|
32264
|
-
return mkdir9(sessionDebugDir(), { recursive: true });
|
|
32328
|
+
void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
|
|
32329
|
+
if (!enabled || !base) return void 0;
|
|
32330
|
+
return mkdir9(join26(startSession(base, { replace: false }), "debug"), { recursive: true });
|
|
32265
32331
|
});
|
|
32266
32332
|
process.once("uncaughtException", (err) => {
|
|
32267
32333
|
void handleCrash().finally(() => {
|
|
@@ -32287,8 +32353,7 @@ async function readHelpInfo() {
|
|
|
32287
32353
|
return {
|
|
32288
32354
|
storage: [
|
|
32289
32355
|
{ label: "Config folder", value: configRoot2() },
|
|
32290
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
32291
|
-
{ label: "Debug logs", value: debugSessionsDir2() }
|
|
32356
|
+
{ label: "Settings file", value: configFilePath2() }
|
|
32292
32357
|
],
|
|
32293
32358
|
troubleshooting: [
|
|
32294
32359
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32297,7 +32362,7 @@ async function readHelpInfo() {
|
|
|
32297
32362
|
{ label: "Debug Mode", value: debugMode.enabled ? "on" : "off" },
|
|
32298
32363
|
{
|
|
32299
32364
|
label: "This session",
|
|
32300
|
-
value: debugMode.enabled ?
|
|
32365
|
+
value: !debugMode.enabled ? "no logs written while Debug Mode is off" : currentDebugSessionDir() ?? "not started: set the Root Project Directory in Settings, or start an import"
|
|
32301
32366
|
}
|
|
32302
32367
|
]
|
|
32303
32368
|
};
|
|
@@ -32454,7 +32519,8 @@ async function readCredentials() {
|
|
|
32454
32519
|
cmaToken: store.cmaToken || "",
|
|
32455
32520
|
host: store.host || "",
|
|
32456
32521
|
defaultComponentDir: store.defaultComponentDir || "",
|
|
32457
|
-
defaultTokenFile: store.defaultTokenFile || ""
|
|
32522
|
+
defaultTokenFile: store.defaultTokenFile || "",
|
|
32523
|
+
contentfulBaseDir: store.contentfulBaseDir || ""
|
|
32458
32524
|
};
|
|
32459
32525
|
}
|
|
32460
32526
|
async function writeCredentials(config) {
|
|
@@ -32487,7 +32553,8 @@ function debugFields(config) {
|
|
|
32487
32553
|
cma_token: config?.cmaToken ?? "",
|
|
32488
32554
|
host: config?.host ?? "",
|
|
32489
32555
|
default_component_dir: config?.defaultComponentDir ?? "",
|
|
32490
|
-
default_token_file: config?.defaultTokenFile ?? ""
|
|
32556
|
+
default_token_file: config?.defaultTokenFile ?? "",
|
|
32557
|
+
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
32491
32558
|
};
|
|
32492
32559
|
}
|
|
32493
32560
|
function ConfigurationScreen({ onDone }) {
|
|
@@ -32525,6 +32592,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32525
32592
|
setNotice(null);
|
|
32526
32593
|
writeCredentials(config).then(() => {
|
|
32527
32594
|
setLastSaved(config);
|
|
32595
|
+
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
32528
32596
|
setNotice({ kind: "success", text: "Configuration saved" });
|
|
32529
32597
|
setStage("form");
|
|
32530
32598
|
}).catch((err) => {
|
|
@@ -32590,10 +32658,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32590
32658
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
32591
32659
|
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
32592
32660
|
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
32593
|
-
/* @__PURE__ */
|
|
32594
|
-
FIELD_LABELS[field],
|
|
32595
|
-
":"
|
|
32596
|
-
] }),
|
|
32661
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
32597
32662
|
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
32598
32663
|
TextInput4,
|
|
32599
32664
|
{
|
|
@@ -32602,7 +32667,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32602
32667
|
onSubmit: () => setEditing(false),
|
|
32603
32668
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
32604
32669
|
}
|
|
32605
|
-
) : /* @__PURE__ */ jsx55(Text46, { children: display || /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" }) })
|
|
32670
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
32671
|
+
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
32606
32672
|
] }, field);
|
|
32607
32673
|
}) }),
|
|
32608
32674
|
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
@@ -32633,7 +32699,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32633
32699
|
)
|
|
32634
32700
|
] });
|
|
32635
32701
|
}
|
|
32636
|
-
var FIELD_ORDER, FIELD_LABELS;
|
|
32702
|
+
var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
|
|
32637
32703
|
var init_ContentfulConfigScreen = __esm({
|
|
32638
32704
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
32639
32705
|
"use strict";
|
|
@@ -32647,16 +32713,22 @@ var init_ContentfulConfigScreen = __esm({
|
|
|
32647
32713
|
"cmaToken",
|
|
32648
32714
|
"host",
|
|
32649
32715
|
"defaultComponentDir",
|
|
32650
|
-
"defaultTokenFile"
|
|
32716
|
+
"defaultTokenFile",
|
|
32717
|
+
"contentfulBaseDir"
|
|
32651
32718
|
];
|
|
32652
32719
|
FIELD_LABELS = {
|
|
32653
32720
|
spaceId: "Space ID",
|
|
32654
32721
|
environmentId: "Environment ID",
|
|
32655
32722
|
cmaToken: "CMA Token",
|
|
32656
|
-
host: "API Host
|
|
32657
|
-
defaultComponentDir: "Default component directory
|
|
32658
|
-
defaultTokenFile: "Default token file
|
|
32723
|
+
host: "API Host",
|
|
32724
|
+
defaultComponentDir: "Default component directory",
|
|
32725
|
+
defaultTokenFile: "Default token file",
|
|
32726
|
+
contentfulBaseDir: "Root Project Directory"
|
|
32727
|
+
};
|
|
32728
|
+
FIELD_HINTS = {
|
|
32729
|
+
contentfulBaseDir: "(where .contentful goes)"
|
|
32659
32730
|
};
|
|
32731
|
+
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
32660
32732
|
}
|
|
32661
32733
|
});
|
|
32662
32734
|
|
|
@@ -32950,7 +33022,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32950
33022
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
32951
33023
|
const state = await inspectTokens({
|
|
32952
33024
|
rawTokensPath: tokens,
|
|
32953
|
-
|
|
33025
|
+
contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
|
|
32954
33026
|
cache: importOptions.cache
|
|
32955
33027
|
});
|
|
32956
33028
|
if (state.kind === "cached") {
|
|
@@ -32971,6 +33043,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32971
33043
|
const settings = await readSettings2();
|
|
32972
33044
|
const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
|
|
32973
33045
|
const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
|
|
33046
|
+
const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
|
|
32974
33047
|
setExtractionRun({
|
|
32975
33048
|
...generatePromptPath ? { generatePromptPath } : {},
|
|
32976
33049
|
// the later steps get the same agent, so they use what the stage used
|
|
@@ -32979,6 +33052,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32979
33052
|
tokenStrategy,
|
|
32980
33053
|
input: {
|
|
32981
33054
|
projectPath: resolveUserPath(launch.projectPath ?? ""),
|
|
33055
|
+
outDir,
|
|
32982
33056
|
filePaths: launch.filePaths ?? [],
|
|
32983
33057
|
rawTokensPath: launch.tokens ?? "",
|
|
32984
33058
|
tokenStrategy,
|
|
@@ -33325,14 +33399,14 @@ function runDevWatch(args) {
|
|
|
33325
33399
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33326
33400
|
return Promise.resolve(1);
|
|
33327
33401
|
}
|
|
33328
|
-
return new Promise((
|
|
33402
|
+
return new Promise((resolve27) => {
|
|
33329
33403
|
const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33330
33404
|
process.on("SIGINT", () => void 0);
|
|
33331
|
-
child.on("exit", (code) =>
|
|
33405
|
+
child.on("exit", (code) => resolve27(code ?? 0));
|
|
33332
33406
|
child.on("error", (err) => {
|
|
33333
33407
|
process.stderr.write(`${err.message}
|
|
33334
33408
|
`);
|
|
33335
|
-
|
|
33409
|
+
resolve27(1);
|
|
33336
33410
|
});
|
|
33337
33411
|
});
|
|
33338
33412
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
type Status = 'success' | 'error';
|
|
2
2
|
type ExitMethod = 'saved' | 'discarded' | 'crashed';
|
|
3
|
-
export declare function currentDebugSessionDir(): string;
|
|
3
|
+
export declare function currentDebugSessionDir(): string | undefined;
|
|
4
|
+
/** This terminal session's folder, `<base>/.contentful/<session>/`, or undefined until it is known. */
|
|
5
|
+
export declare function currentSessionDir(): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Starts this terminal session's folder in `base`. The base directory setting being saved passes `replace` so the new
|
|
8
|
+
* location wins; the import passes nothing and only starts a session when none exists yet. Fail-open like the rest of
|
|
9
|
+
* the logger.
|
|
10
|
+
*/
|
|
11
|
+
export declare function startDebugSessionIn(base: string, { replace }?: {
|
|
12
|
+
replace?: boolean | undefined;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Where this import run writes everything it produces (tokens.json, .existing-entities.json, components.json): a new
|
|
16
|
+
* `dsi-import-N` folder in this session's folder, next to the debug logs. The session is started here, and waited for,
|
|
17
|
+
* so the answer does not depend on how quickly the boot-time start finished. Without a session (Debug Mode off, or a
|
|
18
|
+
* folder that cannot be created) the files stay in `<project>/.contentful`, as before.
|
|
19
|
+
*/
|
|
20
|
+
export declare function startImportRun(projectPath: string): Promise<string>;
|
|
4
21
|
export declare function startDebugRun({ flow, step, menuOption, inputs, }: {
|
|
5
22
|
flow: string;
|
|
6
23
|
step: string;
|
|
@@ -8,10 +8,11 @@ export type TokensState = {
|
|
|
8
8
|
};
|
|
9
9
|
interface InspectInput {
|
|
10
10
|
rawTokensPath: string;
|
|
11
|
-
|
|
11
|
+
/** The `.contentful` folder: the sessions' `dsi-import` folders sit inside it, and an older `tokens.json` may sit in it. */
|
|
12
|
+
contentfulDir: string;
|
|
12
13
|
cache: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare function inspectTokens({ rawTokensPath,
|
|
15
|
+
export declare function inspectTokens({ rawTokensPath, contentfulDir, cache }: InspectInput): Promise<TokensState>;
|
|
15
16
|
export declare function gateText({ tokensPath, sourceChanged }: {
|
|
16
17
|
tokensPath: string;
|
|
17
18
|
sourceChanged: boolean;
|
|
@@ -2,6 +2,8 @@ import type { ExtractionHandoff, ImportHandoff } from '@contentful/experience-de
|
|
|
2
2
|
export type TokenStrategy = ImportHandoff['tokens']['strategy'];
|
|
3
3
|
export interface ExtractionInput {
|
|
4
4
|
projectPath: string;
|
|
5
|
+
/** Where the stage writes tokens.json and the other files. Defaults to `<projectPath>/.contentful`. */
|
|
6
|
+
outDir?: string;
|
|
5
7
|
/** Absolute source files from the path-validation step (collectFiles output). */
|
|
6
8
|
filePaths: string[];
|
|
7
9
|
/** Raw tokens file the user pointed at (always set: v2 asks for one). */
|
package/legacy/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-e611e80b.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-
|
|
49
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-e611e80b.0",
|
|
49
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-e611e80b.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|