@contentful/experience-design-system-cli 2.37.1-dev-build-5bd13138.0 → 2.37.1-dev-build-cffd984a.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 +65 -100
- package/dist/index.js +257 -300
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/06-extraction/run.d.ts +0 -3
- package/dist/src/tui/import/steps/10-flow/flow/controller.d.ts +0 -3
- package/legacy/package.json +1 -1
- package/package.json +3 -3
- package/dist/src/tui/import/debug-hooks.d.ts +0 -17
package/dist/app.js
CHANGED
|
@@ -837,7 +837,7 @@ async function runAgent(options) {
|
|
|
837
837
|
promptLen: prompt.length,
|
|
838
838
|
promptHead: prompt.slice(0, 500)
|
|
839
839
|
});
|
|
840
|
-
return new Promise((
|
|
840
|
+
return new Promise((resolve27) => {
|
|
841
841
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
842
842
|
const child = spawn(binary, args, {
|
|
843
843
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -886,7 +886,7 @@ async function runAgent(options) {
|
|
|
886
886
|
stderrLen: stderr.length,
|
|
887
887
|
stderrTail: stderr.slice(-1e3)
|
|
888
888
|
});
|
|
889
|
-
|
|
889
|
+
resolve27(result);
|
|
890
890
|
});
|
|
891
891
|
});
|
|
892
892
|
}
|
|
@@ -908,7 +908,7 @@ async function checkAgentAuth(agent) {
|
|
|
908
908
|
return "not-found";
|
|
909
909
|
if (agent !== "claude")
|
|
910
910
|
return "ok";
|
|
911
|
-
return new Promise((
|
|
911
|
+
return new Promise((resolve27) => {
|
|
912
912
|
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
913
913
|
let stdout = "";
|
|
914
914
|
let done = false;
|
|
@@ -917,7 +917,7 @@ async function checkAgentAuth(agent) {
|
|
|
917
917
|
return;
|
|
918
918
|
done = true;
|
|
919
919
|
child.kill("SIGTERM");
|
|
920
|
-
|
|
920
|
+
resolve27("unauthenticated");
|
|
921
921
|
}, 5e3);
|
|
922
922
|
child.stdout?.on("data", (chunk) => {
|
|
923
923
|
stdout += chunk.toString();
|
|
@@ -928,14 +928,14 @@ async function checkAgentAuth(agent) {
|
|
|
928
928
|
done = true;
|
|
929
929
|
clearTimeout(timer);
|
|
930
930
|
if (code !== 0) {
|
|
931
|
-
|
|
931
|
+
resolve27("unauthenticated");
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
934
|
try {
|
|
935
935
|
const status = JSON.parse(stdout);
|
|
936
|
-
|
|
936
|
+
resolve27(status.loggedIn ? "ok" : "unauthenticated");
|
|
937
937
|
} catch {
|
|
938
|
-
|
|
938
|
+
resolve27("unauthenticated");
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
941
|
});
|
|
@@ -945,9 +945,9 @@ async function binaryIsOnPath(binary) {
|
|
|
945
945
|
const fs = await import("node:fs/promises");
|
|
946
946
|
return fs.access(binary).then(() => true, () => false);
|
|
947
947
|
}
|
|
948
|
-
return new Promise((
|
|
948
|
+
return new Promise((resolve27) => {
|
|
949
949
|
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
950
|
-
child.on("close", (code) =>
|
|
950
|
+
child.on("close", (code) => resolve27(code === 0));
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
953
|
var init_check_agent_auth = __esm({
|
|
@@ -2143,9 +2143,9 @@ __export(debug_store_exports, {
|
|
|
2143
2143
|
setDebugOutDir: () => setDebugOutDir,
|
|
2144
2144
|
startDebugRun: () => startDebugRun
|
|
2145
2145
|
});
|
|
2146
|
-
import { cp, mkdir as
|
|
2147
|
-
import { existsSync as
|
|
2148
|
-
import { join as
|
|
2146
|
+
import { cp, mkdir as mkdir8, rename as rename3, rm, writeFile as writeFile7 } from "node:fs/promises";
|
|
2147
|
+
import { existsSync as existsSync9, readdirSync as readdirSync3 } from "node:fs";
|
|
2148
|
+
import { join as join20, resolve as resolve23 } from "node:path";
|
|
2149
2149
|
function generateRunId() {
|
|
2150
2150
|
const now = /* @__PURE__ */ new Date();
|
|
2151
2151
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -2161,7 +2161,7 @@ function slugify(value) {
|
|
|
2161
2161
|
function generateSessionId3() {
|
|
2162
2162
|
const today = datePrefix();
|
|
2163
2163
|
const root = debugSessionsDir2();
|
|
2164
|
-
const existing =
|
|
2164
|
+
const existing = existsSync9(root) ? readdirSync3(root) : [];
|
|
2165
2165
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
2166
2166
|
const maxSeq = existing.reduce((max, entry) => {
|
|
2167
2167
|
const match2 = seqPattern.exec(entry);
|
|
@@ -2170,20 +2170,20 @@ function generateSessionId3() {
|
|
|
2170
2170
|
return `${today}-session-${maxSeq + 1}`;
|
|
2171
2171
|
}
|
|
2172
2172
|
function sessionDebugDir() {
|
|
2173
|
-
return
|
|
2173
|
+
return join20(projectSessionsRoot ?? debugSessionsDir2(), SESSION_ID);
|
|
2174
2174
|
}
|
|
2175
2175
|
function currentDebugSessionDir() {
|
|
2176
2176
|
return sessionDebugDir();
|
|
2177
2177
|
}
|
|
2178
2178
|
async function setDebugOutDir(outDir) {
|
|
2179
2179
|
if (!await isDebugModeEnabled()) return;
|
|
2180
|
-
const nextRoot =
|
|
2180
|
+
const nextRoot = join20(resolve23(outDir), "debug", "sessions");
|
|
2181
2181
|
const from = sessionDebugDir();
|
|
2182
|
-
const to =
|
|
2182
|
+
const to = join20(nextRoot, SESSION_ID);
|
|
2183
2183
|
if (from === to) return;
|
|
2184
2184
|
try {
|
|
2185
|
-
await
|
|
2186
|
-
if (
|
|
2185
|
+
await mkdir8(nextRoot, { recursive: true });
|
|
2186
|
+
if (existsSync9(from)) {
|
|
2187
2187
|
try {
|
|
2188
2188
|
await rename3(from, to);
|
|
2189
2189
|
} catch {
|
|
@@ -2191,7 +2191,7 @@ async function setDebugOutDir(outDir) {
|
|
|
2191
2191
|
await rm(from, { recursive: true, force: true });
|
|
2192
2192
|
}
|
|
2193
2193
|
} else {
|
|
2194
|
-
await
|
|
2194
|
+
await mkdir8(to, { recursive: true });
|
|
2195
2195
|
}
|
|
2196
2196
|
projectSessionsRoot = nextRoot;
|
|
2197
2197
|
} catch {
|
|
@@ -2237,15 +2237,15 @@ async function finishDebugRun({
|
|
|
2237
2237
|
const durationMs = Date.now() - run.startedAt;
|
|
2238
2238
|
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
2239
2239
|
const flowSegments = run.flow.split("/");
|
|
2240
|
-
const dir =
|
|
2241
|
-
await
|
|
2240
|
+
const dir = join20(sessionDebugDir(), ...flowSegments);
|
|
2241
|
+
await mkdir8(dir, { recursive: true });
|
|
2242
2242
|
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
2243
|
-
await writeFile7(
|
|
2243
|
+
await writeFile7(join20(dir, filename), content, { mode: 384 });
|
|
2244
2244
|
}
|
|
2245
2245
|
function nextAttemptFilename(dir, menuOption) {
|
|
2246
2246
|
const today = datePrefix();
|
|
2247
2247
|
const optionSlug = slugify(menuOption);
|
|
2248
|
-
const existing =
|
|
2248
|
+
const existing = existsSync9(dir) ? readdirSync3(dir) : [];
|
|
2249
2249
|
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
2250
2250
|
const maxAttempt = existing.reduce((max, entry) => {
|
|
2251
2251
|
const match2 = attemptPattern.exec(entry);
|
|
@@ -2294,7 +2294,7 @@ var init_debug_store = __esm({
|
|
|
2294
2294
|
SESSION_ID = generateSessionId3();
|
|
2295
2295
|
void isDebugModeEnabled().then((enabled) => {
|
|
2296
2296
|
if (!enabled) return void 0;
|
|
2297
|
-
return
|
|
2297
|
+
return mkdir8(sessionDebugDir(), { recursive: true });
|
|
2298
2298
|
});
|
|
2299
2299
|
process.once("uncaughtException", (err) => {
|
|
2300
2300
|
void handleCrash().finally(() => {
|
|
@@ -2315,7 +2315,7 @@ var init_debug_store = __esm({
|
|
|
2315
2315
|
});
|
|
2316
2316
|
|
|
2317
2317
|
// packages/experience-design-system-cli/app.tsx
|
|
2318
|
-
import { join as
|
|
2318
|
+
import { join as join26 } from "node:path";
|
|
2319
2319
|
import { useEffect as useEffect27, useState as useState33 } from "react";
|
|
2320
2320
|
|
|
2321
2321
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
@@ -5133,7 +5133,7 @@ function getTsxExtractionContext(filePaths, componentFilePattern) {
|
|
|
5133
5133
|
project: createTsxProject(getTsxProjectFiles(filePaths))
|
|
5134
5134
|
};
|
|
5135
5135
|
}
|
|
5136
|
-
function extractTsxComponents(filePaths, componentFilePattern,
|
|
5136
|
+
function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
5137
5137
|
const extractionContext = getTsxExtractionContext(filePaths, componentFilePattern);
|
|
5138
5138
|
if (!extractionContext) {
|
|
5139
5139
|
return { components: [], warnings: [], exclusions: [] };
|
|
@@ -5147,7 +5147,7 @@ function extractTsxComponents(filePaths, componentFilePattern, extract2) {
|
|
|
5147
5147
|
const sourceFile = project.getSourceFile(filePath);
|
|
5148
5148
|
if (!sourceFile)
|
|
5149
5149
|
continue;
|
|
5150
|
-
components.push(...
|
|
5150
|
+
components.push(...extract(sourceFile, exclusions));
|
|
5151
5151
|
} catch (e) {
|
|
5152
5152
|
warnings.push(`Failed to extract from ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
5153
5153
|
}
|
|
@@ -13756,7 +13756,7 @@ function errorMessage(error) {
|
|
|
13756
13756
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
13757
13757
|
}
|
|
13758
13758
|
function defaultSleep(delayMs) {
|
|
13759
|
-
return new Promise((
|
|
13759
|
+
return new Promise((resolve27) => setTimeout(resolve27, delayMs));
|
|
13760
13760
|
}
|
|
13761
13761
|
|
|
13762
13762
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
|
|
@@ -13997,7 +13997,7 @@ var ApiClient = class {
|
|
|
13997
13997
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
13998
13998
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
13999
13999
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
14000
|
-
await new Promise((
|
|
14000
|
+
await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
|
|
14001
14001
|
}
|
|
14002
14002
|
}
|
|
14003
14003
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -16110,7 +16110,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
16110
16110
|
const message = error instanceof Error ? error.message : String(error);
|
|
16111
16111
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
16112
16112
|
throw error;
|
|
16113
|
-
await new Promise((
|
|
16113
|
+
await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
|
|
16114
16114
|
}
|
|
16115
16115
|
}
|
|
16116
16116
|
}
|
|
@@ -17437,30 +17437,24 @@ function ExtractionScreen({
|
|
|
17437
17437
|
init_config();
|
|
17438
17438
|
|
|
17439
17439
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
17440
|
+
import { join as join21, resolve as resolve24 } from "node:path";
|
|
17440
17441
|
import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
17441
17442
|
|
|
17442
17443
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
17443
|
-
import { mkdir as
|
|
17444
|
-
import { join as
|
|
17445
|
-
|
|
17446
|
-
// packages/experience-design-system-cli/src/tui/import/debug-hooks.ts
|
|
17447
|
-
var realDebugHooks = {
|
|
17448
|
-
setOutDir: async (outDir) => (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).setDebugOutDir(outDir),
|
|
17449
|
-
start: (run) => void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then((m) => m.startDebugRun(run)),
|
|
17450
|
-
finish: async (run) => (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).finishDebugRun(run)
|
|
17451
|
-
};
|
|
17444
|
+
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
17445
|
+
import { join as join19, resolve as resolve22 } from "node:path";
|
|
17452
17446
|
|
|
17453
17447
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
17454
|
-
import { existsSync as
|
|
17455
|
-
import { dirname as dirname14, join as
|
|
17448
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
17449
|
+
import { dirname as dirname14, join as join18, resolve as resolve20 } from "node:path";
|
|
17456
17450
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
17457
17451
|
function findSkillPath(fileName) {
|
|
17458
17452
|
const thisDir = dirname14(fileURLToPath4(import.meta.url));
|
|
17459
17453
|
let dir = thisDir;
|
|
17460
17454
|
for (; ; ) {
|
|
17461
|
-
const candidate =
|
|
17462
|
-
if (
|
|
17463
|
-
const parent =
|
|
17455
|
+
const candidate = join18(dir, "skills", fileName);
|
|
17456
|
+
if (existsSync8(candidate)) return candidate;
|
|
17457
|
+
const parent = resolve20(dir, "..");
|
|
17464
17458
|
if (parent === dir) {
|
|
17465
17459
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
17466
17460
|
}
|
|
@@ -17469,11 +17463,11 @@ function findSkillPath(fileName) {
|
|
|
17469
17463
|
}
|
|
17470
17464
|
|
|
17471
17465
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
17472
|
-
import { resolve as
|
|
17466
|
+
import { resolve as resolve21 } from "node:path";
|
|
17473
17467
|
var SELECT_SKILL_PATH = findSkillPath("select-components.md");
|
|
17474
17468
|
var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
17475
17469
|
async function hashSelectPrompt(options) {
|
|
17476
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
17470
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve21(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
17477
17471
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
17478
17472
|
}
|
|
17479
17473
|
async function runSelection(options) {
|
|
@@ -17563,32 +17557,12 @@ var realDeps = {
|
|
|
17563
17557
|
fetchEntities,
|
|
17564
17558
|
runExtractAndComposeSession,
|
|
17565
17559
|
runGenerateTokensSession,
|
|
17566
|
-
runSelection
|
|
17567
|
-
debug: realDebugHooks
|
|
17560
|
+
runSelection
|
|
17568
17561
|
};
|
|
17569
17562
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
17570
17563
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
17571
17564
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
17572
|
-
const outDir =
|
|
17573
|
-
await deps.debug?.setOutDir(outDir);
|
|
17574
|
-
deps.debug?.start({
|
|
17575
|
-
flow: "import",
|
|
17576
|
-
step: "06-extraction",
|
|
17577
|
-
menuOption: "Import",
|
|
17578
|
-
inputs: {
|
|
17579
|
-
projectPath: input.projectPath,
|
|
17580
|
-
agent: input.agent,
|
|
17581
|
-
files: input.filePaths.length,
|
|
17582
|
-
noCache: input.noCache
|
|
17583
|
-
}
|
|
17584
|
-
});
|
|
17585
|
-
const result = await extract(input, outDir, onProgress, deps);
|
|
17586
|
-
await deps.debug?.finish(
|
|
17587
|
-
result.ok ? { outputs: { sessionId: result.extraction.sessionId, outDir }, status: "success", exitMethod: "saved" } : { outputs: { step: result.step, message: result.message }, status: "error", exitMethod: "discarded" }
|
|
17588
|
-
);
|
|
17589
|
-
return result;
|
|
17590
|
-
}
|
|
17591
|
-
async function extract(input, outDir, onProgress, deps) {
|
|
17565
|
+
const outDir = join19(resolve22(input.projectPath), ".contentful");
|
|
17592
17566
|
let progress = initialProgress({
|
|
17593
17567
|
hasCredentials: input.credentials !== null,
|
|
17594
17568
|
hasRawTokens: input.rawTokensPath !== "",
|
|
@@ -17683,7 +17657,7 @@ async function extract(input, outDir, onProgress, deps) {
|
|
|
17683
17657
|
const extraction = {
|
|
17684
17658
|
sessionId: extracted.sessionId,
|
|
17685
17659
|
outDir,
|
|
17686
|
-
tokensPath: tokens?.ok ? tokens.tokensPath : hasTokenSource ?
|
|
17660
|
+
tokensPath: tokens?.ok ? tokens.tokensPath : hasTokenSource ? join19(outDir, "tokens.json") : "",
|
|
17687
17661
|
tokenSessionId: tokens?.ok ? tokens.tokenSessionId : null,
|
|
17688
17662
|
tokenCount: tokens?.ok ? tokens.tokenCount : 0,
|
|
17689
17663
|
existingEntitiesPath,
|
|
@@ -17694,7 +17668,7 @@ async function extract(input, outDir, onProgress, deps) {
|
|
|
17694
17668
|
}
|
|
17695
17669
|
async function fetchEntities(credentials, outDir) {
|
|
17696
17670
|
try {
|
|
17697
|
-
await
|
|
17671
|
+
await mkdir7(outDir, { recursive: true });
|
|
17698
17672
|
const result = await fetchAndPersistExistingContentfulEntities({
|
|
17699
17673
|
spaceId: credentials.spaceId,
|
|
17700
17674
|
environmentId: credentials.environmentId,
|
|
@@ -17714,7 +17688,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
17714
17688
|
if (select?.kind === "text") return { promptText: select.value };
|
|
17715
17689
|
if (select?.kind === "path") {
|
|
17716
17690
|
await resolvePromptOverride(select);
|
|
17717
|
-
return { promptPath:
|
|
17691
|
+
return { promptPath: resolve22(select.value) };
|
|
17718
17692
|
}
|
|
17719
17693
|
return {};
|
|
17720
17694
|
}
|
|
@@ -17737,6 +17711,9 @@ function useExtraction(input) {
|
|
|
17737
17711
|
reuseTokens: input.tokenStrategy === "reuse"
|
|
17738
17712
|
})
|
|
17739
17713
|
});
|
|
17714
|
+
void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then(
|
|
17715
|
+
(store) => store.setDebugOutDir(join21(resolve24(input.projectPath), ".contentful"))
|
|
17716
|
+
);
|
|
17740
17717
|
void runExtraction(input, (progress) => {
|
|
17741
17718
|
if (current.current === input) setState({ status: "running", progress });
|
|
17742
17719
|
}).then((result) => {
|
|
@@ -20623,7 +20600,7 @@ function GenerationScreen({
|
|
|
20623
20600
|
import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
|
|
20624
20601
|
|
|
20625
20602
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
20626
|
-
import { resolve as
|
|
20603
|
+
import { resolve as resolve25 } from "node:path";
|
|
20627
20604
|
|
|
20628
20605
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
|
|
20629
20606
|
async function prepareMapTokens(input, generatedSessionId) {
|
|
@@ -20758,7 +20735,7 @@ async function buildMapTokensOptions(input) {
|
|
|
20758
20735
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
20759
20736
|
if (mapOverride?.kind === "path") {
|
|
20760
20737
|
await resolvePromptOverride(mapOverride);
|
|
20761
|
-
prompt.skillPathOverride =
|
|
20738
|
+
prompt.skillPathOverride = resolve25(mapOverride.value);
|
|
20762
20739
|
}
|
|
20763
20740
|
if (input.existingEntitiesPath) {
|
|
20764
20741
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -20806,7 +20783,7 @@ function useGeneration(input) {
|
|
|
20806
20783
|
}
|
|
20807
20784
|
|
|
20808
20785
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
20809
|
-
import { join as
|
|
20786
|
+
import { join as join22 } from "node:path";
|
|
20810
20787
|
function buildFlowStart(input) {
|
|
20811
20788
|
const { extraction, handoff, saved, generatePromptPath } = input;
|
|
20812
20789
|
const credentials = extraction.credentials ?? {
|
|
@@ -20819,7 +20796,7 @@ function buildFlowStart(input) {
|
|
|
20819
20796
|
handoff,
|
|
20820
20797
|
agent: extraction.agent,
|
|
20821
20798
|
projectPath: extraction.projectPath,
|
|
20822
|
-
outDir: extraction.projectPath ?
|
|
20799
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
20823
20800
|
rawTokensPath: extraction.rawTokensPath,
|
|
20824
20801
|
credentials: {
|
|
20825
20802
|
spaceId: credentials.spaceId,
|
|
@@ -26563,10 +26540,10 @@ function DoneStep({
|
|
|
26563
26540
|
import { useState as useState24 } from "react";
|
|
26564
26541
|
import { Box as Box37, Text as Text40 } from "ink";
|
|
26565
26542
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
26566
|
-
import { dirname as dirname15, basename as basename6, join as
|
|
26543
|
+
import { dirname as dirname15, basename as basename6, join as join23 } from "node:path";
|
|
26567
26544
|
|
|
26568
26545
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
26569
|
-
import { resolve as
|
|
26546
|
+
import { resolve as resolve26 } from "node:path";
|
|
26570
26547
|
import { homedir as homedir4 } from "node:os";
|
|
26571
26548
|
function expandTilde(input) {
|
|
26572
26549
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -26580,7 +26557,7 @@ function normalizePath(input) {
|
|
|
26580
26557
|
p = p.slice(1, -1);
|
|
26581
26558
|
}
|
|
26582
26559
|
p = expandTilde(p);
|
|
26583
|
-
return
|
|
26560
|
+
return resolve26(p);
|
|
26584
26561
|
}
|
|
26585
26562
|
|
|
26586
26563
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
@@ -26609,13 +26586,13 @@ function autocomplete(partial) {
|
|
|
26609
26586
|
}
|
|
26610
26587
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
26611
26588
|
if (matches.length === 0) return null;
|
|
26612
|
-
if (matches.length === 1) return
|
|
26589
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
26613
26590
|
let prefix = matches[0];
|
|
26614
26591
|
for (const m of matches) {
|
|
26615
26592
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
26616
26593
|
if (!prefix) break;
|
|
26617
26594
|
}
|
|
26618
|
-
return prefix.length > base.length ?
|
|
26595
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
26619
26596
|
}
|
|
26620
26597
|
function PathPrompt({
|
|
26621
26598
|
defaultPath,
|
|
@@ -27376,7 +27353,7 @@ import { useEffect as useEffect21, useRef as useRef13, useSyncExternalStore } fr
|
|
|
27376
27353
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
27377
27354
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
27378
27355
|
import { tmpdir } from "node:os";
|
|
27379
|
-
import { join as
|
|
27356
|
+
import { join as join25 } from "node:path";
|
|
27380
27357
|
|
|
27381
27358
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
27382
27359
|
function shouldBypassPreview(state) {
|
|
@@ -27721,7 +27698,7 @@ function pushFailure(e, deps) {
|
|
|
27721
27698
|
|
|
27722
27699
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
27723
27700
|
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
27724
|
-
import { join as
|
|
27701
|
+
import { join as join24 } from "node:path";
|
|
27725
27702
|
|
|
27726
27703
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
27727
27704
|
function nextStateAfterPrint(opts) {
|
|
@@ -27747,12 +27724,12 @@ var realSaveDeps = () => ({
|
|
|
27747
27724
|
writeFile: (path5, contents) => writeFile8(path5, contents),
|
|
27748
27725
|
appendRun,
|
|
27749
27726
|
buildSourceFingerprint,
|
|
27750
|
-
sleep: (ms) => new Promise((
|
|
27727
|
+
sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
|
|
27751
27728
|
warn: (message) => process.stderr.write(message)
|
|
27752
27729
|
});
|
|
27753
27730
|
async function runPrintFiles(input, deps, onPatch) {
|
|
27754
27731
|
onPatch({ step: "printing" });
|
|
27755
|
-
const componentsPath =
|
|
27732
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
27756
27733
|
try {
|
|
27757
27734
|
const db = deps.openDb();
|
|
27758
27735
|
let components = [];
|
|
@@ -27833,7 +27810,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
27833
27810
|
};
|
|
27834
27811
|
|
|
27835
27812
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
27836
|
-
var WIZARD_LOG =
|
|
27813
|
+
var WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
27837
27814
|
function appendWizardLog(entry) {
|
|
27838
27815
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
27839
27816
|
}
|
|
@@ -27862,8 +27839,7 @@ function realFlowDeps() {
|
|
|
27862
27839
|
buildTimestampedSubdir,
|
|
27863
27840
|
rejectComponentsByName,
|
|
27864
27841
|
log,
|
|
27865
|
-
stderr: (text) => process.stderr.write(text)
|
|
27866
|
-
debug: realDebugHooks
|
|
27842
|
+
stderr: (text) => process.stderr.write(text)
|
|
27867
27843
|
};
|
|
27868
27844
|
}
|
|
27869
27845
|
function initialFlowState(start) {
|
|
@@ -28007,13 +27983,6 @@ function createFlowController(start, deps) {
|
|
|
28007
27983
|
};
|
|
28008
27984
|
const proceedToWrite = async (path5) => {
|
|
28009
27985
|
update({ outDir: path5 });
|
|
28010
|
-
await deps.debug?.setOutDir(path5);
|
|
28011
|
-
deps.debug?.start({
|
|
28012
|
-
flow: "import",
|
|
28013
|
-
step: "10-flow",
|
|
28014
|
-
menuOption: "Save",
|
|
28015
|
-
inputs: { outDir: path5, extractSessionId: state.extractSessionId, andPush: !!pendingSave.andPush }
|
|
28016
|
-
});
|
|
28017
27986
|
const { skipGate, andPush } = pendingSave;
|
|
28018
27987
|
const written = await runPrintFiles(
|
|
28019
27988
|
{
|
|
@@ -28028,9 +27997,6 @@ function createFlowController(start, deps) {
|
|
|
28028
27997
|
update
|
|
28029
27998
|
);
|
|
28030
27999
|
update(written.patch);
|
|
28031
|
-
await deps.debug?.finish(
|
|
28032
|
-
written.ok ? { outputs: { componentsPath: join24(path5, "components.json") }, status: "success", exitMethod: "saved" } : { outputs: { error: written.patch.errorMessage ?? "unknown" }, status: "error", exitMethod: "discarded" }
|
|
28033
|
-
);
|
|
28034
28000
|
if (!written.ok) return;
|
|
28035
28001
|
const runId = await recordRun({ state, savePath: path5 }, deps.save);
|
|
28036
28002
|
if (runId) update({ lastRunId: runId });
|
|
@@ -28144,8 +28110,7 @@ async function readHelpInfo() {
|
|
|
28144
28110
|
storage: [
|
|
28145
28111
|
{ label: "Config folder", value: configRoot2() },
|
|
28146
28112
|
{ label: "Settings file", value: configFilePath2() },
|
|
28147
|
-
{ label: "Debug logs", value: "<project>/.contentful/debug/sessions, next to components.json" }
|
|
28148
|
-
{ label: "No project", value: `${debugSessionsDir2()} (sessions that never pick a project)` }
|
|
28113
|
+
{ label: "Debug logs", value: "<project>/.contentful/debug/sessions, next to components.json" }
|
|
28149
28114
|
],
|
|
28150
28115
|
troubleshooting: [
|
|
28151
28116
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -28730,7 +28695,7 @@ function App({ importOptions, inkClear }) {
|
|
|
28730
28695
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
28731
28696
|
const state = await inspectTokens({
|
|
28732
28697
|
rawTokensPath: tokens,
|
|
28733
|
-
outDir:
|
|
28698
|
+
outDir: join26(resolveUserPath(projectPath2), ".contentful"),
|
|
28734
28699
|
cache: importOptions.cache
|
|
28735
28700
|
});
|
|
28736
28701
|
if (state.kind === "cached") {
|