@contentful/experience-design-system-cli 2.35.1-dev-build-a91cc5b7.0 → 2.35.1-dev-build-f520d7cb.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.
Files changed (25) hide show
  1. package/dist/package.json +1 -5
  2. package/dist/src/tui/home/home.d.ts +0 -1
  3. package/dist/src/tui/home/home.theme.d.ts +0 -11
  4. package/legacy/dist/src/analyze/composition/candidate-files.d.ts +34 -0
  5. package/legacy/dist/src/analyze/composition/composition-cache-key.d.ts +18 -0
  6. package/legacy/dist/src/analyze/composition/interchange-schema.d.ts +1 -7
  7. package/legacy/dist/src/analyze/composition/parse-map-edges.d.ts +16 -0
  8. package/legacy/dist/src/analyze/composition/prompt-loader.d.ts +3 -0
  9. package/legacy/dist/src/analyze/composition/resolve-mapping-cli.d.ts +10 -0
  10. package/legacy/dist/src/analyze/composition/resolve-mapping.d.ts +34 -11
  11. package/legacy/dist/src/analyze/extract-command.d.ts +4 -0
  12. package/legacy/dist/src/import/tui/WizardApp.d.ts +7 -1
  13. package/legacy/dist/src/import/tui/run-selection-agent.d.ts +1 -0
  14. package/legacy/dist/src/import/tui/wizard-state-transitions.d.ts +3 -0
  15. package/legacy/dist/src/index.js +1665 -445
  16. package/legacy/dist/src/map-tokens/tui/MapTokensView.d.ts +1 -0
  17. package/legacy/dist/src/session/cache-keys.d.ts +22 -0
  18. package/legacy/dist/src/session/core/components/hash-component-shape.d.ts +5 -0
  19. package/legacy/dist/src/session/core/tokens/hash-token-content.d.ts +1 -0
  20. package/legacy/dist/src/session/db.d.ts +72 -2
  21. package/legacy/package.json +1 -5
  22. package/legacy/prompts/composition-edges.md +11 -0
  23. package/package.json +3 -7
  24. package/legacy/dist/src/analyze/composition/source-call-site-evidence.d.ts +0 -30
  25. package/legacy/skills/debate-select.md +0 -23
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-a91cc5b7.0",
3
+ "version": "2.35.1-dev-build-f520d7cb.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -53,9 +53,6 @@
53
53
  "typescript": "^5.9.3"
54
54
  },
55
55
  "devDependencies": {
56
- "@contentful/experience-design-system-agents": "workspace:*",
57
- "@contentful/experience-design-system-extraction": "workspace:*",
58
- "@contentful/experience-design-system-generation": "workspace:*",
59
56
  "@tsconfig/node24": "^24.0.4",
60
57
  "@types/node": "^24.0.3",
61
58
  "@types/react": "^18.3.24",
@@ -63,7 +60,6 @@
63
60
  "eslint": "^9.39.5",
64
61
  "eslint-config-prettier": "^10.1.8",
65
62
  "eslint-plugin-prettier": "^5.5.6",
66
- "ink-testing-library": "^4.0.0",
67
63
  "typescript-eslint": "^8.67.0",
68
64
  "vitest": "^4.0.16"
69
65
  },
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { Screen } from '../../../app.js';
3
- export declare const MIN_TERMINAL_WIDTH = 164;
4
3
  export declare function HomeScreen({ onNavigate }: {
5
4
  onNavigate: (screen: Screen) => void;
6
5
  }): React.ReactElement;
