@contentful/experience-design-system-cli 2.35.1-dev-build-925d6206.0 → 2.35.1-dev-build-392cfefa.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/bin/cli.js +1 -1
- package/dist/package.json +1 -1
- package/legacy/bin/cli.js +23 -19
- package/legacy/dist/src/analyze/controller/create-analyze-extract-endpoint.d.ts +13 -0
- package/legacy/dist/src/analyze/helpers/resolve-composition-agent.d.ts +9 -0
- package/legacy/dist/src/analyze/helpers/resolve-no-cache.d.ts +4 -0
- package/legacy/dist/src/analyze/helpers/resolve-unreachable-mode.d.ts +1 -0
- package/legacy/dist/src/analyze/helpers/retry-db-write.d.ts +1 -0
- package/legacy/dist/src/analyze/orchestrator/execute-analyze-extract.d.ts +21 -0
- package/legacy/dist/src/analyze/services/collect-source-files.d.ts +1 -0
- package/legacy/dist/src/analyze/services/extract-with-cache.d.ts +17 -0
- package/legacy/dist/src/analyze/services/persist-extract-results.d.ts +11 -0
- package/legacy/dist/src/analyze/services/resolve-composition-mapping.d.ts +22 -0
- package/legacy/dist/src/analyze/services/resolve-source-directory.d.ts +1 -0
- package/legacy/dist/src/apply/command.d.ts +3 -41
- package/legacy/dist/src/apply/controller/run-apply.d.ts +1 -0
- package/legacy/dist/src/apply/helpers/build-apply-output.d.ts +55 -0
- package/legacy/dist/src/apply/helpers/has-breaking-changes.d.ts +2 -0
- package/legacy/dist/src/apply/helpers/poll-apply-operation.d.ts +9 -0
- package/legacy/dist/src/apply/helpers/read-token-files.d.ts +7 -0
- package/legacy/dist/src/apply/helpers/slot-validation.d.ts +20 -0
- package/legacy/dist/src/apply/services/apply-interactive.d.ts +13 -0
- package/legacy/dist/src/apply/services/apply-non-interactive.d.ts +10 -0
- package/legacy/dist/src/apply/services/resolve-apply-inputs.d.ts +14 -0
- package/legacy/dist/src/generate/command.d.ts +18 -0
- package/legacy/dist/src/generate/controller/run-generate-components.d.ts +2 -0
- package/legacy/dist/src/generate/controller/run-generate-tokens.d.ts +2 -0
- package/legacy/dist/src/generate/helpers/assert-file-exists.d.ts +1 -0
- package/legacy/dist/src/generate/helpers/normalize-component-for-cache.d.ts +6 -0
- package/legacy/dist/src/generate/helpers/parse-precomputed-cached-names.d.ts +1 -0
- package/legacy/dist/src/generate/helpers/print-fallback-instructions.d.ts +6 -0
- package/legacy/dist/src/generate/helpers/read-file-inline.d.ts +1 -0
- package/legacy/dist/src/generate/services/invoke-all-component-agents.d.ts +6 -0
- package/legacy/dist/src/generate/services/invoke-component-agent.d.ts +36 -0
- package/legacy/dist/src/generate/services/load-accepted-names.d.ts +1 -0
- package/legacy/dist/src/generate/services/resolve-component-cache.d.ts +13 -0
- package/legacy/dist/src/generate/services/resolve-generate-agent.d.ts +9 -0
- package/legacy/dist/src/generate/services/show-generate-view.d.ts +2 -0
- package/legacy/dist/src/generate/services/verify-agent-binary.d.ts +2 -0
- package/legacy/dist/src/import/tui/ai-flag.d.ts +1 -0
- package/legacy/dist/src/import/tui/steps/ScopeGateStep.d.ts +1 -0
- package/legacy/dist/src/index.js +29367 -29158
- package/legacy/dist/src/lib/pluralize.d.ts +1 -0
- package/legacy/dist/src/map-tokens/controller/run-map-tokens.d.ts +12 -0
- package/legacy/dist/src/map-tokens/services/render-map-tokens-result.d.ts +2 -0
- package/legacy/dist/src/map-tokens/services/resolve-token-name-paths.d.ts +8 -0
- package/legacy/dist/src/session/db.d.ts +1 -2
- package/legacy/package.json +1 -1
- package/legacy/skills/select-components.md +8 -43
- package/package.json +2 -2
- package/legacy/dist/src/analyze/extract-command.d.ts +0 -7
package/bin/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
await import(
|
|
2
|
+
await import("../dist/index.js");
|
package/dist/package.json
CHANGED
package/legacy/bin/cli.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Suppress the SQLite ExperimentalWarning before any modules load.
|
|
3
3
|
// Must use dynamic import so this handler registers before sqlite is imported.
|
|
4
|
-
process.removeAllListeners(
|
|
5
|
-
process.on(
|
|
6
|
-
if (w.name ===
|
|
4
|
+
process.removeAllListeners("warning");
|
|
5
|
+
process.on("warning", (w) => {
|
|
6
|
+
if (w.name === "ExperimentalWarning" && w.message.includes("SQLite")) return;
|
|
7
7
|
process.stderr.write(`${w.name}: ${w.message}\n`);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
// Auto-rebuild when running from source (dev mode only).
|
|
11
11
|
// Skipped when src/ doesn't exist (e.g. npm-installed users).
|
|
12
|
-
import { existsSync, statSync, readdirSync } from
|
|
13
|
-
import { execFileSync } from
|
|
14
|
-
import { fileURLToPath } from
|
|
15
|
-
import { dirname, resolve, join } from
|
|
12
|
+
import { existsSync, statSync, readdirSync } from "node:fs";
|
|
13
|
+
import { execFileSync } from "node:child_process";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
import { dirname, resolve, join } from "node:path";
|
|
16
16
|
|
|
17
17
|
function newestMtime(dir, depth = 0) {
|
|
18
18
|
if (depth > 10) return 0;
|
|
@@ -22,7 +22,7 @@ function newestMtime(dir, depth = 0) {
|
|
|
22
22
|
const full = join(dir, entry.name);
|
|
23
23
|
if (entry.isDirectory()) {
|
|
24
24
|
max = Math.max(max, newestMtime(full, depth + 1));
|
|
25
|
-
} else if (entry.name.endsWith(
|
|
25
|
+
} else if (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx")) {
|
|
26
26
|
max = Math.max(max, statSync(full).mtimeMs);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -30,25 +30,29 @@ function newestMtime(dir, depth = 0) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
33
|
-
const pkgRoot = resolve(__dirname,
|
|
34
|
-
const srcDir = join(pkgRoot,
|
|
35
|
-
const distEntry = join(pkgRoot,
|
|
33
|
+
const pkgRoot = resolve(__dirname, "..");
|
|
34
|
+
const srcDir = join(pkgRoot, "src");
|
|
35
|
+
const distEntry = join(pkgRoot, "dist", "src", "index.js");
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (
|
|
38
|
+
existsSync(srcDir) &&
|
|
39
|
+
existsSync(distEntry) &&
|
|
40
|
+
process.env.NODE_ENV !== "test"
|
|
41
|
+
) {
|
|
38
42
|
const distMtime = statSync(distEntry).mtimeMs;
|
|
39
43
|
if (newestMtime(srcDir) > distMtime) {
|
|
40
|
-
process.stderr.write(
|
|
41
|
-
const tsc = join(pkgRoot,
|
|
44
|
+
process.stderr.write("⚙ Source changed — rebuilding...\n");
|
|
45
|
+
const tsc = join(pkgRoot, "node_modules", ".bin", "tsc");
|
|
42
46
|
try {
|
|
43
|
-
execFileSync(tsc, [
|
|
44
|
-
stdio: [
|
|
47
|
+
execFileSync(tsc, ["-p", join(pkgRoot, "tsconfig.build.json")], {
|
|
48
|
+
stdio: ["ignore", "ignore", "inherit"],
|
|
45
49
|
cwd: pkgRoot,
|
|
46
50
|
});
|
|
47
|
-
process.stderr.write(
|
|
51
|
+
process.stderr.write("✓ Build complete\n");
|
|
48
52
|
} catch {
|
|
49
|
-
process.stderr.write(
|
|
53
|
+
process.stderr.write("✗ Build failed — running with existing dist\n");
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
await import(
|
|
58
|
+
await import("../dist/src/index.js");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AnalyzeExtractOrchestratorResult } from '../orchestrator/execute-analyze-extract.js';
|
|
2
|
+
export interface AnalyzeExtractEndpointRequest {
|
|
3
|
+
projectPath: string;
|
|
4
|
+
agent?: string;
|
|
5
|
+
noCache: boolean;
|
|
6
|
+
promptOverrides?: string[];
|
|
7
|
+
bedrock?: boolean;
|
|
8
|
+
onScanProgress?: (count: number) => void;
|
|
9
|
+
onCompositionProgress?: (phase: string) => void;
|
|
10
|
+
onSessionCreated?: (sessionId: string) => Promise<void> | void;
|
|
11
|
+
}
|
|
12
|
+
export type AnalyzeExtractEndpointResponse = AnalyzeExtractOrchestratorResult;
|
|
13
|
+
export declare function analyzeExtractEndpoint(request: AnalyzeExtractEndpointRequest): Promise<AnalyzeExtractEndpointResponse>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentName } from '@contentful/experience-design-system-generation';
|
|
2
|
+
export declare function resolveCompositionAgentName(flagValue?: string): AgentName;
|
|
3
|
+
export declare function readCandidateFiles(components: Array<{
|
|
4
|
+
sourcePath?: string;
|
|
5
|
+
source?: string;
|
|
6
|
+
}>, extraFiles?: string[]): Promise<Array<{
|
|
7
|
+
path: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveUnreachableMode(value: string | undefined): 'auto' | 'always' | 'never';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function retryDatabaseWrite<T>(operation: () => T, attempts?: number): Promise<T>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AgentName } from '@contentful/experience-design-system-generation';
|
|
2
|
+
export interface AnalyzeExtractOrchestratorRequest {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
sourceDirectory: string;
|
|
5
|
+
outDir: string;
|
|
6
|
+
noCache: boolean;
|
|
7
|
+
forceAgent: boolean;
|
|
8
|
+
agent: AgentName;
|
|
9
|
+
compositionPrompt?: string;
|
|
10
|
+
resolveUnreachable: 'auto' | 'always' | 'never';
|
|
11
|
+
onScanProgress?: (count: number) => void;
|
|
12
|
+
onCompositionProgress?: (phase: string) => void;
|
|
13
|
+
onSessionCreated?: (sessionId: string) => void | Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface AnalyzeExtractOrchestratorResult {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
sourceFileCount: number;
|
|
18
|
+
componentCount: number;
|
|
19
|
+
warnings: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function executeAnalyzeExtractOrchestrator(request: AnalyzeExtractOrchestratorRequest): Promise<AnalyzeExtractOrchestratorResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function collectSourceFiles(directory: string, onProgress?: (scannedCount: number) => void): Promise<string[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
+
import type { openPipelineDb } from '../../session/db.js';
|
|
3
|
+
export interface ExtractionWithCacheOptions {
|
|
4
|
+
db: ReturnType<typeof openPipelineDb>;
|
|
5
|
+
sourceFiles: string[];
|
|
6
|
+
noCache: boolean;
|
|
7
|
+
resolveUnreachable?: 'auto' | 'always' | 'never';
|
|
8
|
+
projectRoot?: string;
|
|
9
|
+
cacheVersion: string;
|
|
10
|
+
onProgress?: (filesProcessed: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface ExtractionWithCacheResult {
|
|
13
|
+
components: RawComponentDefinition[];
|
|
14
|
+
warnings: string[];
|
|
15
|
+
cacheHits: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function runExtractionWithCache(options: ExtractionWithCacheOptions): Promise<ExtractionWithCacheResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
+
import type { openPipelineDb } from '../../session/db.js';
|
|
3
|
+
export interface PersistExtractResultsOptions {
|
|
4
|
+
db: ReturnType<typeof openPipelineDb>;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
stepId: number;
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
sourceFiles: string[];
|
|
9
|
+
components: RawComponentDefinition[];
|
|
10
|
+
}
|
|
11
|
+
export declare function persistExtractResults(options: PersistExtractResultsOptions): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentName } from '@contentful/experience-design-system-generation';
|
|
2
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
3
|
+
import type { openPipelineDb } from '../../session/db.js';
|
|
4
|
+
export interface CompositionMappingOptions {
|
|
5
|
+
db: ReturnType<typeof openPipelineDb>;
|
|
6
|
+
components: RawComponentDefinition[];
|
|
7
|
+
allFiles: Array<{
|
|
8
|
+
path: string;
|
|
9
|
+
content: string;
|
|
10
|
+
}>;
|
|
11
|
+
noCache: boolean;
|
|
12
|
+
forceAgent: boolean;
|
|
13
|
+
agent: AgentName;
|
|
14
|
+
promptOverride?: string;
|
|
15
|
+
cacheVersion: string;
|
|
16
|
+
onProgress?: (phase: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CompositionMappingResult {
|
|
19
|
+
components: RawComponentDefinition[];
|
|
20
|
+
warnings: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveCompositionMapping(options: CompositionMappingOptions): Promise<CompositionMappingResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveSourceDirectory(projectRoot: string, dir: string | undefined): Promise<string>;
|
|
@@ -1,43 +1,5 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function readTokensFromPath(flag: string, p: string): Promise<DTCGTokenEntry[]>;
|
|
6
|
-
/** Adapts flat DTCGTokenEntry[] (path alongside the leaf) into the
|
|
7
|
-
* {path, entry} pairs buildCDF/buildFilteredCDF expect. */
|
|
8
|
-
export declare function toCDFTokens(tokens: DTCGTokenEntry[]): Array<{
|
|
9
|
-
path: string;
|
|
10
|
-
entry: CDFTokenEntry;
|
|
11
|
-
}>;
|
|
12
|
-
export declare function detectSlotCycles(components: Array<{
|
|
13
|
-
key: string;
|
|
14
|
-
entry: CDFComponentEntry;
|
|
15
|
-
}>): ReturnType<typeof findSlotCycles>;
|
|
16
|
-
export declare function formatSlotCycleReport(cycles: ReturnType<typeof findSlotCycles>): string[];
|
|
17
|
-
export declare function assertNoSlotCycles(components: Array<{
|
|
18
|
-
key: string;
|
|
19
|
-
entry: CDFComponentEntry;
|
|
20
|
-
}>): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Client-side pre-flight for `$allowedComponents` references that are absent
|
|
23
|
-
* from this document, so a typo'd or renamed reference fails fast instead of
|
|
24
|
-
* waiting on the `previewImport`/`applyImport` round-trip. Only catches
|
|
25
|
-
* document-internal misses — a name that resolves against an *existing*
|
|
26
|
-
* target-environment Component still needs the network round-trip to
|
|
27
|
-
* confirm, so this cannot replace the server-side check.
|
|
28
|
-
*
|
|
29
|
-
* `validateSlotReferences` is the detection step (shared with
|
|
30
|
-
* `WizardApp.tsx` via `formatUnresolvedSlotReferences` below, mirroring how
|
|
31
|
-
* `detectSlotCycles`/`formatSlotCycleReport` split for the cycle check).
|
|
32
|
-
*/
|
|
33
|
-
export declare function formatUnresolvedSlotReferences(errors: CDFValidationError[]): string[];
|
|
34
|
-
export declare function assertNoUnresolvedSlotReferences(components: Array<{
|
|
35
|
-
key: string;
|
|
36
|
-
entry: CDFComponentEntry;
|
|
37
|
-
}>): Promise<void>;
|
|
38
|
-
export declare function extractComponents(cdf: Record<string, unknown> | null | undefined): Array<{
|
|
39
|
-
key: string;
|
|
40
|
-
entry: CDFComponentEntry;
|
|
41
|
-
}>;
|
|
42
|
-
export declare function hasBreakingChangesWithImpact(preview: ServerPreviewResponse): boolean;
|
|
2
|
+
export { readTokensFromPath, toCDFTokens } from './helpers/read-token-files.js';
|
|
3
|
+
export { detectSlotCycles, formatSlotCycleReport, assertNoSlotCycles, formatUnresolvedSlotReferences, assertNoUnresolvedSlotReferences, extractComponents, } from './helpers/slot-validation.js';
|
|
4
|
+
export { hasBreakingChangesWithImpact } from './helpers/has-breaking-changes.js';
|
|
43
5
|
export declare function registerApplyCommand(program: Command): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runApply(file: string): Promise<void>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ApplyOperationResponse, ServerPreviewResponse } from '@contentful/experience-design-system-types';
|
|
2
|
+
export declare function buildPreviewOutput(preview: ServerPreviewResponse, spaceId: string, environmentId: string): {
|
|
3
|
+
spaceId: string;
|
|
4
|
+
environmentId: string;
|
|
5
|
+
components: {
|
|
6
|
+
new: number;
|
|
7
|
+
changed: number;
|
|
8
|
+
unchanged: number;
|
|
9
|
+
removed: number;
|
|
10
|
+
breaking: number;
|
|
11
|
+
draftOverwrites: number;
|
|
12
|
+
};
|
|
13
|
+
tokens: {
|
|
14
|
+
new: number;
|
|
15
|
+
changed: number;
|
|
16
|
+
unchanged: number;
|
|
17
|
+
removed: number;
|
|
18
|
+
draftOverwrites: number;
|
|
19
|
+
};
|
|
20
|
+
taxonomies: {
|
|
21
|
+
new: number;
|
|
22
|
+
changed: number;
|
|
23
|
+
unchanged: number;
|
|
24
|
+
removed: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare function buildApplyOutput(operation: ApplyOperationResponse, spaceId: string, environmentId: string, host: string | undefined): {
|
|
28
|
+
status: import("@contentful/experience-design-system-types").ApplyOperationStatus;
|
|
29
|
+
operationId: string;
|
|
30
|
+
spaceId: string;
|
|
31
|
+
environmentId: string;
|
|
32
|
+
summary: {
|
|
33
|
+
total: number;
|
|
34
|
+
pending: number;
|
|
35
|
+
succeeded: number;
|
|
36
|
+
failed: number;
|
|
37
|
+
};
|
|
38
|
+
componentTypes: {
|
|
39
|
+
created: number;
|
|
40
|
+
updated: number;
|
|
41
|
+
failed: number;
|
|
42
|
+
};
|
|
43
|
+
designTokens: {
|
|
44
|
+
created: number;
|
|
45
|
+
updated: number;
|
|
46
|
+
failed: number;
|
|
47
|
+
};
|
|
48
|
+
viewUrl: string;
|
|
49
|
+
tokensUrl: string;
|
|
50
|
+
failures: {
|
|
51
|
+
entityType: "ComponentType" | "DesignToken";
|
|
52
|
+
entityId: string;
|
|
53
|
+
error: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApiError, ImportApiClient } from '../api-client.js';
|
|
2
|
+
import type { ApplyOperationResponse } from '@contentful/experience-design-system-types';
|
|
3
|
+
export interface PollApplyOptions {
|
|
4
|
+
acknowledgeBreakingChanges: boolean;
|
|
5
|
+
onProgress?: (status: 'applying' | 'polling', operationId?: string) => void;
|
|
6
|
+
onStarted?: (operationId: string) => void;
|
|
7
|
+
onApiError: (error: ApiError) => Promise<void> | void;
|
|
8
|
+
}
|
|
9
|
+
export declare function pollApplyOperation(client: ImportApiClient, cdf: Parameters<ImportApiClient['applyImport']>[0], options: PollApplyOptions): Promise<ApplyOperationResponse | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CDFTokenEntry, DTCGTokenEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
export declare function readJsonFile(flag: string, p: string): Promise<unknown>;
|
|
3
|
+
export declare function readTokensFromPath(flag: string, p: string): Promise<DTCGTokenEntry[]>;
|
|
4
|
+
export declare function toCDFTokens(tokens: DTCGTokenEntry[]): Array<{
|
|
5
|
+
path: string;
|
|
6
|
+
entry: CDFTokenEntry;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CDFComponentEntry, CDFValidationError } from '@contentful/experience-design-system-types';
|
|
2
|
+
import { findSlotCycles } from '../../analyze/cycle-detection.js';
|
|
3
|
+
export declare function detectSlotCycles(components: Array<{
|
|
4
|
+
key: string;
|
|
5
|
+
entry: CDFComponentEntry;
|
|
6
|
+
}>): ReturnType<typeof findSlotCycles>;
|
|
7
|
+
export declare function formatSlotCycleReport(cycles: ReturnType<typeof findSlotCycles>): string[];
|
|
8
|
+
export declare function assertNoSlotCycles(components: Array<{
|
|
9
|
+
key: string;
|
|
10
|
+
entry: CDFComponentEntry;
|
|
11
|
+
}>): Promise<void>;
|
|
12
|
+
export declare function formatUnresolvedSlotReferences(errors: CDFValidationError[]): string[];
|
|
13
|
+
export declare function assertNoUnresolvedSlotReferences(components: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
entry: CDFComponentEntry;
|
|
16
|
+
}>): Promise<void>;
|
|
17
|
+
export declare function extractComponents(cdf: Record<string, unknown> | null | undefined): Array<{
|
|
18
|
+
key: string;
|
|
19
|
+
entry: CDFComponentEntry;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ImportApiClient } from '../api-client.js';
|
|
3
|
+
export interface ApplyInteractiveOptions {
|
|
4
|
+
client: ImportApiClient;
|
|
5
|
+
cdf: Parameters<ImportApiClient['applyImport']>[0];
|
|
6
|
+
spaceId: string;
|
|
7
|
+
environmentId: string;
|
|
8
|
+
host?: string;
|
|
9
|
+
acknowledgeBreakingChanges: boolean;
|
|
10
|
+
rerender: (element: React.ReactElement) => void;
|
|
11
|
+
onDone: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function applyInteractive(options: ApplyInteractiveOptions): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImportApiClient } from '../api-client.js';
|
|
2
|
+
export interface ApplyNonInteractiveOptions {
|
|
3
|
+
client: ImportApiClient;
|
|
4
|
+
cdf: Parameters<ImportApiClient['applyImport']>[0];
|
|
5
|
+
spaceId: string;
|
|
6
|
+
environmentId: string;
|
|
7
|
+
host?: string;
|
|
8
|
+
acknowledgeBreakingChanges: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function applyNonInteractive(options: ApplyNonInteractiveOptions): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CDFComponentEntry, DTCGTokenEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
import { ImportApiClient } from '../api-client.js';
|
|
3
|
+
export interface ApplyInputs {
|
|
4
|
+
components: Array<{
|
|
5
|
+
key: string;
|
|
6
|
+
entry: CDFComponentEntry;
|
|
7
|
+
}>;
|
|
8
|
+
tokens: DTCGTokenEntry[];
|
|
9
|
+
client: ImportApiClient;
|
|
10
|
+
spaceId: string;
|
|
11
|
+
environmentId: string;
|
|
12
|
+
host?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveApplyInputsOrDie(file: string): Promise<ApplyInputs>;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
+
export interface GenerateSubcommandOptions {
|
|
3
|
+
agent?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
bedrock?: boolean;
|
|
6
|
+
session?: string;
|
|
7
|
+
rawTokens?: string;
|
|
8
|
+
tokens?: string;
|
|
9
|
+
tokenMap?: string;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
cache?: boolean;
|
|
13
|
+
generatePromptPath?: string;
|
|
14
|
+
prompt?: string[];
|
|
15
|
+
existingEntitiesPath?: string;
|
|
16
|
+
cacheStatus?: boolean;
|
|
17
|
+
restoreCache?: boolean;
|
|
18
|
+
cachedComponents?: string;
|
|
19
|
+
}
|
|
2
20
|
export declare function registerInternalGenerateCommand(program: Command): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertFileExists(flag: string, p: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parsePrecomputedCachedNames(value: string | undefined): Set<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readFileInline(path: string | undefined): Promise<string | undefined>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
+
import type { ComponentAgentOptions, ComponentRunResult } from './invoke-component-agent.js';
|
|
3
|
+
export type { ComponentAgentOptions, ComponentRunResult };
|
|
4
|
+
export declare function invokeAllComponentAgents(options: ComponentAgentOptions, components: Array<RawComponentDefinition & {
|
|
5
|
+
component_id: string;
|
|
6
|
+
}>): Promise<ComponentRunResult[]>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AgentInvoker, AgentName } from '@contentful/experience-design-system-generation';
|
|
2
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
3
|
+
import type { openPipelineDb } from '../../session/db.js';
|
|
4
|
+
import type { ExistingContentfulEntities } from '../../helpers/fetch-existing-contentful-entities.js';
|
|
5
|
+
export interface ComponentRunResult {
|
|
6
|
+
componentName: string;
|
|
7
|
+
classified: number;
|
|
8
|
+
excluded: number;
|
|
9
|
+
slots: number;
|
|
10
|
+
warnings: string[];
|
|
11
|
+
failed: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
cached?: boolean;
|
|
14
|
+
renamedSlotsCount: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ComponentAgentOptions {
|
|
17
|
+
agent: AgentName;
|
|
18
|
+
model: string | undefined;
|
|
19
|
+
invoker: AgentInvoker;
|
|
20
|
+
db: ReturnType<typeof openPipelineDb>;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
tokensInline: string | undefined;
|
|
23
|
+
tokenMapInline: string | undefined;
|
|
24
|
+
verbose: boolean;
|
|
25
|
+
noCache: boolean;
|
|
26
|
+
skillPathOverride: string | undefined;
|
|
27
|
+
skillContentOverride: string | undefined;
|
|
28
|
+
promptHash: string;
|
|
29
|
+
existingContentfulEntities: ExistingContentfulEntities | undefined;
|
|
30
|
+
existingTokensInline: string | undefined;
|
|
31
|
+
precomputedCachedNames: ReadonlySet<string>;
|
|
32
|
+
allowedComponentNames: ReadonlySet<string>;
|
|
33
|
+
}
|
|
34
|
+
export declare function invokeComponentAgent(options: ComponentAgentOptions, component: RawComponentDefinition & {
|
|
35
|
+
component_id: string;
|
|
36
|
+
}, index: number, total: number): Promise<ComponentRunResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadAcceptedNames(sessionId: string): Promise<Set<string> | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { lookupCache } from '../../session/db.js';
|
|
2
|
+
import type { openPipelineDb } from '../../session/db.js';
|
|
3
|
+
import type { RawComponentDefinition } from '../../types.js';
|
|
4
|
+
export type ComponentCacheResolution = {
|
|
5
|
+
entry: NonNullable<ReturnType<typeof lookupCache>>;
|
|
6
|
+
humanEdited: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function lookupComponentCache(db: ReturnType<typeof openPipelineDb>, component: RawComponentDefinition & {
|
|
9
|
+
component_id: string;
|
|
10
|
+
}, promptHash: string): ReturnType<typeof lookupCache>;
|
|
11
|
+
export declare function resolveComponentCache(db: ReturnType<typeof openPipelineDb>, component: RawComponentDefinition & {
|
|
12
|
+
component_id: string;
|
|
13
|
+
}, promptHash: string, allowedComponentNames: ReadonlySet<string>): ComponentCacheResolution | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentName } from '@contentful/experience-design-system-generation';
|
|
2
|
+
import { readExperiencesCredentials } from '../../credentials-store.js';
|
|
3
|
+
import type { GenerateSubcommandOptions } from '../command.js';
|
|
4
|
+
export interface ResolvedGenerateAgent {
|
|
5
|
+
agent: AgentName;
|
|
6
|
+
model: string | undefined;
|
|
7
|
+
savedCreds: Awaited<ReturnType<typeof readExperiencesCredentials>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveGenerateAgent(opts: Pick<GenerateSubcommandOptions, 'agent' | 'model' | 'bedrock'>): Promise<ResolvedGenerateAgent>;
|