@contentful/experience-design-system-cli 2.32.1-dev-build-23e5797.0 → 2.32.1-dev-build-4052dd5.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/package.json +1 -1
- package/dist/src/index.js +570 -341
- package/dist/src/session/core/cdf/cdf-mappers.d.ts +3 -0
- package/dist/src/session/core/components/derive-component-id.d.ts +1 -0
- package/dist/src/session/core/components/hash-component-shape.d.ts +5 -0
- package/dist/src/session/core/shared/index-rows-by-key.d.ts +1 -0
- package/dist/src/session/core/tokens/build-dtcg-groups.d.ts +12 -0
- package/dist/src/session/core/tokens/build-dtcg-tokens.d.ts +3 -0
- package/dist/src/session/core/tokens/hash-token-content.d.ts +1 -0
- package/dist/src/session/db.d.ts +17 -50
- package/dist/src/session/repositories/sessions/read.d.ts +11 -0
- package/dist/src/session/repositories/sessions/write.d.ts +3 -0
- package/dist/src/session/repositories/shared/with-transaction.d.ts +2 -0
- package/dist/src/session/repositories/steps/read.d.ts +2 -0
- package/dist/src/session/repositories/steps/write.d.ts +5 -0
- package/dist/src/session/repositories/tokens/read.d.ts +15 -0
- package/dist/src/session/repositories/tokens/write.d.ts +16 -0
- package/dist/src/session/services/session-resolver.d.ts +9 -0
- package/dist/src/session/services/tokens/apply-tool-calls.d.ts +8 -0
- package/dist/src/session/services/tokens/replace-raw-prop-token-paths.d.ts +3 -0
- package/dist/src/session/services/tokens/replace-raw-token-name-paths.d.ts +3 -0
- package/dist/src/session/services/tokens/store-dtcg-tokens.d.ts +3 -0
- package/package.json +6 -6
- /package/dist/src/session/{command.d.ts → cli.d.ts} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type CdfCategory = 'content' | 'design' | 'state';
|
|
2
|
+
export declare function mapContentfulTypeToCdfType(contentfulType: string): string;
|
|
3
|
+
export declare function resolveCdfCategory(contentfulCategory: string | null | undefined, propName: string, contentProps: Set<string>, designProps: Set<string>): CdfCategory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deriveComponentId(name: string, source: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function indexRowsByKey<T>(items: T[], key: (item: T) => string): Map<string, T[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DTCGTokenGroup } from '@contentful/experience-design-system-types';
|
|
2
|
+
export interface GroupRow {
|
|
3
|
+
path: string;
|
|
4
|
+
description: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface TokenRow {
|
|
7
|
+
path: string;
|
|
8
|
+
type: string;
|
|
9
|
+
value: string;
|
|
10
|
+
description: string | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildDtcgGroups(groupRows: GroupRow[], tokenRows: TokenRow[]): DTCGTokenGroup[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hashTokenContent(rawTokenContent: string): string;
|
package/dist/src/session/db.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { DatabaseSync } from 'node:sqlite';
|
|
2
2
|
import type { RawComponentDefinition } from '../types.js';
|
|
3
|
-
import type { CDFComponentEntry
|
|
4
|
-
import type { ToolCall,
|
|
3
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
4
|
+
import type { ToolCall, ComponentSourceRef } from '@contentful/experience-design-system-generation';
|
|
5
5
|
import type { ComponentTypeSummary } from '@contentful/experience-design-system-types';
|
|
6
6
|
import type { SlotCycle, SlotEdge } from '../analyze/cycle-detection.js';
|
|
7
|
+
import { type MatchHints as SessionMatchHints } from './repositories/sessions/read.js';
|
|
8
|
+
import { type SessionResolution } from './services/session-resolver.js';
|
|
9
|
+
export { deriveComponentId } from './core/components/derive-component-id.js';
|
|
10
|
+
export { hashComponentShape as computeComponentInputHash } from './core/components/hash-component-shape.js';
|
|
11
|
+
export { hashTokenContent as computeTokenInputHash } from './core/tokens/hash-token-content.js';
|
|
12
|
+
export { mapContentfulTypeToCdfType, resolveCdfCategory } from './core/cdf/cdf-mappers.js';
|
|
13
|
+
export { getDtcgTokensForSession as loadDTCGTokens, getRawTokenNamePaths as loadRawTokenNamePaths, getRawTokenNamePathRows as loadRawTokenNamePathRows, type RawTokenNamePaths, type RawTokenNamePathSource, type RawTokenNamePath, } from './repositories/tokens/read.js';
|
|
14
|
+
export { type RawPropTokenPathSource } from './repositories/tokens/write.js';
|
|
15
|
+
export { storeDtcgTokens as storeDTCGTokens } from './services/tokens/store-dtcg-tokens.js';
|
|
16
|
+
export { applyTokenToolCalls, type ApplyTokenToolCallsResult } from './services/tokens/apply-tool-calls.js';
|
|
17
|
+
export { replaceRawTokenNamePaths } from './services/tokens/replace-raw-token-name-paths.js';
|
|
18
|
+
export { replaceRawPropTokenPaths } from './services/tokens/replace-raw-prop-token-paths.js';
|
|
7
19
|
export type StepStatus = 'pending' | 'complete' | 'failed' | 'interrupted';
|
|
8
20
|
export type CommandName = 'analyze extract' | 'analyze select' | 'generate components' | 'generate tokens' | 'generate edit' | 'apply preview' | 'apply select' | 'apply push' | 'print components' | 'print tokens' | 'map tokens' | 'fetch existing entities' | 'import';
|
|
9
21
|
export interface SessionRow {
|
|
@@ -26,30 +38,6 @@ export interface StepRow {
|
|
|
26
38
|
}
|
|
27
39
|
export declare function getPipelineDbPath(): string;
|
|
28
40
|
export declare function openPipelineDb(dbPath?: string): DatabaseSync;
|
|
29
|
-
/** An exact source token reference paired with its canonical DTCG path. */
|
|
30
|
-
export type RawTokenNamePaths = Record<string, string>;
|
|
31
|
-
export type RawTokenNamePathSource = 'automatic' | 'manual';
|
|
32
|
-
export interface RawTokenNamePath {
|
|
33
|
-
rawName: string;
|
|
34
|
-
path: string;
|
|
35
|
-
source: RawTokenNamePathSource;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Replaces the session's exact source-reference-to-DTCG-path sidecar.
|
|
39
|
-
* Source references are retained verbatim; normalisation belongs to the
|
|
40
|
-
* deterministic resolver, not to persistence or CDF emission.
|
|
41
|
-
*/
|
|
42
|
-
export declare function replaceRawTokenNamePaths(db: DatabaseSync, sessionId: string, tokenNamePaths: RawTokenNamePaths, source?: RawTokenNamePathSource): void;
|
|
43
|
-
/** Loads the exact source-reference-to-DTCG-path sidecar for a session. */
|
|
44
|
-
export declare function loadRawTokenNamePaths(db: DatabaseSync, sessionId: string): RawTokenNamePaths;
|
|
45
|
-
export declare function loadRawTokenNamePathRows(db: DatabaseSync, sessionId: string): RawTokenNamePath[];
|
|
46
|
-
/**
|
|
47
|
-
* Where a prop's token-path list came from. 'agent' is a map-tokens suggestion,
|
|
48
|
-
* which a later run of that step may revise. 'review' is a person's decision in
|
|
49
|
-
* the review editor, which a re-run must leave alone.
|
|
50
|
-
*/
|
|
51
|
-
export type RawPropTokenPathSource = 'agent' | 'review';
|
|
52
|
-
export declare function replaceRawPropTokenPaths(db: DatabaseSync, sessionId: string, componentId: string, propName: string, paths: string[], source: RawPropTokenPathSource): void;
|
|
53
41
|
export interface ApplyToolCallsResult {
|
|
54
42
|
classified: number;
|
|
55
43
|
excluded: number;
|
|
@@ -86,17 +74,9 @@ export interface ComponentRationale {
|
|
|
86
74
|
}
|
|
87
75
|
export declare function loadComponentRationale(db: DatabaseSync, sessionId: string, componentName: string): ComponentRationale | null;
|
|
88
76
|
export declare function applyToolCalls(db: DatabaseSync, sessionId: string, componentId: string, componentName: string, calls: ToolCall[], incomingWarnings: string[]): ApplyToolCallsResult;
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
outDir?: string;
|
|
93
|
-
}
|
|
94
|
-
export interface SessionResolution {
|
|
95
|
-
sessionId: string;
|
|
96
|
-
isNew: boolean;
|
|
97
|
-
isResumed: boolean;
|
|
98
|
-
}
|
|
99
|
-
export declare function getOrCreateSession(db: DatabaseSync, sessionFlag: string | undefined, sessionName: string | undefined, _hints: MatchHints): SessionResolution;
|
|
77
|
+
export type MatchHints = SessionMatchHints;
|
|
78
|
+
export type { SessionResolution };
|
|
79
|
+
export declare function getOrCreateSession(db: DatabaseSync, sessionFlag: string | undefined, sessionName: string | undefined, hints: MatchHints): SessionResolution;
|
|
100
80
|
export declare function createStep(db: DatabaseSync, sessionId: string, command: CommandName, inputs: Record<string, string>): number;
|
|
101
81
|
export declare function updateStep(db: DatabaseSync, stepId: number, status: 'complete' | 'failed', outputs: Record<string, string>, error?: string): void;
|
|
102
82
|
export declare function storeRawComponents(db: DatabaseSync, sessionId: string, components: RawComponentDefinition[], options?: {
|
|
@@ -140,17 +120,6 @@ export declare function applyScopeDecisions(db: DatabaseSync, sessionId: string,
|
|
|
140
120
|
accepted: string[];
|
|
141
121
|
rejected: string[];
|
|
142
122
|
}): void;
|
|
143
|
-
export declare function storeDTCGTokens(db: DatabaseSync, sessionId: string, groups: DTCGTokenGroup[], tokens: DTCGTokenEntry[]): void;
|
|
144
|
-
export interface ApplyTokenToolCallsResult {
|
|
145
|
-
tokens: number;
|
|
146
|
-
groups: number;
|
|
147
|
-
warnings: string[];
|
|
148
|
-
}
|
|
149
|
-
export declare function applyTokenToolCalls(db: DatabaseSync, sessionId: string, calls: TokenToolCall[], incomingWarnings: string[]): ApplyTokenToolCallsResult;
|
|
150
|
-
export declare function loadDTCGTokens(db: DatabaseSync, sessionId: string): {
|
|
151
|
-
groups: DTCGTokenGroup[];
|
|
152
|
-
tokens: DTCGTokenEntry[];
|
|
153
|
-
};
|
|
154
123
|
export declare function findLatestSessionForCommand(db: DatabaseSync, command: CommandName): string | null;
|
|
155
124
|
export declare function seedCDFFromPriorSession(db: DatabaseSync, targetSessionId: string): number;
|
|
156
125
|
export declare function seedCDFFromPreviewResponse(db: DatabaseSync, sessionId: string, removedItems: ComponentTypeSummary[]): number;
|
|
@@ -170,8 +139,6 @@ export interface CacheEntry {
|
|
|
170
139
|
createdAt: string;
|
|
171
140
|
updatedAt: string;
|
|
172
141
|
}
|
|
173
|
-
export declare function computeComponentInputHash(component: RawComponentWithId): string;
|
|
174
|
-
export declare function computeTokenInputHash(rawTokenContent: string): string;
|
|
175
142
|
export declare function computeMapTokensInputHash(db: DatabaseSync, sessionId: string, componentSourceRefs?: readonly ComponentSourceRef[]): string;
|
|
176
143
|
export declare function lookupCache(db: DatabaseSync, inputHash: string, entityType: CacheEntityType, entityId: string, promptHash?: string): CacheEntry | null;
|
|
177
144
|
export declare function lookupCacheByEntity(db: DatabaseSync, entityType: CacheEntityType, entityId: string): CacheEntry | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { CommandName } from '../../db.js';
|
|
3
|
+
export interface MatchHints {
|
|
4
|
+
command: CommandName;
|
|
5
|
+
inputPath?: string;
|
|
6
|
+
outDir?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getSessionById(db: DatabaseSync, sessionId: string): {
|
|
9
|
+
id: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function getLatestCompletedSessionForCommand(db: DatabaseSync, command: CommandName): string | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
export declare function createSession(db: DatabaseSync, id: string, name: string | null, timestamp: string): void;
|
|
3
|
+
export declare function updateSessionTimestamp(db: DatabaseSync, sessionId: string, timestamp: string): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { CommandName } from '../../db.js';
|
|
3
|
+
export declare function updatePendingStepsToInterrupted(db: DatabaseSync, sessionId: string, command: CommandName, timestamp: string): void;
|
|
4
|
+
export declare function createPendingStep(db: DatabaseSync, sessionId: string, command: CommandName, inputs: Record<string, string>, timestamp: string): number;
|
|
5
|
+
export declare function updateStepStatus(db: DatabaseSync, stepId: number, status: 'complete' | 'failed', outputs: Record<string, string>, error: string | null, timestamp: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { DTCGTokenEntry, DTCGTokenGroup } from '@contentful/experience-design-system-types';
|
|
3
|
+
export type RawTokenNamePaths = Record<string, string>;
|
|
4
|
+
export type RawTokenNamePathSource = 'automatic' | 'manual';
|
|
5
|
+
export interface RawTokenNamePath {
|
|
6
|
+
rawName: string;
|
|
7
|
+
path: string;
|
|
8
|
+
source: RawTokenNamePathSource;
|
|
9
|
+
}
|
|
10
|
+
export declare function getDtcgTokensForSession(db: DatabaseSync, sessionId: string): {
|
|
11
|
+
groups: DTCGTokenGroup[];
|
|
12
|
+
tokens: DTCGTokenEntry[];
|
|
13
|
+
};
|
|
14
|
+
export declare function getRawTokenNamePaths(db: DatabaseSync, sessionId: string): RawTokenNamePaths;
|
|
15
|
+
export declare function getRawTokenNamePathRows(db: DatabaseSync, sessionId: string): RawTokenNamePath[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { DTCGTokenEntry, DTCGTokenGroup } from '@contentful/experience-design-system-types';
|
|
3
|
+
import type { TokenToolCall } from '@contentful/experience-design-system-generation';
|
|
4
|
+
import type { RawTokenNamePaths, RawTokenNamePathSource } from './read.js';
|
|
5
|
+
export type RawPropTokenPathSource = 'agent' | 'review';
|
|
6
|
+
export declare function deleteRawTokensForSession(db: DatabaseSync, sessionId: string): void;
|
|
7
|
+
export declare function createRawTokenGroups(db: DatabaseSync, sessionId: string, groups: DTCGTokenGroup[]): void;
|
|
8
|
+
export declare function createRawTokens(db: DatabaseSync, sessionId: string, tokens: DTCGTokenEntry[]): void;
|
|
9
|
+
export declare function upsertRawToken(db: DatabaseSync, sessionId: string, call: Extract<TokenToolCall, {
|
|
10
|
+
tool: 'set_token';
|
|
11
|
+
}>): void;
|
|
12
|
+
export declare function upsertRawTokenGroup(db: DatabaseSync, sessionId: string, call: Extract<TokenToolCall, {
|
|
13
|
+
tool: 'set_group';
|
|
14
|
+
}>): void;
|
|
15
|
+
export declare function updateRawTokenNamePaths(db: DatabaseSync, sessionId: string, tokenNamePaths: RawTokenNamePaths, source: RawTokenNamePathSource): void;
|
|
16
|
+
export declare function updateRawPropTokenPaths(db: DatabaseSync, sessionId: string, componentId: string, propName: string, paths: string[], source: RawPropTokenPathSource): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import { type MatchHints } from '../repositories/sessions/read.js';
|
|
3
|
+
export type { MatchHints };
|
|
4
|
+
export interface SessionResolution {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
isNew: boolean;
|
|
7
|
+
isResumed: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function getOrCreateSessionForCommand(db: DatabaseSync, sessionFlag: string | undefined, sessionName: string | undefined, _hints: MatchHints): SessionResolution;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { TokenToolCall } from '@contentful/experience-design-system-generation';
|
|
3
|
+
export interface ApplyTokenToolCallsResult {
|
|
4
|
+
tokens: number;
|
|
5
|
+
groups: number;
|
|
6
|
+
warnings: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function applyTokenToolCalls(db: DatabaseSync, sessionId: string, calls: TokenToolCall[], incomingWarnings: string[]): ApplyTokenToolCallsResult;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import { type RawPropTokenPathSource } from '../../repositories/tokens/write.js';
|
|
3
|
+
export declare function replaceRawPropTokenPaths(db: DatabaseSync, sessionId: string, componentId: string, propName: string, paths: string[], source: RawPropTokenPathSource): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { RawTokenNamePaths, RawTokenNamePathSource } from '../../repositories/tokens/read.js';
|
|
3
|
+
export declare function replaceRawTokenNamePaths(db: DatabaseSync, sessionId: string, tokenNamePaths: RawTokenNamePaths, source?: RawTokenNamePathSource): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { DTCGTokenEntry, DTCGTokenGroup } from '@contentful/experience-design-system-types';
|
|
3
|
+
export declare function storeDtcgTokens(db: DatabaseSync, sessionId: string, groups: DTCGTokenGroup[], tokens: DTCGTokenEntry[]): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.32.1-dev-build-
|
|
3
|
+
"version": "2.32.1-dev-build-4052dd5.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"svelte": "^5.56.4",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
|
-
"@contentful/experience-design-system-
|
|
44
|
-
"@contentful/experience-design-system-
|
|
43
|
+
"@contentful/experience-design-system-types": "2.32.1-dev-build-4052dd5.0",
|
|
44
|
+
"@contentful/experience-design-system-cli-v2": "2.32.1-dev-build-4052dd5.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ink-testing-library": "^4.0.0",
|
|
54
54
|
"typescript-eslint": "^8.67.0",
|
|
55
55
|
"vitest": "^4.0.16",
|
|
56
|
-
"@contentful/experience-design-system-
|
|
57
|
-
"@contentful/experience-design-system-client": "2.32.1-dev-build-
|
|
58
|
-
"@contentful/experience-design-system-
|
|
56
|
+
"@contentful/experience-design-system-generation": "2.32.1-dev-build-4052dd5.0",
|
|
57
|
+
"@contentful/experience-design-system-client": "2.32.1-dev-build-4052dd5.0",
|
|
58
|
+
"@contentful/experience-design-system-extraction": "2.32.1-dev-build-4052dd5.0"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
File without changes
|