@@ -1,14 +1,3 @@
1
- export declare const BRAND: {
2
- readonly blue: "#1773EB";
3
- readonly green: "#00C459";
4
- readonly orange: "#E44F20";
5
- readonly yellow: "#FFDA00";
6
- readonly white: "#FFFFFF";
7
- readonly slate: "#A6B5C7";
8
- readonly steel: "#C4D1DE";
9
- readonly mist: "#DDE5EC";
10
- readonly fog: "#EFF2F6";
11
- };
12
1
  export declare const PALETTE: {
13
2
  readonly accent: "#1773EB";
14
3
  readonly heading: "#FFFFFF";
@@ -0,0 +1,34 @@
1
+ export declare const CANDIDATE_NAME_PATTERNS: RegExp[];
2
+ export declare const CANDIDATE_CONTENT_MARKERS: string[];
3
+ export declare const CANDIDATE_TOKEN_BUDGET = 6000;
4
+ /**
5
+ * Token ceiling for the candidate set INLINED into a single agent prompt.
6
+ * Sized to stay under a 200k-context model once the agent's own system prompt
7
+ * + tool definitions (~105k observed) are added, so a large design system
8
+ * (hundreds of components → many matched files) can't overflow the request and
9
+ * fail resolution. Files beyond the budget are dropped (with a warning), not
10
+ * silently truncated. Distinct from `CANDIDATE_TOKEN_BUDGET`, which sizes the
11
+ * unused per-batch chunking.
12
+ */
13
+ export declare const PROMPT_CANDIDATE_TOKEN_BUDGET = 80000;
14
+ export type CandidateFile = {
15
+ path: string;
16
+ content: string;
17
+ };
18
+ export type SelectedCandidate = CandidateFile & {
19
+ reason: string;
20
+ };
21
+ export declare function selectCandidateFiles(files: CandidateFile[]): SelectedCandidate[];
22
+ /**
23
+ * Cap a candidate set to what fits in a single agent prompt (see
24
+ * `PROMPT_CANDIDATE_TOKEN_BUDGET`). Files are kept smallest-first so the budget
25
+ * admits the most declarations; deterministic tie-break by path. Returns the
26
+ * kept files plus the paths dropped so the caller can warn (silent truncation
27
+ * would read as "resolved everything" when it didn't).
28
+ */
29
+ export declare function capCandidatesToPromptBudget<T extends CandidateFile>(files: T[], budget?: number): {
30
+ kept: T[];
31
+ dropped: T[];
32
+ };
33
+ export declare function sliceDeclarationRegions(content: string, markers?: string[], window?: number): string[];
34
+ export declare function batchCandidates(files: CandidateFile[], budget?: number): CandidateFile[][];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Derive the `input_hash` for a composition-cache entry (stored in the pipeline
3
+ * DB's `composition_cache` table). Content-addresses the candidate file set
4
+ * (order-independent) plus the producing agent, so a re-run over unchanged
5
+ * files reuses the (token-costly) agent output.
6
+ *
7
+ * Content-hashing — not mtime — means a no-op `git checkout` that only bumps
8
+ * mtime is still a hit. Prompt/skill changes are handled by the `cli_version`
9
+ * column on the row (see `getCliCacheVersion`), so no separate resolver-version
10
+ * constant is needed here.
11
+ */
12
+ export declare function buildCompositionInputHash(input: {
13
+ files: Array<{
14
+ path: string;
15
+ content: string;
16
+ }>;
17
+ agent: string;
18
+ }): string;
@@ -5,7 +5,7 @@
5
5
  * parent→child relationship, carrying optional `slot` (T7), `confidence`,
6
6
  * and `provenance`. It is easier to merge and dedupe across sources (T2).
7
7
  */
8
- export type EdgeProvenance = 'typed-slot' | 'structural' | 'call-site' | 'manifest' | 'doc' | `adapter:${string}`;
8
+ export type EdgeProvenance = 'typed-slot' | 'structural' | 'manifest' | 'doc' | `adapter:${string}` | 'agent';
9
9
  export type CompositionEdge = {
10
10
  parent: string;
11
11
  child: string;
@@ -13,11 +13,5 @@ export type CompositionEdge = {
13
13
  slot?: string;
14
14
  /** 1–5 scale, same as select/reject agent tools. */
15
15
  confidence?: number;
16
- citation?: CompositionCitation;
17
16
  provenance: EdgeProvenance;
18
17
  };
19
- export type CompositionCitation = {
20
- sourcePath: string;
21
- startLine: number;
22
- endLine: number;
23
- };
@@ -0,0 +1,16 @@
1
+ import type { CompositionEdge } from './interchange-schema.js';
2
+ /**
3
+ * Lenient JSONL parser for the composition-mapping agent's tool-call output
4
+ * (spec T4). Mirrors `parseSelectToolCallLines` / `parseToolCallLines` in
5
+ * `@contentful/experience-design-system-generation`'s `agent-runner.ts`: one JSON object per line, each with a `tool`
6
+ * field from a fixed allowlist. A line that fails JSON.parse or validation is
7
+ * DROPPED into `warnings[]` (with a reason) and parsing CONTINUES — no retry,
8
+ * no throw. Non-`{` prose and blank lines are skipped silently.
9
+ */
10
+ export type ParseMapEdgesResult = {
11
+ edges: CompositionEdge[];
12
+ warnings: string[];
13
+ };
14
+ export declare function parseMapEdges(raw: string, opts: {
15
+ componentNames: Set<string>;
16
+ }): ParseMapEdgesResult;
@@ -0,0 +1,3 @@
1
+ /** Resolve a bundled composition prompt from the package-root prompts directory. */
2
+ export declare function resolvePromptPath(fileName: string): string;
3
+ export declare function loadPrompt(fileName: string): string;
@@ -0,0 +1,10 @@
1
+ export type CompositionCliOptions = {
2
+ /** `--composition-refresh` — force edge emission to run even over resolved residue. */
3
+ compositionRefresh?: boolean;
4
+ /** `--no-cache` — force the composition agent to rerun with the rest of the pipeline. */
5
+ noCache?: boolean;
6
+ };
7
+ export type ResolvedCompositionSources = {
8
+ forceAgent: boolean;
9
+ };
10
+ export declare function resolveCompositionSources(opts: CompositionCliOptions): ResolvedCompositionSources;
@@ -1,36 +1,59 @@
1
1
  import type { RawComponentDefinition } from '../../types.js';
2
2
  import type { CompositionEdge } from './interchange-schema.js';
3
3
  import { type EdgeConflict } from './merge-edges.js';
4
- import type { SourceCallSiteEvidence, SourceCallSiteRejection } from './source-call-site-evidence.js';
5
4
  export type ResolveMappingResult = {
6
5
  components: RawComponentDefinition[];
7
6
  edges: CompositionEdge[];
8
7
  conflicts: EdgeConflict[];
9
8
  warnings: string[];
10
- sourceCallSiteEvidence: SourceCallSiteEvidence[];
11
- sourceCallSiteRejections: SourceCallSiteRejection[];
12
9
  };
13
10
  /**
14
11
  * Orchestrate composition-edge acquisition and enrichment.
15
12
  *
16
- * Sources by rank: typed-slot / "code slots" (1) > structural usage evidence
17
- * (2) > cited source call sites (3) > manifest (4) > doc (5) > adapter-resolved
18
- * / extraEdges (6). Manifest/doc edges are computed deterministically outside
13
+ * Sources by rank: typed-slot / "code slots" (2) > structural usage evidence
14
+ * (3) > manifest (4) > doc (5) > adapter-resolved / extraEdges (6) >
15
+ * edge-emitting agent (7). Manifest/doc edges are computed deterministically outside
19
16
  * this function (see manifest-doc-evidence.ts) and joined via `extraEdges`.
20
17
  * ALL sources — including the code slots already on the incoming components —
21
18
  * are fed into one ranked merge and unioned; non-conflicting edges from every
22
19
  * source survive, and on a conflict (same parent+child, different slot) the
23
- * higher-rank source wins and the loser is recorded. No agent contributes
24
- * edges: every edge is backed by code, a manifest or documentation.
20
+ * higher-rank source wins and the loser is recorded. The edge-emitting agent runs only when
21
+ * `forceAgent` is set OR there is residue a higher-rank source
22
+ * didn't cover (routing/cost optimization) — `forceAgent` bypasses that
23
+ * suppression but never changes rank.
24
+ *
25
+ * `runAgentFn` is injected (returns the agent's raw stdout) so this is
26
+ * testable without spawning a subprocess.
25
27
  */
26
28
  export declare function resolveMapping(input: {
27
29
  components: RawComponentDefinition[];
30
+ forceAgent?: boolean;
31
+ files: Array<{
32
+ path: string;
33
+ content: string;
34
+ }>;
35
+ runAgentFn: (opts: {
36
+ prompt: string;
37
+ files: Array<{
38
+ path: string;
39
+ content: string;
40
+ }>;
41
+ }) => Promise<string>;
42
+ buildPrompt?: (files: Array<{
43
+ path: string;
44
+ content: string;
45
+ }>, componentNames: string[]) => string;
46
+ /**
47
+ * Custom instruction preamble (from `--prompt composition=...`). Replaces the
48
+ * default guidance line ONLY; the machine-readable output contract + the
49
+ * component-name allowlist + candidate files are always appended so the
50
+ * JSONL parser keeps working regardless of the override.
51
+ */
52
+ promptOverride?: string;
28
53
  /**
29
54
  * Pre-resolved edges from an external source (e.g. manifest or documentation)
30
55
  * path). They join the ranked merge at their own provenance rank alongside
31
56
  * code slots and other automatic mapping sources.
32
57
  */
33
58
  extraEdges?: CompositionEdge[];
34
- sourceCallSiteEvidence?: SourceCallSiteEvidence[];
35
- sourceCallSiteRejections?: SourceCallSiteRejection[];
36
- }): ResolveMappingResult;
59
+ }): Promise<ResolveMappingResult>;
@@ -1,3 +1,7 @@
1
1
  import type { Command } from 'commander';
2
+ export declare function resolveExtractNoCache(opts: {
3
+ cache?: boolean;
4
+ noCache?: boolean;
5
+ }): boolean;
2
6
  export declare function collectSourceFiles(directory: string, onProgress?: (scannedCount: number) => void): Promise<string[]>;
3
7
  export declare function registerInternalExtractCommand(program: Command): void;
@@ -7,21 +7,26 @@ export declare function buildGenerateComponentsArgs(opts: {
7
7
  agent: string;
8
8
  model?: string;
9
9
  bedrock?: boolean;
10
+ noCache?: boolean;
10
11
  generatePromptPath?: string;
11
12
  promptOverrides?: string[];
12
13
  existingEntitiesPath?: string;
14
+ restoreCache?: boolean;
15
+ cachedComponents?: string[];
13
16
  }): string[];
14
17
  export declare function buildGenerateTokensArgs(opts: {
15
18
  rawTokensPath: string;
16
19
  agent: string;
17
20
  model?: string;
18
21
  bedrock?: boolean;
22
+ noCache?: boolean;
19
23
  promptOverrides?: string[];
20
24
  }): string[];
21
25
  export declare function buildMapTokensArgs(opts: {
22
26
  sessionId: string;
23
27
  agent: string;
24
28
  model?: string;
29
+ noCache?: boolean;
25
30
  skipAgent?: boolean;
26
31
  promptOverrides?: string[];
27
32
  existingEntitiesPath?: string;
@@ -52,10 +57,11 @@ export type WizardAppProps = {
52
57
  initialProjectPath?: string;
53
58
  host?: string;
54
59
  promptOverrides?: string[];
60
+ noCache?: boolean;
55
61
  livePreview?: boolean;
56
62
  generatePromptPath?: string;
57
63
  skipMapTokens?: boolean;
58
64
  initialRawTokensPath?: string;
59
65
  initialAgentAuth?: Promise<AgentAuthStatus>;
60
66
  };
61
- export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, initialAgentAuth, }?: WizardAppProps): React.ReactElement;
67
+ export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides, noCache, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, initialAgentAuth, }?: WizardAppProps): React.ReactElement;
@@ -5,4 +5,5 @@ export declare function runSelectionAgent(options: {
5
5
  model?: string;
6
6
  promptText?: string;
7
7
  promptPath?: string;
8
+ noCache?: boolean;
8
9
  }): Promise<void>;
@@ -8,6 +8,9 @@ export declare function shouldSkipFinalReviewAfterCredentials(state: {
8
8
  generateSessionId: string | null;
9
9
  finalReviewPassed: boolean;
10
10
  }): boolean;
11
+ export declare function resolveNoCacheForGenerate(opts: {
12
+ cliNoCache: boolean;
13
+ }): boolean;
11
14
  export declare function shouldBypassPreview(state: {
12
15
  credentialsSkipped: boolean;
13
16
  }): boolean;