@contentful/experience-design-system-cli 2.41.1-dev-build-699ca2d9.0 → 2.41.1-dev-build-06624ee7.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/app.js +767 -240
- package/dist/index.js +810 -258
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +2 -0
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +23 -1
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +4 -1
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +14 -1
- package/dist/src/tui/import/steps/07-scope-gate/log.d.ts +8 -0
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +8 -1
- package/dist/src/tui/import/steps/09-review/review-log.d.ts +31 -0
- package/dist/src/tui/import/steps/09-review/use-review-log.d.ts +20 -0
- package/dist/src/tui/import/steps/09-review/use-review-session.d.ts +3 -1
- package/dist/src/tui/import/steps/10-flow/flow/flow-log.d.ts +46 -0
- package/dist/src/tui/import/steps/10-flow/flow/use-flow-log.d.ts +7 -0
- package/dist/src/tui/settings/configuration/agents/agent-debug.d.ts +1 -1
- package/package.json +3 -3
- /package/dist/src/tui/{settings/shared → shared}/debug-trail.d.ts +0 -0
package/dist/package.json
CHANGED
|
@@ -24,6 +24,8 @@ export declare function startDebugRun({ flow, step, menuOption, inputs, }: {
|
|
|
24
24
|
menuOption: string;
|
|
25
25
|
inputs: Record<string, unknown>;
|
|
26
26
|
}): void;
|
|
27
|
+
/** Keeps what the open run has so far, in memory. It is only written if the run is cut short. */
|
|
28
|
+
export declare function setDebugRunProgress(outputs: Record<string, unknown>): void;
|
|
27
29
|
export declare function finishDebugRun({ outputs, status, exitMethod, }: {
|
|
28
30
|
outputs: Record<string, unknown>;
|
|
29
31
|
status: Status;
|
|
@@ -7,6 +7,28 @@ export type CredentialValues = Record<CredentialField, string>;
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function credentialsPurpose(tokensOnly: boolean): string;
|
|
9
9
|
export declare function normalize(values: CredentialValues): CredentialValues;
|
|
10
|
-
|
|
10
|
+
/** The required fields that are still empty, by name. */
|
|
11
|
+
export declare function missingFields(values: CredentialValues): CredentialField[];
|
|
11
12
|
export declare function isUnchanged(current: CredentialValues, initial: CredentialValues): boolean;
|
|
13
|
+
export type CredentialAttempt = {
|
|
14
|
+
host: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One rejected attempt as the log records it. The reason is scrubbed of the token first: an API error can echo what it
|
|
19
|
+
* was sent, so the message the user saw may contain it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function rejectedAttempt(reason: string, credentials: CredentialValues): CredentialAttempt;
|
|
22
|
+
/**
|
|
23
|
+
* The credentials as the log shows them. `cma_token` is the only key the token may be under: the logger reduces it to
|
|
24
|
+
* "present, N chars", which is enough to spot a truncated paste without writing the secret.
|
|
25
|
+
*/
|
|
26
|
+
export declare function credentialsLog(credentials: CredentialValues): Record<string, unknown>;
|
|
27
|
+
/** The log's outputs: where the user ended up, the credentials, which fields they changed (names only), and the rejections. */
|
|
28
|
+
export declare function credentialsOutputs({ outcome, credentials, initial, attempts, }: {
|
|
29
|
+
outcome: 'validated' | 'back';
|
|
30
|
+
credentials: CredentialValues;
|
|
31
|
+
initial: CredentialValues;
|
|
32
|
+
attempts: readonly CredentialAttempt[];
|
|
33
|
+
}): Record<string, unknown>;
|
|
12
34
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ImportTarget } from '../00-preflight/logic.js';
|
|
2
3
|
import { type CredentialValues } from './logic.js';
|
|
3
4
|
import { type ValidationResult } from './validate.js';
|
|
4
5
|
export type CredentialsResult = {
|
|
@@ -8,6 +9,8 @@ export type CredentialsResult = {
|
|
|
8
9
|
skipped: true;
|
|
9
10
|
};
|
|
10
11
|
interface CredentialsScreenProps {
|
|
12
|
+
/** What the user chose to import at Preflight; it decides which steps run, so every log notes it. */
|
|
13
|
+
mode: ImportTarget;
|
|
11
14
|
onDone: (result: CredentialsResult) => void;
|
|
12
15
|
onBack: () => void;
|
|
13
16
|
initial?: Partial<CredentialValues>;
|
|
@@ -15,5 +18,5 @@ interface CredentialsScreenProps {
|
|
|
15
18
|
/** The import only generates tokens, so there are no components to look up in the space. */
|
|
16
19
|
tokensOnly?: boolean;
|
|
17
20
|
}
|
|
18
|
-
export declare function CredentialsScreen({ onDone, onBack, initial, validate, tokensOnly, }: CredentialsScreenProps): React.ReactElement;
|
|
21
|
+
export declare function CredentialsScreen({ mode, onDone, onBack, initial, validate, tokensOnly, }: CredentialsScreenProps): React.ReactElement;
|
|
19
22
|
export {};
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { ExtractAndComposeProgress } from '@contentful/experience-design-system-backend-pipeline';
|
|
2
|
-
import type { ExtractionProgress } from './types.js';
|
|
2
|
+
import type { ExtractionInput, ExtractionProgress, ExtractionResult } from './types.js';
|
|
3
3
|
/** Structured progress events emitted by the orchestrator (extraction + composition). */
|
|
4
4
|
export type ProgressEvent = ExtractAndComposeProgress;
|
|
5
|
+
/**
|
|
6
|
+
* What the debug log says the stage started with. The credentials come with the input, so the CMA token is only ever put
|
|
7
|
+
* under `cma_token`, which the logger reduces to "present, N chars" (or "not set" when the credentials were skipped).
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractionLogInputs(input: ExtractionInput): Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* How the stage ended. A failure names the step that failed and its message, scrubbed of the CMA token; the last progress
|
|
12
|
+
* says which of the parallel jobs had finished, failed or was still running.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractionLogOutputs(result: ExtractionResult, progress: ExtractionProgress | undefined, cmaToken: string): {
|
|
15
|
+
outputs: Record<string, unknown>;
|
|
16
|
+
status: 'success' | 'error';
|
|
17
|
+
};
|
|
5
18
|
/**
|
|
6
19
|
* Every job the stage will run starts on the first frame, so no row appears later as a surprise. A job that does not
|
|
7
20
|
* apply stays 'idle' and has no row: existing entities need credentials, and token definitions need a raw tokens file.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScopeComponent, ScopeDecisions } from './types.js';
|
|
2
|
+
/** What the gate starts with: how many components, and what the AI suggested for them. */
|
|
3
|
+
export declare function scopeGateLogInputs(components: ScopeComponent[], tokenCount: number): Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* What the user decided. Everything not accepted counts as rejected, so a component the AI accepted and the user never
|
|
6
|
+
* touched shows as left out. Components with the same name share one decision, so names are counted once.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scopeGateLogOutputs(components: ScopeComponent[], decisions: ScopeDecisions): Record<string, unknown>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type { GenerationProgress } from './types.js';
|
|
1
|
+
import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
|
|
2
|
+
/** What the debug log says the stage started with. The counts are logged, not the lists of names. */
|
|
3
|
+
export declare function generationLogInputs(input: GenerationInput): Record<string, unknown>;
|
|
4
|
+
/** How the stage ended. A failure names the step that failed (save decisions, generate components, map tokens). */
|
|
5
|
+
export declare function generationLogOutputs(result: GenerationResult, progress: GenerationProgress | undefined): {
|
|
6
|
+
outputs: Record<string, unknown>;
|
|
7
|
+
status: 'success' | 'error';
|
|
8
|
+
};
|
|
2
9
|
export declare function initialProgress(): GenerationProgress;
|
|
3
10
|
export declare function shouldRunMapTokens(counts: {
|
|
4
11
|
mappablePropCount: number;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CdfReviewEntry, ReviewComponentStatus } from './types.js';
|
|
2
|
+
export declare const REVIEW_RUN: {
|
|
3
|
+
readonly flow: "import/review";
|
|
4
|
+
readonly step: "09-review";
|
|
5
|
+
readonly menuOption: "Review";
|
|
6
|
+
};
|
|
7
|
+
export type ReviewTrail = {
|
|
8
|
+
startedAt: number;
|
|
9
|
+
/** How each component arrived, by key. */
|
|
10
|
+
start: Map<string, ReviewComponentStatus>;
|
|
11
|
+
/** The edits in order, as the history labels them (for example `edit-save` or `token-review:size`). */
|
|
12
|
+
actions: string[];
|
|
13
|
+
/** The same edits counted by kind, so a long session still reads at a glance. */
|
|
14
|
+
kinds: Record<string, number>;
|
|
15
|
+
};
|
|
16
|
+
/** What the review starts with: how many components, and how the AI and the checks left them. */
|
|
17
|
+
export declare function reviewInputs(components: CdfReviewEntry[]): Record<string, unknown>;
|
|
18
|
+
export declare function openReviewTrail(components: CdfReviewEntry[], now: number): ReviewTrail;
|
|
19
|
+
export declare function recordReviewAction(trail: ReviewTrail, label: string): void;
|
|
20
|
+
/** What a crash or Ctrl+C writes if it cuts the review short. */
|
|
21
|
+
export declare function reviewProgress(trail: ReviewTrail, components: CdfReviewEntry[], now: number): Record<string, unknown>;
|
|
22
|
+
/** How the review ended. `final` is the count the user confirmed, or undefined when the review was left without finishing. */
|
|
23
|
+
export declare function reviewFinish(trail: ReviewTrail, components: CdfReviewEntry[], now: number, final: {
|
|
24
|
+
accepted: number;
|
|
25
|
+
rejected: number;
|
|
26
|
+
unresolved: number;
|
|
27
|
+
} | undefined): {
|
|
28
|
+
outputs: Record<string, unknown>;
|
|
29
|
+
status: 'success';
|
|
30
|
+
exitMethod: 'saved' | 'discarded';
|
|
31
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CdfReviewEntry } from './types.js';
|
|
2
|
+
type Counts = {
|
|
3
|
+
accepted: number;
|
|
4
|
+
rejected: number;
|
|
5
|
+
unresolved: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Writes one debug log for a visit to the Review. It starts once the components are loaded, grows in memory as the user
|
|
9
|
+
* edits, and is written when they finalize or leave. The trail is also handed to the logger as it grows, so a crash or
|
|
10
|
+
* Ctrl+C writes what happened so far. Going back to the review later is a new visit and a new log.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useReviewLog({ loading, loadError, components, }: {
|
|
13
|
+
loading: boolean;
|
|
14
|
+
loadError: string | null | undefined;
|
|
15
|
+
components: CdfReviewEntry[];
|
|
16
|
+
}): {
|
|
17
|
+
record: (label: string) => void;
|
|
18
|
+
finish: (counts: Counts) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -31,8 +31,10 @@ type UseReviewHistoryOptions = {
|
|
|
31
31
|
components: CdfReviewEntry[];
|
|
32
32
|
createSnapshot: (components: CdfReviewEntry[]) => HistorySnapshot;
|
|
33
33
|
applySnapshot: (snapshot: HistorySnapshot) => void;
|
|
34
|
+
/** Told what each edit was called, and about each undo and redo, so the debug log can follow the session. */
|
|
35
|
+
onAction?: (label: string) => void;
|
|
34
36
|
};
|
|
35
|
-
export declare function useReviewHistory({ loading, components, createSnapshot, applySnapshot }: UseReviewHistoryOptions): {
|
|
37
|
+
export declare function useReviewHistory({ loading, components, createSnapshot, applySnapshot, onAction, }: UseReviewHistoryOptions): {
|
|
36
38
|
historySeededRef: {
|
|
37
39
|
current: boolean;
|
|
38
40
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FlowState } from './types.js';
|
|
2
|
+
type FlowStep = FlowState['step'];
|
|
3
|
+
/** Where the log goes: one folder for the whole step, numbered so it sorts after the earlier steps. */
|
|
4
|
+
export declare const FLOW_RUN: {
|
|
5
|
+
readonly flow: "import/publish";
|
|
6
|
+
readonly step: "10-publish";
|
|
7
|
+
readonly menuOption: "Publish";
|
|
8
|
+
};
|
|
9
|
+
export type FlowTrail = {
|
|
10
|
+
startedAt: number;
|
|
11
|
+
stageStartedAt: number;
|
|
12
|
+
/** The step the flow is in now. */
|
|
13
|
+
at: FlowStep;
|
|
14
|
+
stages: string[];
|
|
15
|
+
preview?: Record<string, unknown>;
|
|
16
|
+
push?: Record<string, unknown>;
|
|
17
|
+
pushFailed?: boolean;
|
|
18
|
+
saved?: {
|
|
19
|
+
path: string;
|
|
20
|
+
run_id: string | null;
|
|
21
|
+
};
|
|
22
|
+
failure?: {
|
|
23
|
+
step: string;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
validation?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
/** What the run starts with, stated once. The token is only ever under `cma_token`, which the logger reduces to "present, N chars". */
|
|
29
|
+
export declare function flowContext(state: FlowState): Record<string, unknown>;
|
|
30
|
+
/** Starts the trail at the state the run began in. */
|
|
31
|
+
export declare function openTrail(state: FlowState, now: number): FlowTrail;
|
|
32
|
+
/** Adds what happened when the flow moved from one step to the next. */
|
|
33
|
+
export declare function advance(trail: FlowTrail, from: FlowState, to: FlowState, now: number): FlowTrail;
|
|
34
|
+
export declare const isFlowFinished: (step: FlowStep) => boolean;
|
|
35
|
+
/** What a crash or Ctrl+C writes if it cuts the run short. */
|
|
36
|
+
export declare function flowProgress(trail: FlowTrail, now: number): Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* How the run ended. `final` is the state it ended in, or undefined when the import was left while the run was open. The
|
|
39
|
+
* outcome names the cause, so a failed push or preview says why in the first line of its own log.
|
|
40
|
+
*/
|
|
41
|
+
export declare function flowFinish(trail: FlowTrail, final: FlowState | undefined, now: number): {
|
|
42
|
+
outputs: Record<string, unknown>;
|
|
43
|
+
status: 'success' | 'error';
|
|
44
|
+
exitMethod: 'saved' | 'discarded';
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FlowState } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Writes one debug log for the flow after the review. The trail grows in memory as the step changes; the log is written
|
|
4
|
+
* when the flow reaches done or an error, goes back to the review, or when the import is left. The trail is also handed to
|
|
5
|
+
* the logger as it grows, so a crash or Ctrl+C writes what happened so far. The review is its own step with its own log.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFlowLog(state: FlowState): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentName } from '@contentful/experience-design-system-backend-pipeline';
|
|
2
|
-
import type { Snapshot } from '
|
|
2
|
+
import type { Snapshot } from '@tui/shared/debug-trail.js';
|
|
3
3
|
import type { AgentConfig } from './agent-store.js';
|
|
4
4
|
/**
|
|
5
5
|
* The agent settings as flat text, for `diffSnapshots`: `default_agent`, then `<agent>.model` and `<agent>.binary` for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.41.1-dev-build-
|
|
3
|
+
"version": "2.41.1-dev-build-06624ee7.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-types": "2.41.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.41.1-dev-build-06624ee7.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"ink-testing-library": "^4.0.0",
|
|
60
60
|
"typescript-eslint": "^8.67.0",
|
|
61
61
|
"vitest": "^4.0.16",
|
|
62
|
-
"@contentful/experience-design-system-backend-pipeline": "2.41.1-dev-build-
|
|
62
|
+
"@contentful/experience-design-system-backend-pipeline": "2.41.1-dev-build-06624ee7.0"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
|
File without changes
|