@contentful/experience-design-system-cli 2.34.5-dev-build-d08439d.0 → 2.34.5-dev-build-75bf00ac.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/README.md +34 -275
- package/dist/package.json +2 -1
- package/dist/src/analytics/constants.d.ts +2 -2
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/normalize.d.ts +1 -1
- package/dist/src/analytics/types.d.ts +1 -1
- package/dist/src/analyze/composition/composition-cache-key.d.ts +2 -3
- package/dist/src/analyze/composition/interchange-schema.d.ts +2 -2
- package/dist/src/analyze/composition/prompt-loader.d.ts +3 -0
- package/dist/src/analyze/composition/resolve-mapping-cli.d.ts +1 -5
- package/dist/src/analyze/composition/resolve-mapping.d.ts +7 -8
- package/dist/src/analyze/extract-command.d.ts +3 -0
- package/dist/src/analyze/select/command.d.ts +3 -25
- package/dist/src/analyze/select/preview-annotations.d.ts +6 -6
- package/dist/src/analyze/select/tui/components/GotoBanner.d.ts +1 -1
- package/dist/src/apply/api-client.d.ts +4 -6
- package/dist/src/apply/command.d.ts +25 -4
- package/dist/src/apply/preview-utils.d.ts +2 -6
- package/dist/src/apply/tokens.d.ts +1 -0
- package/dist/src/apply/tui/ServerApplyView.d.ts +3 -6
- package/dist/src/apply/tui/ServerPreviewView.d.ts +1 -2
- package/dist/src/credentials-store.d.ts +0 -10
- package/dist/src/generate/command.d.ts +1 -1
- package/dist/src/helpers/read-existing-contentful-entities-from-session.d.ts +1 -1
- package/dist/src/import/agent-model-resolve.d.ts +1 -1
- package/dist/src/import/composition-options.d.ts +0 -8
- package/dist/src/import/tui/CustomPromptBanner.d.ts +1 -2
- package/dist/src/import/tui/WizardApp.d.ts +7 -41
- package/dist/src/import/tui/final-review-host.d.ts +1 -5
- package/dist/src/import/tui/hooks/useReviewPreview.d.ts +1 -2
- package/dist/src/import/tui/hooks/useReviewSession.d.ts +21 -0
- package/dist/src/import/tui/lineage-input.d.ts +2 -2
- package/dist/src/import/tui/preview-confirmation-input.d.ts +1 -2
- package/dist/src/import/tui/review-step-props.d.ts +0 -1
- package/dist/src/import/tui/runLivePreview.d.ts +0 -3
- package/dist/src/import/tui/runScopeGate.d.ts +0 -10
- package/dist/src/import/tui/scope-gate-host.d.ts +3 -7
- package/dist/src/import/tui/steps/ErrorStep.d.ts +2 -1
- package/dist/src/import/tui/steps/GenerateReviewStep.d.ts +1 -1
- package/dist/src/import/tui/steps/ScopeGateStep.d.ts +1 -1
- package/dist/src/import/tui/steps/WizardPreviewStep.d.ts +2 -6
- package/dist/src/import/tui/useFinalizePreview.d.ts +3 -8
- package/dist/src/import/tui/useLivePreview.d.ts +2 -4
- package/dist/src/import/tui/wizard-422-helpers.d.ts +1 -1
- package/dist/src/import/tui/wizard-state-transitions.d.ts +2 -4
- package/dist/src/index.js +23547 -30878
- package/dist/src/lib/command-options.d.ts +0 -3
- package/dist/src/lib/contentful-urls.d.ts +2 -4
- package/dist/src/lib/debug-logger.d.ts +0 -2
- package/dist/src/runs/fingerprint.d.ts +0 -12
- package/dist/src/runs/save-path-resolver.d.ts +0 -46
- package/dist/src/runs/store.d.ts +2 -18
- package/dist/src/session/cache-keys.d.ts +1 -1
- package/dist/src/session/db.d.ts +3 -6
- package/dist/src/setup/command.d.ts +1 -2
- package/package.json +7 -6
- package/skills/generate-components.md +1 -1
- package/dist/src/analytics/env.d.ts +0 -2
- package/dist/src/analyze/build-analyze-view-rows.d.ts +0 -32
- package/dist/src/analyze/command.d.ts +0 -14
- package/dist/src/analyze/composition/agent-parser/author-prompt.d.ts +0 -4
- package/dist/src/analyze/composition/agent-parser/extract-parser.d.ts +0 -8
- package/dist/src/analyze/composition/agent-parser/load-prompt.d.ts +0 -7
- package/dist/src/analyze/composition/agent-parser/resolve-via-parser.d.ts +0 -46
- package/dist/src/analyze/composition/agent-parser/sandbox.d.ts +0 -45
- package/dist/src/analyze/composition/candidate-critic-agent.d.ts +0 -7
- package/dist/src/analyze/composition/candidate-critic.d.ts +0 -32
- package/dist/src/analyze/select-agent/command.d.ts +0 -4
- package/dist/src/analyze/select-agent/context-builder.d.ts +0 -50
- package/dist/src/analyze/select-agent/show-rationale.d.ts +0 -9
- package/dist/src/analyze/tui/AnalyzeView.d.ts +0 -39
- package/dist/src/apply/manifest.d.ts +0 -1
- package/dist/src/apply/tui/SelectView.d.ts +0 -18
- package/dist/src/generate/edit/command.d.ts +0 -2
- package/dist/src/import/auto-filter-resolve.d.ts +0 -3
- package/dist/src/import/orchestrator.d.ts +0 -76
- package/dist/src/import/picker-dispatch.d.ts +0 -28
- package/dist/src/import/print-prompt.d.ts +0 -34
- package/dist/src/import/strip-allowed-components.d.ts +0 -18
- package/dist/src/import/tui/auto-filter-error.d.ts +0 -1
- package/dist/src/import/tui/components/AutoFilterBanner.d.ts +0 -10
- package/dist/src/import/tui/merge-ai-decisions.d.ts +0 -5
- package/dist/src/import/tui/steps/AtomicGenerateReviewStep.d.ts +0 -28
- package/dist/src/import/tui/steps/AtomicScopeGateStep.d.ts +0 -3
- package/dist/src/import/tui/wizard-save-flow.d.ts +0 -37
- package/dist/src/lib/composition-mode.d.ts +0 -30
- package/dist/src/runs/export-helpers.d.ts +0 -5
- package/dist/src/runs/ls-command.d.ts +0 -12
- package/dist/src/runs/modify-launcher.d.ts +0 -34
- package/dist/src/runs/picker-labels.d.ts +0 -24
- package/dist/src/runs/push-creds-prompt.d.ts +0 -25
- package/dist/src/runs/push-helpers.d.ts +0 -20
- package/dist/src/runs/push-launcher.d.ts +0 -52
- package/dist/src/runs/replay-helpers.d.ts +0 -71
- package/dist/src/runs/resolve-run-target.d.ts +0 -12
- package/dist/src/runs/run-picker-mount.d.ts +0 -46
- package/dist/src/runs/run-picker.d.ts +0 -18
- package/dist/src/runs/staleness.d.ts +0 -38
- package/dist/src/runs/wizard-launcher.d.ts +0 -2
- package/dist/src/runs/wizard-seed.d.ts +0 -20
- package/dist/src/session/cli.d.ts +0 -2
- package/dist/src/session/stats.d.ts +0 -26
- package/dist/src/setup/auto-filter-prompt.d.ts +0 -13
- package/dist/src/setup/composition-mode-prompt.d.ts +0 -14
- package/prompts/composition-dir-critic.md +0 -7
- package/prompts/composition-parser-repair-empty.md +0 -1
- package/prompts/composition-parser-repair-error.md +0 -2
- package/prompts/composition-parser.md +0 -49
- /package/dist/src/analyze/select/tui/{App.d.ts → LegacySelectApp.d.ts} +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
export declare function addArtifactInputOptions(cmd: Command): Command;
|
|
3
3
|
export declare function addContentfulTargetOptions(cmd: Command): Command;
|
|
4
|
-
export declare function addCompositionOptions(cmd: Command): Command;
|
|
5
|
-
export declare function addSelectionOptions(cmd: Command): Command;
|
|
6
|
-
export declare function addAllowDeletionsOption(cmd: Command): Command;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared Contentful webapp URL builders.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* formatter so the wizard, `apply push`, and `apply select` all emit the same
|
|
7
|
-
* URL shape.
|
|
4
|
+
* This module centralizes the formatter so the wizard and `apply` emit
|
|
5
|
+
* the same URL shape.
|
|
8
6
|
*/
|
|
9
7
|
type PostPushView = 'components' | 'design_tokens';
|
|
10
8
|
export interface BuildPostPushUrlInput {
|
|
@@ -45,5 +45,3 @@ export declare function resolveDebugMode(opts: {
|
|
|
45
45
|
export declare function printDebugBanner(logger: DebugLogger, phase: 'start' | 'end'): void;
|
|
46
46
|
/** Directory that contains the current process's debug log, if any. */
|
|
47
47
|
export declare function debugLogPath(): string | null;
|
|
48
|
-
/** Ensure spawned children join the same debug log by including EDSI_DEBUG_LOG in their env. */
|
|
49
|
-
export declare function debugEnvForSubprocess(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
@@ -8,10 +8,6 @@ export type SourceFingerprint = {
|
|
|
8
8
|
rawTokensMtime: string | null;
|
|
9
9
|
rawTokensContentHash: string | null;
|
|
10
10
|
};
|
|
11
|
-
export type SavedFingerprint = {
|
|
12
|
-
componentsJsonHash: string | null;
|
|
13
|
-
tokensJsonHash: string | null;
|
|
14
|
-
};
|
|
15
11
|
/**
|
|
16
12
|
* Minimal duck-typed sqlite interface; we don't depend on better-sqlite3
|
|
17
13
|
* directly from this module (the wizard already opens the DB and passes it
|
|
@@ -37,12 +33,4 @@ export declare function buildSourceFingerprint(opts: {
|
|
|
37
33
|
extractSessionId: string;
|
|
38
34
|
rawTokensPath?: string | null;
|
|
39
35
|
}): Promise<SourceFingerprint>;
|
|
40
|
-
/**
|
|
41
|
-
* Hash the saved JSON contents the wizard just wrote. Caller passes the raw
|
|
42
|
-
* bytes (or strings) so we hash exactly what landed on disk.
|
|
43
|
-
*/
|
|
44
|
-
export declare function buildSavedFingerprint(input: {
|
|
45
|
-
componentsJson: string | Buffer | null;
|
|
46
|
-
tokensJson: string | Buffer | null;
|
|
47
|
-
}): SavedFingerprint;
|
|
48
36
|
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const CONFLICT_MODES: readonly ["overwrite", "skip", "fail"];
|
|
2
|
-
export type ConflictMode = (typeof CONFLICT_MODES)[number];
|
|
3
|
-
export declare function isConflictMode(value: string): value is ConflictMode;
|
|
4
1
|
/**
|
|
5
2
|
* Returns true if `components.json` or `tokens.json` already exists at `path`.
|
|
6
3
|
* Used by the wizard to decide whether to render the save-conflict gate before
|
|
@@ -12,46 +9,3 @@ export declare function detectSaveConflict(path: string): Promise<boolean>;
|
|
|
12
9
|
* save-conflict gate. Format: `<base>/dsi-YYYYMMDD-HHMMSS` (local time).
|
|
13
10
|
*/
|
|
14
11
|
export declare function buildTimestampedSubdir(base: string, now?: Date): string;
|
|
15
|
-
/**
|
|
16
|
-
* Headless conflict-resolution mode for `experiences import --on-conflict`.
|
|
17
|
-
*
|
|
18
|
-
* - `overwrite` — write through; replace any existing files.
|
|
19
|
-
* - `skip` — write to a timestamped subdir under the requested path.
|
|
20
|
-
* - `fail` — refuse to write; surface the conflicting filenames.
|
|
21
|
-
*/
|
|
22
|
-
export type ResolveSavePathOptions = {
|
|
23
|
-
/** When provided, applies the chosen mode automatically (no interactive gate). */
|
|
24
|
-
onConflict?: ConflictMode;
|
|
25
|
-
/** Injected for deterministic tests; falls back to `new Date()`. */
|
|
26
|
-
now?: Date;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Result of resolving a save path.
|
|
30
|
-
*
|
|
31
|
-
* `no-conflict` / `conflict` preserve the original two-state shape consumed by
|
|
32
|
-
* the wizard's interactive gate. `write` and `fail` are the headless variants
|
|
33
|
-
* produced when `onConflict` is supplied — `write` means "go ahead with this
|
|
34
|
-
* path" and `fail` carries the conflicting filenames for the operator error.
|
|
35
|
-
*/
|
|
36
|
-
export type ResolveSavePathResult = {
|
|
37
|
-
kind: 'no-conflict';
|
|
38
|
-
path: string;
|
|
39
|
-
} | {
|
|
40
|
-
kind: 'conflict';
|
|
41
|
-
path: string;
|
|
42
|
-
} | {
|
|
43
|
-
kind: 'write';
|
|
44
|
-
path: string;
|
|
45
|
-
} | {
|
|
46
|
-
kind: 'fail';
|
|
47
|
-
conflict: {
|
|
48
|
-
path: string;
|
|
49
|
-
files: string[];
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Probe the requested save path and report whether the wizard needs to render
|
|
54
|
-
* the conflict gate, or — when `onConflict` is supplied — resolve the conflict
|
|
55
|
-
* headlessly using the chosen mode.
|
|
56
|
-
*/
|
|
57
|
-
export declare function resolveSavePath(path: string, options?: ResolveSavePathOptions): Promise<ResolveSavePathResult>;
|
package/dist/src/runs/store.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CompositionMode } from '../lib/composition-mode.js';
|
|
2
1
|
export declare const RUNS_FILE_VERSION: 3;
|
|
3
2
|
/** Versions this CLI can read. v1 / v2 files are auto-migrated in memory;
|
|
4
3
|
* new writes always use the latest version. */
|
|
@@ -17,12 +16,6 @@ type SourceFingerprint = {
|
|
|
17
16
|
rawTokensMtime: string | null;
|
|
18
17
|
rawTokensContentHash: string | null;
|
|
19
18
|
};
|
|
20
|
-
/** SHA-256 hashes of the JSON artifacts the wizard wrote to disk. Used on
|
|
21
|
-
* replay to detect manual edits to components.json / tokens.json. */
|
|
22
|
-
type SavedFingerprint = {
|
|
23
|
-
componentsJsonHash: string | null;
|
|
24
|
-
tokensJsonHash: string | null;
|
|
25
|
-
};
|
|
26
19
|
export type RunRecord = {
|
|
27
20
|
id: string;
|
|
28
21
|
createdAt: string;
|
|
@@ -34,8 +27,8 @@ export type RunRecord = {
|
|
|
34
27
|
* generated for the run. Added in runs.json v2. */
|
|
35
28
|
tokensPath: string | null;
|
|
36
29
|
/** Pipeline.db session id for the generated tokens. Null when no tokens
|
|
37
|
-
* step ran. Added in runs.json v2 so replay
|
|
38
|
-
*
|
|
30
|
+
* step ran. Added in runs.json v2 so replay and push can re-emit or
|
|
31
|
+
* re-push tokens. */
|
|
39
32
|
tokenSessionId: string | null;
|
|
40
33
|
agent: string;
|
|
41
34
|
pushedTo: {
|
|
@@ -51,14 +44,6 @@ export type RunRecord = {
|
|
|
51
44
|
* satisfy `RunRecord`; `appendRun` always normalizes a missing value to
|
|
52
45
|
* null on the way to disk. */
|
|
53
46
|
sourceFingerprint?: SourceFingerprint | null;
|
|
54
|
-
/** Saved-artifact fingerprint. Null on v1/v2 records read from disk; v3
|
|
55
|
-
* writers always populate. Added in runs.json v3. Optional for the same
|
|
56
|
-
* reason as `sourceFingerprint`. */
|
|
57
|
-
savedFingerprint?: SavedFingerprint | null;
|
|
58
|
-
/** Composition mode the run was produced in, so modify/replay resumes in the
|
|
59
|
-
* same mode (`composite` vs `atomic`). Absent on records written before this
|
|
60
|
-
* field existed; callers treat a missing value as `atomic` (the default). */
|
|
61
|
-
compositionMode?: CompositionMode;
|
|
62
47
|
notes?: string;
|
|
63
48
|
};
|
|
64
49
|
export type RunsFile = {
|
|
@@ -77,5 +62,4 @@ export type ListOptions = {
|
|
|
77
62
|
export declare function listRuns(opts?: ListOptions): Promise<RunRecord[]>;
|
|
78
63
|
export declare function getRun(id: string): Promise<RunRecord>;
|
|
79
64
|
export declare function updateRun(id: string, patch: Partial<Omit<RunRecord, 'id'>>): Promise<RunRecord>;
|
|
80
|
-
export declare function findAllRunsBySavePath(savePath: string): Promise<RunRecord[]>;
|
|
81
65
|
export {};
|
|
@@ -19,4 +19,4 @@ export declare function hashFile(filePath: string): Promise<string>;
|
|
|
19
19
|
* @param model — resolved model for this run (undefined resolves to the agent's default)
|
|
20
20
|
* @param skillPathOverride — optional absolute/relative path to a custom prompt
|
|
21
21
|
*/
|
|
22
|
-
export declare function hashPromptForSkill(skill: Skill, agent: string, model: string | undefined, skillPathOverride?: string, extraInputs?: string[]): Promise<string>;
|
|
22
|
+
export declare function hashPromptForSkill(skill: Skill, agent: string, model: string | undefined, skillPathOverride?: string, extraInputs?: string[], skillContentOverride?: string): Promise<string>;
|
package/dist/src/session/db.d.ts
CHANGED
|
@@ -6,17 +6,14 @@ import type { ComponentTypeSummary } from '@contentful/experience-design-system-
|
|
|
6
6
|
import type { SlotCycle, SlotEdge } from '../analyze/cycle-detection.js';
|
|
7
7
|
import { type MatchHints as SessionMatchHints } from './repositories/sessions/read.js';
|
|
8
8
|
import { type SessionResolution } from './services/session-resolver.js';
|
|
9
|
-
export { deriveComponentId } from './core/components/derive-component-id.js';
|
|
10
9
|
export { hashComponentShape as computeComponentInputHash } from './core/components/hash-component-shape.js';
|
|
11
10
|
export { hashTokenContent as computeTokenInputHash } from './core/tokens/hash-token-content.js';
|
|
12
|
-
export {
|
|
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';
|
|
11
|
+
export { getDtcgTokensForSession as loadDTCGTokens, getRawTokenNamePaths as loadRawTokenNamePaths, getRawTokenNamePathRows as loadRawTokenNamePathRows, } from './repositories/tokens/read.js';
|
|
15
12
|
export { storeDtcgTokens as storeDTCGTokens } from './services/tokens/store-dtcg-tokens.js';
|
|
16
|
-
export { applyTokenToolCalls
|
|
13
|
+
export { applyTokenToolCalls } from './services/tokens/apply-tool-calls.js';
|
|
17
14
|
export { replaceRawTokenNamePaths } from './services/tokens/replace-raw-token-name-paths.js';
|
|
18
15
|
export { replaceRawPropTokenPaths } from './services/tokens/replace-raw-prop-token-paths.js';
|
|
19
|
-
export type CommandName = 'analyze extract' | 'analyze select' | 'generate components' | 'generate tokens' | '
|
|
16
|
+
export type CommandName = 'analyze extract' | 'analyze select' | 'generate components' | 'generate tokens' | 'apply' | 'print components' | 'print tokens' | 'map tokens' | 'fetch existing entities' | 'import';
|
|
20
17
|
export declare function getPipelineDbPath(): string;
|
|
21
18
|
export declare function openPipelineDb(dbPath?: string): DatabaseSync;
|
|
22
19
|
export interface ApplyToolCallsResult {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
export declare function promptCodexModel(ask?: (q: string) => Promise<string>): Promise<string | undefined>;
|
|
3
|
-
export type SkillPromptKind = 'select' | 'generate';
|
|
4
3
|
/**
|
|
5
4
|
* Prompt the operator for a custom skill prompt path. Returns the resolved
|
|
6
5
|
* trimmed value, or `undefined` to leave the current value unchanged, or `null`
|
|
7
6
|
* to clear it. `ask` is injectable so tests can stub stdin.
|
|
8
7
|
*/
|
|
9
|
-
export declare function promptCustomSkillPath(
|
|
8
|
+
export declare function promptCustomSkillPath(current: string | undefined, ask?: (q: string) => Promise<string>): Promise<string | undefined | null>;
|
|
10
9
|
export declare function registerSetupCommand(program: Command): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.34.5-dev-build-
|
|
3
|
+
"version": "2.34.5-dev-build-75bf00ac.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,14 +33,15 @@
|
|
|
33
33
|
"@vue/compiler-sfc": "^3.5.31",
|
|
34
34
|
"commander": "^13.1.0",
|
|
35
35
|
"contentful-management": "^12.17.0",
|
|
36
|
+
"figures": "6.1.0",
|
|
36
37
|
"ink": "^5.2.1",
|
|
37
38
|
"react": "^18.3.1",
|
|
38
39
|
"react-devtools-core": "^4.19.1",
|
|
39
40
|
"svelte": "^5.56.4",
|
|
40
41
|
"ts-morph": "^27.0.2",
|
|
41
42
|
"typescript": "^5.9.3",
|
|
42
|
-
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-
|
|
43
|
-
"@contentful/experience-design-system-types": "2.34.5-dev-build-
|
|
43
|
+
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-75bf00ac.0",
|
|
44
|
+
"@contentful/experience-design-system-types": "2.34.5-dev-build-75bf00ac.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -52,9 +53,9 @@
|
|
|
52
53
|
"ink-testing-library": "^4.0.0",
|
|
53
54
|
"typescript-eslint": "^8.67.0",
|
|
54
55
|
"vitest": "^4.0.16",
|
|
55
|
-
"@contentful/experience-design-system-
|
|
56
|
-
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-
|
|
57
|
-
"@contentful/experience-design-system-
|
|
56
|
+
"@contentful/experience-design-system-generation": "2.34.5-dev-build-75bf00ac.0",
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-75bf00ac.0",
|
|
58
|
+
"@contentful/experience-design-system-client": "2.34.5-dev-build-75bf00ac.0"
|
|
58
59
|
},
|
|
59
60
|
"repository": {
|
|
60
61
|
"type": "git",
|
|
@@ -68,7 +68,7 @@ It is correct approximately 80% of the time for simple props. You should:
|
|
|
68
68
|
|
|
69
69
|
## Target schema
|
|
70
70
|
|
|
71
|
-
The CLI assembles your output into CDF (Component Definition Format), a JSON schema with `$schema: "https://contentful.com/schemas/cdf
|
|
71
|
+
The CLI assembles your output into CDF (Component Definition Format), a JSON schema with `$schema: "https://contentful.com/schemas/cdf"`. Each component you classify produces a CDF component entry (`$type: "component"`) in the pipeline database. Properties carry `$category` (`content`, `design`, or `state`) and a `$type`. You do not produce this JSON directly — emit tool calls and the CLI writes the DB columns.
|
|
72
72
|
|
|
73
73
|
## Output protocol
|
|
74
74
|
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { RawComponentDefinition } from '../types.js';
|
|
2
|
-
import type { AnalyzeViewResult } from './tui/AnalyzeView.js';
|
|
3
|
-
type AnalyzeViewRow = AnalyzeViewResult['components'][number];
|
|
4
|
-
export declare function isWarningForComponent(warning: string, componentName: string): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Split warnings into "global" (none of the surviving component-name prefixes
|
|
7
|
-
* match) and per-component (everything else, attached to rows by
|
|
8
|
-
* `buildAnalyzeViewRows`). The two halves MUST stay symmetric: every warning
|
|
9
|
-
* attached to a row must be excluded from globals (no double-render); every
|
|
10
|
-
* warning not attached to any row must fall through to globals (no silent drop).
|
|
11
|
-
*/
|
|
12
|
-
export declare function partitionGlobalWarnings(allWarnings: string[], componentNames: readonly string[]): string[];
|
|
13
|
-
/**
|
|
14
|
-
* Build the per-component rows shown in the analyze TUI / non-TTY summary,
|
|
15
|
-
* pairing each filtered component with its corresponding validation result.
|
|
16
|
-
*
|
|
17
|
-
* IMPORTANT — positional indexing is intentional and load-bearing.
|
|
18
|
-
* `validateExtractedComponents` is implemented as `.map()` over its input,
|
|
19
|
-
* so `validatedComponents[i]` always corresponds to `filteredComponents[i]`.
|
|
20
|
-
*
|
|
21
|
-
* We previously keyed validated components by `name` to "avoid a positional
|
|
22
|
-
* dependency" — that got the tradeoff exactly backwards. `Map.set` overwrites
|
|
23
|
-
* by key, so for two components named "Button" only the second's
|
|
24
|
-
* `validationIssues` survived in the Map. The first row's errors then
|
|
25
|
-
* disappeared from `analyzeResult` entirely: no Errors-section entry, no
|
|
26
|
-
* row badge, no count. Pairing by index restores correctness.
|
|
27
|
-
*/
|
|
28
|
-
export declare function buildAnalyzeViewRows(filteredComponents: RawComponentDefinition[], validatedComponents: RawComponentDefinition[], allWarnings: string[]): {
|
|
29
|
-
rows: AnalyzeViewRow[];
|
|
30
|
-
totalErrors: number;
|
|
31
|
-
};
|
|
32
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'commander';
|
|
2
|
-
import type { InterchangeMap } from './composition/interchange-schema.js';
|
|
3
|
-
import type { RawSlotDefinition } from '../types.js';
|
|
4
|
-
export declare function collectSourceFiles(directory: string, onProgress?: (scannedCount: number) => void): Promise<string[]>;
|
|
5
|
-
/**
|
|
6
|
-
* Build a { version, groups } interchange skeleton (spec T1) from the resolved
|
|
7
|
-
* components' slot allowedComponents — reflecting BOTH typed-slot edges the
|
|
8
|
-
* extractor found and anything the mapping resolver added.
|
|
9
|
-
*/
|
|
10
|
-
export declare function componentsToInterchangeMap(components: Array<{
|
|
11
|
-
name: string;
|
|
12
|
-
slots: RawSlotDefinition[];
|
|
13
|
-
}>): InterchangeMap;
|
|
14
|
-
export declare function registerAnalyzeCommand(program: Command): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cheap structural check that source matches the parser contract:
|
|
3
|
-
* `export default` of a function (declaration or arrow) that takes at least
|
|
4
|
-
* one parameter. Not a full parse — just enough to reject JSON samples, prose,
|
|
5
|
-
* and no-arg functions before we spend a sandbox spawn on them.
|
|
6
|
-
*/
|
|
7
|
-
export declare function looksLikeParser(source: string): boolean;
|
|
8
|
-
export declare function extractParserSource(stdout: string): string | null;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve a bundled prompt file from the package-root `prompts/` directory.
|
|
3
|
-
* Walks up from this module so it works from both `src/` and `dist/src/`,
|
|
4
|
-
* mirroring `resolveSkillPath` for the skills/ directory.
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolvePromptPath(fileName: string): string;
|
|
7
|
-
export declare function loadPrompt(fileName: string): string;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { CompositionEdge } from '../interchange-schema.js';
|
|
2
|
-
export type ResolveViaParserResult = {
|
|
3
|
-
edges: CompositionEdge[];
|
|
4
|
-
warnings: string[];
|
|
5
|
-
/** True when authoring/execution failed and the caller should fall back to
|
|
6
|
-
* direct edge-emission (or no composition). */
|
|
7
|
-
usedFallback: boolean;
|
|
8
|
-
/** The authored parser source, when one ran successfully (for caching). */
|
|
9
|
-
parserSource?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Agent-authored parser path (spec: agent-authored-parser, Phase 2).
|
|
13
|
-
*
|
|
14
|
-
* Ask the agent to WRITE a pure `(ctx) => Edge[]` parser, run it in the
|
|
15
|
-
* sandbox, and verify its edges against the component name set. One repair
|
|
16
|
-
* round if the authored parser fails to run; otherwise signal fallback. The
|
|
17
|
-
* agent call is injected so this is testable without spawning a subprocess.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveViaAgentParser(input: {
|
|
20
|
-
/** Files inlined into the authoring prompt — a bounded candidate sample so
|
|
21
|
-
* the agent sees the convention without ingesting the whole repo. */
|
|
22
|
-
files: Array<{
|
|
23
|
-
path: string;
|
|
24
|
-
content: string;
|
|
25
|
-
}>;
|
|
26
|
-
/** Files the authored parser actually RUNS over in the sandbox. Defaults to
|
|
27
|
-
* `files`; pass the full scanned set here so the parser is never starved by
|
|
28
|
-
* the prompt-side candidate filter (the filter stops being load-bearing). */
|
|
29
|
-
runtimeFiles?: Array<{
|
|
30
|
-
path: string;
|
|
31
|
-
content: string;
|
|
32
|
-
}>;
|
|
33
|
-
componentNames: Set<string>;
|
|
34
|
-
runAgentFn: (opts: {
|
|
35
|
-
prompt: string;
|
|
36
|
-
}) => Promise<string>;
|
|
37
|
-
instructionOverride?: string;
|
|
38
|
-
onPhase?: (phase: string) => void;
|
|
39
|
-
timeoutMs?: number;
|
|
40
|
-
/** When true, a parser that runs cleanly but emits ZERO verified edges is
|
|
41
|
-
* treated as suspicious (the candidate files contain composition markers, so
|
|
42
|
-
* 0 edges usually means a broken parser, not a genuinely flat repo) and gets
|
|
43
|
-
* one repair round. Off by default so genuinely-empty repos don't pay a
|
|
44
|
-
* wasted retry. The caller sets it from marker presence in the candidates. */
|
|
45
|
-
retryOnEmpty?: boolean;
|
|
46
|
-
}): Promise<ResolveViaParserResult>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { CompositionEdge } from '../interchange-schema.js';
|
|
2
|
-
export type SandboxCtx = {
|
|
3
|
-
files: Array<{
|
|
4
|
-
path: string;
|
|
5
|
-
content: string;
|
|
6
|
-
}>;
|
|
7
|
-
componentNames: string[];
|
|
8
|
-
};
|
|
9
|
-
export type SandboxResult = {
|
|
10
|
-
edges: CompositionEdge[];
|
|
11
|
-
error?: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Execute agent-authored parser source under three nested jails (spec:
|
|
15
|
-
* dsi-agent-authored-parser-design, Phase 1 — the security core).
|
|
16
|
-
*
|
|
17
|
-
* OUTER — a throwaway child `node` process: `env: {}` (no secrets/tokens leak
|
|
18
|
-
* even on a full escape), a heap cap (`--max-old-space-size`, OOM self-kills),
|
|
19
|
-
* and a wall-clock `SIGKILL` the parent enforces for any hang (sync or async).
|
|
20
|
-
*
|
|
21
|
-
* PERMISSION — the child runs with `--permission` and NO `--allow-fs-*`, so
|
|
22
|
-
* the Node runtime denies filesystem access, child_process spawning, worker
|
|
23
|
-
* creation, and native addons (ERR_ACCESS_DENIED). The parser needs none —
|
|
24
|
-
* its files arrive via stdin as ctx — so even a vm escape reaching
|
|
25
|
-
* `require('node:fs')`/`child_process` is stopped at the runtime layer.
|
|
26
|
-
*
|
|
27
|
-
* INNER — a `node:vm` context created from a null-prototype object, an
|
|
28
|
-
* ALLOW-LIST: it has only ECMAScript intrinsics (Object/Array/JSON/Math/RegExp
|
|
29
|
-
* …). There is no `process`, `require`, `Buffer`, `fetch`, timers, or module
|
|
30
|
-
* loader in scope, so the parser cannot reach them — and only STRINGS cross
|
|
31
|
-
* the boundary (source + JSON-encoded ctx), so there is no host-object handle
|
|
32
|
-
* for the classic `this.constructor.constructor('return process')()` escape to
|
|
33
|
-
* climb. `vm.runInContext(..., { timeout })` kills sync infinite loops.
|
|
34
|
-
*
|
|
35
|
-
* The parser must be SYNCHRONOUS — an async/thenable return is rejected, which
|
|
36
|
-
* closes the async-timeout gap (vm `timeout` covers sync execution only).
|
|
37
|
-
*
|
|
38
|
-
* Any failure — throw, timeout, OOM, denied access, bad/async return, compile
|
|
39
|
-
* error — resolves to `{ edges: [], error }` and is NEVER thrown. Returned
|
|
40
|
-
* edges are shape-validated here; the caller still re-verifies parent/child
|
|
41
|
-
* against the component name set.
|
|
42
|
-
*/
|
|
43
|
-
export declare function runParserInSandbox(source: string, ctx: SandboxCtx, opts?: {
|
|
44
|
-
timeoutMs?: number;
|
|
45
|
-
}): Promise<SandboxResult>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function buildDirCriticPrompt(dirs: string[]): string;
|
|
2
|
-
/**
|
|
3
|
-
* Parse the agent's reply into the chosen directories, keeping only ones that
|
|
4
|
-
* were offered (no injection). Lenient: extracts the first JSON array from
|
|
5
|
-
* surrounding prose; malformed / absent → [].
|
|
6
|
-
*/
|
|
7
|
-
export declare function parseDirCriticReply(reply: string, offered: string[]): string[];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Completeness critic for the candidate-file filter (design: the heuristic can
|
|
3
|
-
* miss a composition-layer directory whose name we didn't anticipate). We show
|
|
4
|
-
* the agent the DIRECTORIES it did NOT pick — names only, no file contents, so
|
|
5
|
-
* it's cheap — and let it flag ones that look promising from the path alone.
|
|
6
|
-
* Flagged dirs' files are folded into the prompt sample.
|
|
7
|
-
*
|
|
8
|
-
* This only widens the AUTHORING-PROMPT sample; the parser already runs over
|
|
9
|
-
* every file at runtime, so this is purely "help the agent see the convention",
|
|
10
|
-
* never a correctness dependency.
|
|
11
|
-
*/
|
|
12
|
-
type FileLike = {
|
|
13
|
-
path: string;
|
|
14
|
-
content: string;
|
|
15
|
-
};
|
|
16
|
-
/** Directories present in `all` but with no file in `selected`, sorted+deduped. */
|
|
17
|
-
export declare function uncoveredDirectories(all: FileLike[], selected: FileLike[]): string[];
|
|
18
|
-
/** Union `selected` with every `all` file whose directory is in `chosenDirs`. */
|
|
19
|
-
export declare function expandCandidatesByDirs(all: FileLike[], selected: FileLike[], chosenDirs: string[]): FileLike[];
|
|
20
|
-
export type CritiqueResult = {
|
|
21
|
-
files: FileLike[];
|
|
22
|
-
addedDirs: string[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Run the completeness critic. `askDirs` receives the uncovered directory names
|
|
26
|
-
* and returns the subset the agent judges composition-relevant. We only honor
|
|
27
|
-
* dirs that were actually offered (no injection), and any error from the agent
|
|
28
|
-
* falls back to the original selection — the critic can only ever ADD, never
|
|
29
|
-
* break resolution.
|
|
30
|
-
*/
|
|
31
|
-
export declare function critiqueCandidates(all: FileLike[], selected: FileLike[], askDirs: (dirs: string[]) => Promise<string[]>): Promise<CritiqueResult>;
|
|
32
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
-
export type SelectionContextSummary = {
|
|
3
|
-
boundaryRoot: string;
|
|
4
|
-
siblingFileCount: number;
|
|
5
|
-
resolverReferenceCount: number;
|
|
6
|
-
hasParentUsageSite: boolean;
|
|
7
|
-
};
|
|
8
|
-
type SelectionImportSummary = {
|
|
9
|
-
source: string;
|
|
10
|
-
names: string[];
|
|
11
|
-
local: boolean;
|
|
12
|
-
resolvedPath?: string;
|
|
13
|
-
};
|
|
14
|
-
type SelectionFileSummary = {
|
|
15
|
-
path: string;
|
|
16
|
-
exports: string[];
|
|
17
|
-
codeSnippet: string;
|
|
18
|
-
};
|
|
19
|
-
type SelectionReference = {
|
|
20
|
-
path: string;
|
|
21
|
-
snippet: string;
|
|
22
|
-
};
|
|
23
|
-
export type SelectionContext = {
|
|
24
|
-
boundaryRoot: string;
|
|
25
|
-
componentFile: {
|
|
26
|
-
path: string;
|
|
27
|
-
code: string;
|
|
28
|
-
};
|
|
29
|
-
imports: SelectionImportSummary[];
|
|
30
|
-
exports: string[];
|
|
31
|
-
siblingFiles: SelectionFileSummary[];
|
|
32
|
-
resolverReferences: SelectionReference[];
|
|
33
|
-
parentUsageSite?: SelectionReference;
|
|
34
|
-
};
|
|
35
|
-
type IndexedFile = {
|
|
36
|
-
absolutePath: string;
|
|
37
|
-
relativePath: string;
|
|
38
|
-
directory: string;
|
|
39
|
-
text: string;
|
|
40
|
-
};
|
|
41
|
-
export type RepoContextIndex = {
|
|
42
|
-
root: string;
|
|
43
|
-
files: IndexedFile[];
|
|
44
|
-
byDirectory: Map<string, IndexedFile[]>;
|
|
45
|
-
filePaths: Set<string>;
|
|
46
|
-
};
|
|
47
|
-
export declare function buildRepoContextIndex(root: string, filePaths: string[]): Promise<RepoContextIndex | null>;
|
|
48
|
-
export declare function buildSelectionContext(index: RepoContextIndex, component: RawComponentDefinition): SelectionContext | undefined;
|
|
49
|
-
export declare function summarizeSelectionContext(context: SelectionContext | undefined): SelectionContextSummary | undefined;
|
|
50
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Top-level dispatch for `analyze select-agent --show-rationale`. Pure I/O
|
|
3
|
-
* boundary: reads DB, writes formatted output to stdout, throws on error.
|
|
4
|
-
*/
|
|
5
|
-
export declare function runShowRationale(opts: {
|
|
6
|
-
session?: string;
|
|
7
|
-
json?: boolean;
|
|
8
|
-
dbPath?: string;
|
|
9
|
-
}): void;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type AnalyzeViewResult = {
|
|
3
|
-
sourceDirectory: string;
|
|
4
|
-
sessionId: string;
|
|
5
|
-
fileCount: number;
|
|
6
|
-
components: Array<{
|
|
7
|
-
name: string;
|
|
8
|
-
framework: 'react' | 'next' | 'vue' | 'astro' | 'web-component' | 'stencil' | 'svelte';
|
|
9
|
-
propCount: number;
|
|
10
|
-
slotCount: number;
|
|
11
|
-
warnings: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Error-severity validation messages. Components with any errors will be
|
|
14
|
-
* auto-rejected by the next step (`analyze select --select-all`), so the
|
|
15
|
-
* extract TUI surfaces them prominently — both with a per-row ✗ badge
|
|
16
|
-
* and a dedicated Errors section below the component list.
|
|
17
|
-
*/
|
|
18
|
-
errors: string[];
|
|
19
|
-
extractionConfidence: number | null;
|
|
20
|
-
needsReview: boolean;
|
|
21
|
-
}>;
|
|
22
|
-
totalWarnings: number;
|
|
23
|
-
totalErrors: number;
|
|
24
|
-
/**
|
|
25
|
-
* Top-level warnings not associated with any surviving component:
|
|
26
|
-
* - retry-pass summary lines
|
|
27
|
-
* - "Skipped non-authorable component: …" — the component was filtered out and has no row to attach to
|
|
28
|
-
* - any other extractor warning whose prefix doesn't match a component in `components`
|
|
29
|
-
* Always rendered at the top of the Warnings panel so they're visible in the TUI.
|
|
30
|
-
* Optional for backwards compatibility with older fixtures; treated as `[]` when absent.
|
|
31
|
-
*/
|
|
32
|
-
globalWarnings?: string[];
|
|
33
|
-
};
|
|
34
|
-
type AnalyzeViewProps = {
|
|
35
|
-
result: AnalyzeViewResult;
|
|
36
|
-
onExit: () => void;
|
|
37
|
-
};
|
|
38
|
-
export declare function AnalyzeView({ result, onExit }: AnalyzeViewProps): React.ReactElement;
|
|
39
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { readTokensFromPath, hasBreakingChangesWithImpact } from './command.js';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface SelectableEntity {
|
|
3
|
-
id: string;
|
|
4
|
-
kind: 'token' | 'component';
|
|
5
|
-
status: 'new' | 'changed';
|
|
6
|
-
isBreaking?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function makeSelectKey(kind: 'token' | 'component', id: string): string;
|
|
9
|
-
interface SelectViewProps {
|
|
10
|
-
entities: SelectableEntity[];
|
|
11
|
-
spaceId: string;
|
|
12
|
-
environmentId: string;
|
|
13
|
-
selectedIndex: number;
|
|
14
|
-
selected: Set<string>;
|
|
15
|
-
importing: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare function SelectView({ entities, spaceId, environmentId, selectedIndex, selected, importing, }: SelectViewProps): React.ReactElement;
|
|
18
|
-
export {};
|