@contentful/experience-design-system-cli 2.37.1-dev-build-eed963c1.0 → 2.37.1-dev-build-a6ad74de.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 !== "",
|
|
@@ -31795,7 +31817,7 @@ var init_save = __esm({
|
|
|
31795
31817
|
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
31796
31818
|
appendRun,
|
|
31797
31819
|
buildSourceFingerprint,
|
|
31798
|
-
sleep: (ms) => new Promise((
|
|
31820
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
31799
31821
|
warn: (message) => process.stderr.write(message)
|
|
31800
31822
|
});
|
|
31801
31823
|
}
|
|
@@ -31817,7 +31839,7 @@ var init_types9 = __esm({
|
|
|
31817
31839
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
31818
31840
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
31819
31841
|
import { tmpdir } from "node:os";
|
|
31820
|
-
import { join as join25 } from "node:path";
|
|
31842
|
+
import { join as join25, resolve as resolve25 } from "node:path";
|
|
31821
31843
|
function appendWizardLog(entry) {
|
|
31822
31844
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
31823
31845
|
}
|
|
@@ -32065,7 +32087,7 @@ function createFlowController(start, deps) {
|
|
|
32065
32087
|
},
|
|
32066
32088
|
async submitPath(submitted) {
|
|
32067
32089
|
await deps.mkdir(submitted);
|
|
32068
|
-
if (await deps.detectSaveConflict(submitted)) {
|
|
32090
|
+
if (resolve25(submitted) !== resolve25(state.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
32069
32091
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
32070
32092
|
await deps.mkdir(subdir);
|
|
32071
32093
|
await proceedToWrite(subdir);
|
|
@@ -32153,9 +32175,18 @@ var init_debug_mode_store = __esm({
|
|
|
32153
32175
|
});
|
|
32154
32176
|
|
|
32155
32177
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
32178
|
+
var debug_store_exports = {};
|
|
32179
|
+
__export(debug_store_exports, {
|
|
32180
|
+
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
32181
|
+
currentSessionDir: () => currentSessionDir,
|
|
32182
|
+
finishDebugRun: () => finishDebugRun,
|
|
32183
|
+
startDebugRun: () => startDebugRun,
|
|
32184
|
+
startDebugSessionIn: () => startDebugSessionIn,
|
|
32185
|
+
startImportRun: () => startImportRun
|
|
32186
|
+
});
|
|
32156
32187
|
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32157
32188
|
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
32158
|
-
import { join as join26 } from "node:path";
|
|
32189
|
+
import { join as join26, resolve as resolve26 } from "node:path";
|
|
32159
32190
|
function generateRunId() {
|
|
32160
32191
|
const now = /* @__PURE__ */ new Date();
|
|
32161
32192
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -32168,10 +32199,17 @@ function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
|
32168
32199
|
function slugify(value) {
|
|
32169
32200
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
32170
32201
|
}
|
|
32171
|
-
function
|
|
32202
|
+
async function readBaseDir() {
|
|
32203
|
+
try {
|
|
32204
|
+
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
32205
|
+
return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
|
|
32206
|
+
} catch {
|
|
32207
|
+
return void 0;
|
|
32208
|
+
}
|
|
32209
|
+
}
|
|
32210
|
+
function nextSessionId(contentfulDir) {
|
|
32172
32211
|
const today = datePrefix();
|
|
32173
|
-
const
|
|
32174
|
-
const existing = existsSync11(root) ? readdirSync4(root) : [];
|
|
32212
|
+
const existing = existsSync11(contentfulDir) ? readdirSync4(contentfulDir) : [];
|
|
32175
32213
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
32176
32214
|
const maxSeq = existing.reduce((max, entry) => {
|
|
32177
32215
|
const match2 = seqPattern.exec(entry);
|
|
@@ -32179,11 +32217,38 @@ function generateSessionId3() {
|
|
|
32179
32217
|
}, 0);
|
|
32180
32218
|
return `${today}-session-${maxSeq + 1}`;
|
|
32181
32219
|
}
|
|
32182
|
-
function
|
|
32183
|
-
|
|
32220
|
+
function startSession(base, { replace }) {
|
|
32221
|
+
const contentfulDir = join26(base, ".contentful");
|
|
32222
|
+
if (replace || !sessionDir) sessionDir = join26(contentfulDir, nextSessionId(contentfulDir));
|
|
32223
|
+
return sessionDir;
|
|
32184
32224
|
}
|
|
32185
32225
|
function currentDebugSessionDir() {
|
|
32186
|
-
return
|
|
32226
|
+
return sessionDir && join26(sessionDir, "debug");
|
|
32227
|
+
}
|
|
32228
|
+
function currentSessionDir() {
|
|
32229
|
+
return sessionDir;
|
|
32230
|
+
}
|
|
32231
|
+
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
32232
|
+
try {
|
|
32233
|
+
if (!await isDebugModeEnabled()) return;
|
|
32234
|
+
await mkdir9(join26(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
|
|
32235
|
+
} catch {
|
|
32236
|
+
}
|
|
32237
|
+
}
|
|
32238
|
+
function nextImportRunDir(session) {
|
|
32239
|
+
const existing = existsSync11(session) ? readdirSync4(session) : [];
|
|
32240
|
+
const maxRun = existing.reduce((max, entry) => {
|
|
32241
|
+
const match2 = /^dsi-import-(\d+)$/.exec(entry);
|
|
32242
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32243
|
+
}, 0);
|
|
32244
|
+
return join26(session, `dsi-import-${maxRun + 1}`);
|
|
32245
|
+
}
|
|
32246
|
+
async function startImportRun(projectPath) {
|
|
32247
|
+
await startDebugSessionIn(projectPath);
|
|
32248
|
+
if (!sessionDir) return join26(resolve26(projectPath), ".contentful");
|
|
32249
|
+
const dir = nextImportRunDir(sessionDir);
|
|
32250
|
+
await mkdir9(dir, { recursive: true });
|
|
32251
|
+
return dir;
|
|
32187
32252
|
}
|
|
32188
32253
|
async function isDebugModeEnabled() {
|
|
32189
32254
|
try {
|
|
@@ -32224,8 +32289,10 @@ async function finishDebugRun({
|
|
|
32224
32289
|
pendingRun = void 0;
|
|
32225
32290
|
const durationMs = Date.now() - run.startedAt;
|
|
32226
32291
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
32292
|
+
const root = currentDebugSessionDir();
|
|
32293
|
+
if (!root) return;
|
|
32227
32294
|
const flowSegments = run.flow.split("/");
|
|
32228
|
-
const dir = join26(
|
|
32295
|
+
const dir = join26(root, ...flowSegments);
|
|
32229
32296
|
await mkdir9(dir, { recursive: true });
|
|
32230
32297
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
32231
32298
|
await writeFile8(join26(dir, filename), content, { mode: 384 });
|
|
@@ -32272,17 +32339,16 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
32272
32339
|
function handleCrash() {
|
|
32273
32340
|
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
32274
32341
|
}
|
|
32275
|
-
var pendingRun,
|
|
32342
|
+
var pendingRun, sessionDir;
|
|
32276
32343
|
var init_debug_store = __esm({
|
|
32277
32344
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
32278
32345
|
"use strict";
|
|
32279
32346
|
init_config();
|
|
32280
32347
|
init_version();
|
|
32281
32348
|
init_debug_mode_store();
|
|
32282
|
-
|
|
32283
|
-
|
|
32284
|
-
|
|
32285
|
-
return mkdir9(sessionDebugDir(), { recursive: true });
|
|
32349
|
+
void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
|
|
32350
|
+
if (!enabled || !base) return void 0;
|
|
32351
|
+
return mkdir9(join26(startSession(base, { replace: false }), "debug"), { recursive: true });
|
|
32286
32352
|
});
|
|
32287
32353
|
process.once("uncaughtException", (err) => {
|
|
32288
32354
|
void handleCrash().finally(() => {
|
|
@@ -32308,8 +32374,7 @@ async function readHelpInfo() {
|
|
|
32308
32374
|
return {
|
|
32309
32375
|
storage: [
|
|
32310
32376
|
{ label: "Config folder", value: configRoot2() },
|
|
32311
|
-
{ label: "Settings file", value: configFilePath2() }
|
|
32312
|
-
{ label: "Debug logs", value: debugSessionsDir2() }
|
|
32377
|
+
{ label: "Settings file", value: configFilePath2() }
|
|
32313
32378
|
],
|
|
32314
32379
|
troubleshooting: [
|
|
32315
32380
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32318,7 +32383,7 @@ async function readHelpInfo() {
|
|
|
32318
32383
|
{ label: "Debug Mode", value: debugMode.enabled ? "on" : "off" },
|
|
32319
32384
|
{
|
|
32320
32385
|
label: "This session",
|
|
32321
|
-
value: debugMode.enabled ?
|
|
32386
|
+
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"
|
|
32322
32387
|
}
|
|
32323
32388
|
]
|
|
32324
32389
|
};
|
|
@@ -32475,7 +32540,8 @@ async function readCredentials() {
|
|
|
32475
32540
|
cmaToken: store.cmaToken || "",
|
|
32476
32541
|
host: store.host || "",
|
|
32477
32542
|
defaultComponentDir: store.defaultComponentDir || "",
|
|
32478
|
-
defaultTokenFile: store.defaultTokenFile || ""
|
|
32543
|
+
defaultTokenFile: store.defaultTokenFile || "",
|
|
32544
|
+
contentfulBaseDir: store.contentfulBaseDir || ""
|
|
32479
32545
|
};
|
|
32480
32546
|
}
|
|
32481
32547
|
async function writeCredentials(config) {
|
|
@@ -32508,7 +32574,8 @@ function debugFields(config) {
|
|
|
32508
32574
|
cma_token: config?.cmaToken ?? "",
|
|
32509
32575
|
host: config?.host ?? "",
|
|
32510
32576
|
default_component_dir: config?.defaultComponentDir ?? "",
|
|
32511
|
-
default_token_file: config?.defaultTokenFile ?? ""
|
|
32577
|
+
default_token_file: config?.defaultTokenFile ?? "",
|
|
32578
|
+
contentful_base_dir: config?.contentfulBaseDir ?? ""
|
|
32512
32579
|
};
|
|
32513
32580
|
}
|
|
32514
32581
|
function ConfigurationScreen({ onDone }) {
|
|
@@ -32546,6 +32613,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32546
32613
|
setNotice(null);
|
|
32547
32614
|
writeCredentials(config).then(() => {
|
|
32548
32615
|
setLastSaved(config);
|
|
32616
|
+
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
32549
32617
|
setNotice({ kind: "success", text: "Configuration saved" });
|
|
32550
32618
|
setStage("form");
|
|
32551
32619
|
}).catch((err) => {
|
|
@@ -32611,10 +32679,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32611
32679
|
const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
|
|
32612
32680
|
return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
|
|
32613
32681
|
/* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
|
|
32614
|
-
/* @__PURE__ */
|
|
32615
|
-
FIELD_LABELS[field],
|
|
32616
|
-
":"
|
|
32617
|
-
] }),
|
|
32682
|
+
/* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
|
|
32618
32683
|
isActive && editing ? /* @__PURE__ */ jsx55(
|
|
32619
32684
|
TextInput4,
|
|
32620
32685
|
{
|
|
@@ -32623,7 +32688,8 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32623
32688
|
onSubmit: () => setEditing(false),
|
|
32624
32689
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
32625
32690
|
}
|
|
32626
|
-
) : /* @__PURE__ */ jsx55(Text46, { children: display || /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" }) })
|
|
32691
|
+
) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
|
|
32692
|
+
FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
|
|
32627
32693
|
] }, field);
|
|
32628
32694
|
}) }),
|
|
32629
32695
|
notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
@@ -32654,7 +32720,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
32654
32720
|
)
|
|
32655
32721
|
] });
|
|
32656
32722
|
}
|
|
32657
|
-
var FIELD_ORDER, FIELD_LABELS;
|
|
32723
|
+
var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
|
|
32658
32724
|
var init_ContentfulConfigScreen = __esm({
|
|
32659
32725
|
"packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
|
|
32660
32726
|
"use strict";
|
|
@@ -32668,16 +32734,22 @@ var init_ContentfulConfigScreen = __esm({
|
|
|
32668
32734
|
"cmaToken",
|
|
32669
32735
|
"host",
|
|
32670
32736
|
"defaultComponentDir",
|
|
32671
|
-
"defaultTokenFile"
|
|
32737
|
+
"defaultTokenFile",
|
|
32738
|
+
"contentfulBaseDir"
|
|
32672
32739
|
];
|
|
32673
32740
|
FIELD_LABELS = {
|
|
32674
32741
|
spaceId: "Space ID",
|
|
32675
32742
|
environmentId: "Environment ID",
|
|
32676
32743
|
cmaToken: "CMA Token",
|
|
32677
|
-
host: "API Host
|
|
32678
|
-
defaultComponentDir: "Default component directory
|
|
32679
|
-
defaultTokenFile: "Default token file
|
|
32744
|
+
host: "API Host",
|
|
32745
|
+
defaultComponentDir: "Default component directory",
|
|
32746
|
+
defaultTokenFile: "Default token file",
|
|
32747
|
+
contentfulBaseDir: "Root Project Directory"
|
|
32748
|
+
};
|
|
32749
|
+
FIELD_HINTS = {
|
|
32750
|
+
contentfulBaseDir: "(where .contentful goes)"
|
|
32680
32751
|
};
|
|
32752
|
+
LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
|
|
32681
32753
|
}
|
|
32682
32754
|
});
|
|
32683
32755
|
|
|
@@ -32971,7 +33043,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32971
33043
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
32972
33044
|
const state = await inspectTokens({
|
|
32973
33045
|
rawTokensPath: tokens,
|
|
32974
|
-
|
|
33046
|
+
contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
|
|
32975
33047
|
cache: importOptions.cache
|
|
32976
33048
|
});
|
|
32977
33049
|
if (state.kind === "cached") {
|
|
@@ -32992,6 +33064,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32992
33064
|
const settings = await readSettings2();
|
|
32993
33065
|
const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
|
|
32994
33066
|
const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
|
|
33067
|
+
const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
|
|
32995
33068
|
setExtractionRun({
|
|
32996
33069
|
...generatePromptPath ? { generatePromptPath } : {},
|
|
32997
33070
|
// the later steps get the same agent, so they use what the stage used
|
|
@@ -33000,6 +33073,7 @@ function App({ importOptions, inkClear }) {
|
|
|
33000
33073
|
tokenStrategy,
|
|
33001
33074
|
input: {
|
|
33002
33075
|
projectPath: resolveUserPath(launch.projectPath ?? ""),
|
|
33076
|
+
outDir,
|
|
33003
33077
|
filePaths: launch.filePaths ?? [],
|
|
33004
33078
|
rawTokensPath: launch.tokens ?? "",
|
|
33005
33079
|
tokenStrategy,
|
|
@@ -33346,14 +33420,14 @@ function runDevWatch(args) {
|
|
|
33346
33420
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33347
33421
|
return Promise.resolve(1);
|
|
33348
33422
|
}
|
|
33349
|
-
return new Promise((
|
|
33423
|
+
return new Promise((resolve27) => {
|
|
33350
33424
|
const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33351
33425
|
process.on("SIGINT", () => void 0);
|
|
33352
|
-
child.on("exit", (code) =>
|
|
33426
|
+
child.on("exit", (code) => resolve27(code ?? 0));
|
|
33353
33427
|
child.on("error", (err) => {
|
|
33354
33428
|
process.stderr.write(`${err.message}
|
|
33355
33429
|
`);
|
|
33356
|
-
|
|
33430
|
+
resolve27(1);
|
|
33357
33431
|
});
|
|
33358
33432
|
});
|
|
33359
33433
|
}
|
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-a6ad74de.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-
|
|
49
|
-
"@contentful/experience-design-system-
|
|
48
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-a6ad74de.0",
|
|
49
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-a6ad74de.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@tsconfig/node24": "^24.0.4",
|