@contentful/experience-design-system-cli 2.35.1-dev-build-459d7e23.0 → 2.35.1-dev-build-e76d41c1.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 -5
- package/dist/src/tui/home/home.d.ts +0 -1
- package/dist/src/tui/home/home.theme.d.ts +0 -11
- package/legacy/bin/cli.js +23 -19
- package/legacy/dist/src/analyze/composition/candidate-files.d.ts +34 -0
- package/legacy/dist/src/analyze/composition/composition-cache-key.d.ts +18 -0
- package/legacy/dist/src/analyze/composition/interchange-schema.d.ts +1 -7
- package/legacy/dist/src/analyze/composition/parse-map-edges.d.ts +16 -0
- package/legacy/dist/src/analyze/composition/prompt-loader.d.ts +3 -0
- package/legacy/dist/src/analyze/composition/resolve-mapping-cli.d.ts +10 -0
- package/legacy/dist/src/analyze/composition/resolve-mapping.d.ts +34 -11
- package/legacy/dist/src/analyze/controller/run-analyze-extract.d.ts +12 -0
- package/legacy/dist/src/analyze/extract-command.d.ts +2 -1
- 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/WizardApp.d.ts +7 -1
- package/legacy/dist/src/import/tui/ai-flag.d.ts +1 -0
- package/legacy/dist/src/import/tui/run-selection-agent.d.ts +1 -0
- package/legacy/dist/src/import/tui/steps/ScopeGateStep.d.ts +1 -0
- package/legacy/dist/src/import/tui/wizard-state-transitions.d.ts +3 -0
- package/legacy/dist/src/index.js +18277 -16691
- 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/map-tokens/tui/MapTokensView.d.ts +1 -0
- package/legacy/dist/src/session/cache-keys.d.ts +22 -0
- package/legacy/dist/src/session/core/components/hash-component-shape.d.ts +5 -0
- package/legacy/dist/src/session/core/tokens/hash-token-content.d.ts +1 -0
- package/legacy/dist/src/session/db.d.ts +73 -4
- package/legacy/package.json +1 -5
- package/legacy/prompts/composition-edges.md +11 -0
- package/legacy/skills/select-components.md +8 -43
- package/package.json +3 -7
- package/legacy/dist/src/analyze/composition/source-call-site-evidence.d.ts +0 -30
- package/legacy/skills/debate-select.md +0 -23
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.35.1-dev-build-
|
|
3
|
+
"version": "2.35.1-dev-build-e76d41c1.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,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";
|
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,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' | '
|
|
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,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" (
|
|
17
|
-
* (
|
|
18
|
-
*
|
|
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.
|
|
24
|
-
*
|
|
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
|
-
|
|
35
|
-
sourceCallSiteRejections?: SourceCallSiteRejection[];
|
|
36
|
-
}): ResolveMappingResult;
|
|
59
|
+
}): Promise<ResolveMappingResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AnalyzeExtractOptions {
|
|
2
|
+
project: string;
|
|
3
|
+
dir?: string;
|
|
4
|
+
resolveUnreachable?: string;
|
|
5
|
+
compositionRefresh?: boolean;
|
|
6
|
+
cache?: boolean;
|
|
7
|
+
noCache?: boolean;
|
|
8
|
+
prompt?: string[];
|
|
9
|
+
agent?: string;
|
|
10
|
+
bedrock?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function runAnalyzeExtract(opts: AnalyzeExtractOptions): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
-
export
|
|
2
|
+
export { resolveExtractNoCache } from './helpers/resolve-no-cache.js';
|
|
3
|
+
export { collectSourceFiles } from './services/collect-source-files.js';
|
|
3
4
|
export declare function registerInternalExtractCommand(program: Command): void;
|
|
@@ -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>;
|