@contentful/experience-design-system-cli 2.38.0 → 2.38.1-dev-build-6d903339.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.d.ts +3 -6
- package/dist/app.js +28155 -642
- package/dist/index.js +32060 -421
- package/dist/package.json +8 -3
- package/dist/src/commands/import-options.d.ts +12 -0
- package/dist/src/commands/import.d.ts +2 -1
- package/dist/src/tui/home/home.theme.d.ts +1 -2
- package/dist/src/tui/import/resolve-user-path.d.ts +1 -0
- package/dist/src/tui/import/shared/error-step/controls.d.ts +7 -0
- package/{legacy/dist/src/import/tui/steps/ErrorStep.d.ts → dist/src/tui/import/shared/error-step/error-step.d.ts} +2 -2
- package/dist/src/tui/import/shared/error-step/logic.d.ts +15 -0
- package/dist/src/tui/import/shared/gate-step/controls.d.ts +8 -0
- package/dist/src/tui/import/shared/gate-step/gate-step.d.ts +14 -0
- package/dist/src/tui/import/shared/gate-step/logic.d.ts +11 -0
- package/dist/src/tui/import/shared/index.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/logic.d.ts +12 -0
- package/dist/src/tui/import/shared/running-step/running-step.d.ts +11 -0
- package/dist/src/tui/import/shared/running-step/theme.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/use-elapsed.d.ts +1 -0
- package/dist/src/tui/import/steps/03-path-validation/controls.d.ts +13 -0
- package/dist/src/tui/import/steps/03-path-validation/helpers/scan-files.d.ts +10 -0
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +43 -0
- package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +12 -0
- package/dist/src/tui/import/steps/04-credentials/controls.d.ts +21 -0
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +15 -0
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +17 -0
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +8 -0
- package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +21 -0
- package/dist/src/tui/import/steps/05-token-reuse/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/06-extraction/find-skill-path.d.ts +1 -0
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +48 -0
- package/dist/src/tui/import/steps/06-extraction/run.d.ts +26 -0
- package/dist/src/tui/import/steps/06-extraction/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/06-extraction/selection.d.ts +18 -0
- package/dist/src/tui/import/steps/06-extraction/types.d.ts +46 -0
- package/dist/src/tui/import/steps/06-extraction/use-extraction.d.ts +14 -0
- package/dist/src/tui/import/steps/07-scope-gate/cache-check.d.ts +17 -0
- package/{legacy/dist/src/import/tui/scope-gate-columns.d.ts → dist/src/tui/import/steps/07-scope-gate/columns.d.ts} +22 -2
- package/dist/src/tui/import/steps/07-scope-gate/graph/composite-closure.d.ts +26 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/cycle-detection.d.ts +27 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/fuzzy-search.d.ts +3 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/index.d.ts +33 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/lineage.d.ts +29 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/search-neighborhood.d.ts +3 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/slot-graph.d.ts +11 -0
- package/dist/src/tui/import/steps/07-scope-gate/keymap.d.ts +84 -0
- package/dist/src/tui/import/steps/07-scope-gate/load.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/added-column.d.ts +15 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/cycles-panel.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/reject-prompt.d.ts +5 -0
- package/dist/src/tui/import/steps/07-scope-gate/screen.d.ts +9 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GotoBanner.d.ts +32 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.d.ts +93 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/HelpOverlay.d.ts +21 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/badge.d.ts +13 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/windowed-panel.d.ts +31 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/group-collapse.d.ts +1 -1
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.d.ts +6 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.d.ts +19 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-help.d.ts +1 -1
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-navigation.d.ts +2 -2
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/theme.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/types.d.ts +7 -0
- package/dist/src/tui/import/steps/07-scope-gate/state.d.ts +19 -0
- package/dist/src/tui/import/steps/07-scope-gate/types.d.ts +24 -0
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.d.ts +27 -0
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate.d.ts +76 -0
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +27 -0
- package/dist/src/tui/import/steps/08-generation/map-tokens.d.ts +14 -0
- package/dist/src/tui/import/steps/08-generation/run.d.ts +22 -0
- package/dist/src/tui/import/steps/08-generation/save-decisions.d.ts +8 -0
- package/dist/src/tui/import/steps/08-generation/screen.d.ts +12 -0
- package/dist/src/tui/import/steps/08-generation/types.d.ts +47 -0
- package/dist/src/tui/import/steps/08-generation/use-generation.d.ts +14 -0
- package/dist/src/tui/import/steps/09-review/components/ComponentRationalePanel.d.ts +10 -0
- package/dist/src/tui/import/steps/09-review/components/FieldEditor.d.ts +67 -0
- package/dist/src/tui/import/steps/09-review/components/FinalizeDialog.d.ts +22 -0
- package/dist/src/tui/import/steps/09-review/components/HighlightedLine.d.ts +9 -0
- package/dist/src/tui/import/steps/09-review/components/JsonPanel.d.ts +11 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/LivePreviewSummary.d.ts +2 -2
- package/dist/src/tui/import/steps/09-review/components/QuitDialog.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/components/RationaleLine.d.ts +21 -0
- package/dist/src/tui/import/steps/09-review/components/RationalePanel.d.ts +15 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewComponentPanel.d.ts +3 -3
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDetailsEditor.d.ts +3 -3
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDialogs.d.ts +2 -2
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewStatus.d.ts +1 -1
- package/dist/src/tui/import/steps/09-review/components/ScrollablePanel.d.ts +14 -0
- package/dist/src/tui/import/steps/09-review/components/TokenReviewPanel.d.ts +30 -0
- package/dist/src/tui/import/steps/09-review/components/removed-components-text.d.ts +7 -0
- package/dist/src/tui/import/steps/09-review/components/wrap-text.d.ts +1 -0
- package/{legacy/dist/src/import/tui/steps/GenerateReviewStep.d.ts → dist/src/tui/import/steps/09-review/generate-review-step.d.ts} +1 -1
- package/{legacy/dist/src/import → dist/src/tui/import/steps/09-review/graph}/cycle-auto-reject.d.ts +1 -1
- package/{legacy/dist/src/analyze → dist/src/tui/import/steps/09-review/graph}/cycle-view.d.ts +2 -2
- package/dist/src/tui/import/steps/09-review/graph/issue-inheritance.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/graph/selection-cascade.d.ts +3 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/enumerate-cycle-breaks.d.ts +1 -1
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/history.d.ts +1 -1
- package/dist/src/tui/import/steps/09-review/preview-annotations.d.ts +26 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-details-panel.d.ts +2 -2
- package/{legacy/dist/src/import/tui/hooks → dist/src/tui/import/steps/09-review}/review-input.d.ts +2 -2
- package/{legacy/dist/src/import/tui/runLivePreview.d.ts → dist/src/tui/import/steps/09-review/run-live-preview.d.ts} +2 -3
- package/dist/src/tui/import/steps/09-review/scroll-offset.d.ts +30 -0
- package/dist/src/tui/import/steps/09-review/session.d.ts +26 -0
- package/dist/src/tui/import/steps/09-review/theme.d.ts +9 -0
- package/dist/src/tui/import/steps/09-review/token-suggestions.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/types.d.ts +19 -0
- package/{legacy/dist/src/import/tui/hooks/useReviewEditor.d.ts → dist/src/tui/import/steps/09-review/use-review-editor.d.ts} +1 -3
- package/{legacy/dist/src/import/tui/hooks/useReviewPreview.d.ts → dist/src/tui/import/steps/09-review/use-review-preview.d.ts} +2 -2
- package/{legacy/dist/src/import/tui/hooks/useReviewSession.d.ts → dist/src/tui/import/steps/09-review/use-review-session.d.ts} +5 -35
- package/dist/src/tui/import/steps/10-flow/flow/build-flow-start.d.ts +21 -0
- package/dist/src/tui/import/steps/10-flow/flow/controller.d.ts +65 -0
- package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +56 -0
- package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +43 -0
- package/dist/src/tui/import/steps/10-flow/flow/save.d.ts +50 -0
- package/dist/src/tui/import/steps/10-flow/flow/screen.d.ts +17 -0
- package/dist/src/tui/import/steps/10-flow/flow/types.d.ts +71 -0
- package/dist/src/tui/import/steps/10-flow/flow/use-flow.d.ts +9 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/PushingStep.d.ts +1 -1
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/WizardPreviewStep.d.ts +0 -1
- package/dist/src/tui/import/steps/10-flow/support/contentful-urls.d.ts +15 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/wizard-state-transitions.d.ts +0 -13
- package/dist/src/tui/import/steps/10-flow/theme.d.ts +13 -0
- package/dist/src/tui/import/steps/index.d.ts +4 -0
- package/dist/src/tui/import/steps/preview-validation-error/logic.d.ts +12 -0
- package/dist/src/tui/import/steps/preview-validation-error/screen.d.ts +11 -0
- package/dist/src/tui/user-agent.d.ts +5 -0
- package/legacy/dist/package.json +4 -1
- package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +2 -2
- package/legacy/dist/src/analyze/select/tui/theme.d.ts +1 -1
- package/legacy/dist/src/index.js +15073 -23076
- package/legacy/package.json +8 -3
- package/package.json +8 -3
- package/skills/generate-components.md +612 -0
- package/skills/generate-tokens.md +194 -0
- package/skills/map-tokens.md +102 -0
- package/skills/select-components.md +235 -0
- package/dist/src/tui/import/spawn-v1-import.d.ts +0 -29
- package/dist/src/tui/import/terminal-input.d.ts +0 -2
- package/legacy/dist/src/import/agent-model-resolve.d.ts +0 -27
- package/legacy/dist/src/import/command.d.ts +0 -2
- package/legacy/dist/src/import/composition-options.d.ts +0 -7
- package/legacy/dist/src/import/tui/WizardApp.d.ts +0 -67
- package/legacy/dist/src/import/tui/run-selection-agent.d.ts +0 -9
- package/legacy/dist/src/import/tui/runScopeGate.d.ts +0 -12
- package/legacy/dist/src/import/tui/spawn-generate.d.ts +0 -33
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +0 -43
- package/legacy/dist/src/import/tui/steps/GateStep.d.ts +0 -15
- package/legacy/dist/src/import/tui/steps/PathValidationStep.d.ts +0 -10
- package/legacy/dist/src/import/tui/steps/PreviewValidationErrorStep.d.ts +0 -11
- package/legacy/dist/src/import/tui/steps/RunningStep.d.ts +0 -32
- package/legacy/dist/src/import/tui/steps/ScopeGateStep.d.ts +0 -48
- package/legacy/dist/src/import/tui/steps/TokenInputStep.d.ts +0 -8
- package/legacy/dist/src/import/tui/steps/WelcomeStep.d.ts +0 -7
- package/legacy/dist/src/import/tui/wizard-422-helpers.d.ts +0 -48
- package/legacy/dist/src/import/tui/wizard-generate-progress.d.ts +0 -21
- /package/{legacy/dist/src/analyze → dist/src/tui/import/steps/07-scope-gate/graph}/scope-gate-cascade.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/ai-flag.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/autocomplete.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/CompactControlBar.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/CounterStrip.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/LegendEntry.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/SearchMatchSummary.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/hooks/sidebar-search-state.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/hooks/useOverlayPanel.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/lineage-layout.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-input.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/step-filters.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/auto-reject-decision.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/breaking-change-format.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/cycle-panel-scroll.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/sidebar-width.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-json-panel.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/useFinalizePreview.d.ts → dist/src/tui/import/steps/09-review/use-finalize-preview.d.ts} +0 -0
- /package/{legacy/dist/src/import/tui/useLivePreview.d.ts → dist/src/tui/import/steps/09-review/use-live-preview.d.ts} +0 -0
- /package/{legacy/dist/src/import/tui/hooks/useReviewSurfaceState.d.ts → dist/src/tui/import/steps/09-review/use-review-surface-state.d.ts} +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/components}/CustomPromptBanner.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/SpaceEnvironment.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/StepHeader.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/DoneStep.d.ts +0 -0
- /package/{legacy/dist/src/runs/path-prompt.d.ts → dist/src/tui/import/steps/10-flow/screens/PathPrompt.d.ts} +0 -0
- /package/{legacy/dist/src/import → dist/src/tui/import/steps/10-flow/support}/path-utils.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/preview-confirmation-input.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/support}/preview-diff.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/push-progress.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-print-files-helpers.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-teaser.d.ts +0 -0
- /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-blinking-cursor.d.ts +0 -0
- /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-timed-spinner.d.ts +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** A directed edge in the slot-dependency graph. */
|
|
2
|
+
export interface SlotEdge {
|
|
3
|
+
fromComponent: string;
|
|
4
|
+
slotName: string;
|
|
5
|
+
toComponent: string;
|
|
6
|
+
}
|
|
7
|
+
/** A single elementary cycle, with `path[0] === path[path.length - 1]`. */
|
|
8
|
+
export interface SlotCycle {
|
|
9
|
+
path: string[];
|
|
10
|
+
edges: SlotEdge[];
|
|
11
|
+
}
|
|
12
|
+
/** Input shape mirroring the slot definition on CDFComponentEntry. */
|
|
13
|
+
export interface ComponentSlotInfo {
|
|
14
|
+
name: string;
|
|
15
|
+
slots: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
allowedComponents?: string[];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare function findSlotCycles(components: ComponentSlotInfo[]): SlotCycle[];
|
|
21
|
+
export declare function suggestCycleBreakEdge(cycle: SlotCycle, allCycles: SlotCycle[]): SlotEdge;
|
|
22
|
+
export declare function formatCyclePath(cycle: SlotCycle, maxHops?: number): string;
|
|
23
|
+
export interface CyclePathSegment {
|
|
24
|
+
kind: 'component' | 'slot' | 'arrow';
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function formatCyclePathSegments(cycle: SlotCycle, maxHops?: number): CyclePathSegment[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
import type { ScopeComponent } from '../types.js';
|
|
3
|
+
import { type Closure, type ComponentGraphNode, type NodeStatus } from './composite-closure.js';
|
|
4
|
+
import { type SlotCycle } from './cycle-detection.js';
|
|
5
|
+
export interface ScopeGraph {
|
|
6
|
+
/** The slot dependency graph, one node per component. */
|
|
7
|
+
nodes: ComponentGraphNode[];
|
|
8
|
+
/** Every slot cycle. A graph that cannot be searched for cycles has none, as in legacy. */
|
|
9
|
+
cycles: SlotCycle[];
|
|
10
|
+
/** Names in at least one cycle. */
|
|
11
|
+
cycleParticipants: Set<string>;
|
|
12
|
+
/** For each cycle member, the whole set of members that has to be accepted or rejected with it. */
|
|
13
|
+
cycleUnits: Map<string, Set<string>>;
|
|
14
|
+
/** For each root, what it needs. A root with more than one node is a group. */
|
|
15
|
+
closures: Map<string, Closure>;
|
|
16
|
+
}
|
|
17
|
+
export interface SidebarItem {
|
|
18
|
+
key: string;
|
|
19
|
+
entry: CDFComponentEntry;
|
|
20
|
+
status: NodeStatus;
|
|
21
|
+
}
|
|
22
|
+
/** What the sidebar draws a row from: an entry standing in for the component (its slots are what matter), and its status. */
|
|
23
|
+
export declare function sidebarItems(components: ScopeComponent[]): SidebarItem[];
|
|
24
|
+
export declare function buildScopeGraph(components: ScopeComponent[]): ScopeGraph;
|
|
25
|
+
/** Names that change when `target` is accepted. Pulls in everything it needs, whole cycles together. */
|
|
26
|
+
export declare function acceptCascade(graph: ScopeGraph, target: string): string[];
|
|
27
|
+
/** Rejecting rejects every ancestor and deselects the descendants. The screen asks first when it is 2 or more. */
|
|
28
|
+
export declare function rejectCascade(graph: ScopeGraph, target: string): {
|
|
29
|
+
toReject: string[];
|
|
30
|
+
toDeselect: string[];
|
|
31
|
+
};
|
|
32
|
+
/** Everything reachable from the seeds, including the cycles they depend on. Used by "toggle all" and "accept non-flagged". */
|
|
33
|
+
export declare function reachableCycleMembers(graph: ScopeGraph, seeds: string[]): string[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentGraphNode } from './composite-closure.js';
|
|
2
|
+
export interface LineageParentEdge {
|
|
3
|
+
parent: string;
|
|
4
|
+
slotName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LineageEdge {
|
|
7
|
+
from: string;
|
|
8
|
+
slotName: string;
|
|
9
|
+
to: string;
|
|
10
|
+
}
|
|
11
|
+
export type LineageChain = LineageEdge[];
|
|
12
|
+
export declare function findDirectParents(target: string, components: ComponentGraphNode[]): LineageParentEdge[];
|
|
13
|
+
export declare function findAllAncestors(target: string, components: ComponentGraphNode[]): Set<string>;
|
|
14
|
+
export declare function findAllAncestorChains(target: string, components: ComponentGraphNode[]): LineageChain[];
|
|
15
|
+
export interface AncestorTreeNode {
|
|
16
|
+
name: string;
|
|
17
|
+
incomingSlotName?: string;
|
|
18
|
+
depth: number;
|
|
19
|
+
shared: boolean;
|
|
20
|
+
cycle: boolean;
|
|
21
|
+
parents: AncestorTreeNode[];
|
|
22
|
+
}
|
|
23
|
+
export declare function buildAncestorTree(target: string, components: ComponentGraphNode[]): AncestorTreeNode;
|
|
24
|
+
export interface AncestorTreeLine {
|
|
25
|
+
text: string;
|
|
26
|
+
jumpTarget?: string;
|
|
27
|
+
depth: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function renderAncestorTree(node: AncestorTreeNode): AncestorTreeLine[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComponentGraphNode } from './composite-closure.js';
|
|
2
|
+
export declare function computeDirectNeighborhood(matches: Iterable<string>, graph: ComponentGraphNode[]): Set<string>;
|
|
3
|
+
export declare function findAllAncestors(target: string, graph: ComponentGraphNode[]): Set<string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
import type { ComponentGraphNode } from './composite-closure.js';
|
|
3
|
+
export interface SlotGraphInput {
|
|
4
|
+
key: string;
|
|
5
|
+
entry: CDFComponentEntry;
|
|
6
|
+
status?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BuildOptions {
|
|
9
|
+
stripRejectedEdges?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildComponentGraph(components: SlotGraphInput[], opts?: BuildOptions): ComponentGraphNode[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type GateMode = 'help' | 'reject-prompt' | 'search' | 'cycles' | 'flags' | 'main';
|
|
2
|
+
export interface KeyPress {
|
|
3
|
+
input: string;
|
|
4
|
+
upArrow?: boolean;
|
|
5
|
+
downArrow?: boolean;
|
|
6
|
+
return?: boolean;
|
|
7
|
+
escape?: boolean;
|
|
8
|
+
tab?: boolean;
|
|
9
|
+
shiftTab?: boolean;
|
|
10
|
+
ctrl?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** What legacy looked at besides the key and the open panel. */
|
|
13
|
+
export interface GateContext {
|
|
14
|
+
focusedColumn: 'main' | 'added-components';
|
|
15
|
+
/** The layout has only the main column, so Tab has nowhere to go. */
|
|
16
|
+
singleColumn: boolean;
|
|
17
|
+
hasCycles: boolean;
|
|
18
|
+
/** Some component was flagged by the AI with a reason to show. */
|
|
19
|
+
hasFlagReasons: boolean;
|
|
20
|
+
/** A jump filter is on, so Esc clears it before it quits. */
|
|
21
|
+
jumpFilterActive: boolean;
|
|
22
|
+
/** Search text is set, so Esc clears it before it quits. */
|
|
23
|
+
searchActive: boolean;
|
|
24
|
+
/** The list in the focused column has no rows, so the arrows have nothing to move. */
|
|
25
|
+
focusedListEmpty: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type GateAction = {
|
|
28
|
+
type: 'none';
|
|
29
|
+
} | {
|
|
30
|
+
type: 'quit';
|
|
31
|
+
} | {
|
|
32
|
+
type: 'confirm';
|
|
33
|
+
} | {
|
|
34
|
+
type: 'close-help';
|
|
35
|
+
} | {
|
|
36
|
+
type: 'answer-reject-prompt';
|
|
37
|
+
confirm: boolean;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'close-panel';
|
|
40
|
+
} | {
|
|
41
|
+
type: 'close-search';
|
|
42
|
+
} | {
|
|
43
|
+
type: 'submit-search';
|
|
44
|
+
} | {
|
|
45
|
+
type: 'search-input';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'clear-jump-filter';
|
|
48
|
+
} | {
|
|
49
|
+
type: 'clear-search';
|
|
50
|
+
} | {
|
|
51
|
+
type: 'move';
|
|
52
|
+
delta: -1 | 1;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'jump-to-selected';
|
|
55
|
+
} | {
|
|
56
|
+
type: 'accept';
|
|
57
|
+
} | {
|
|
58
|
+
type: 'reject';
|
|
59
|
+
} | {
|
|
60
|
+
type: 'toggle-all';
|
|
61
|
+
} | {
|
|
62
|
+
type: 'accept-unflagged';
|
|
63
|
+
} | {
|
|
64
|
+
type: 'toggle-group';
|
|
65
|
+
} | {
|
|
66
|
+
type: 'expand-all';
|
|
67
|
+
} | {
|
|
68
|
+
type: 'collapse-all';
|
|
69
|
+
} | {
|
|
70
|
+
type: 'switch-column';
|
|
71
|
+
delta: -1 | 1;
|
|
72
|
+
} | {
|
|
73
|
+
type: 'open-panel';
|
|
74
|
+
panel: 'cycles' | 'flags' | 'help' | 'search';
|
|
75
|
+
} | {
|
|
76
|
+
type: 'toggle-dependencies';
|
|
77
|
+
} | {
|
|
78
|
+
type: 'toggle-cycle-filter';
|
|
79
|
+
} | {
|
|
80
|
+
type: 'toggle-jump-filter';
|
|
81
|
+
} | {
|
|
82
|
+
type: 'toggle-view';
|
|
83
|
+
};
|
|
84
|
+
export declare function resolveKey(mode: GateMode, key: KeyPress, ctx: GateContext): GateAction;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScopeGateLoad } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the components for the gate, once, before the screen renders. Replaces legacy's database read inside render
|
|
4
|
+
* (and its "remember the last list" workaround for the resize that happened after confirming): with nothing written
|
|
5
|
+
* until the wizard saves the decisions, the list cannot change under the screen.
|
|
6
|
+
* Uses `loadScopeComponents` from backend-pipeline, which is identical to legacy's.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadScopeGate(sessionId: string): ScopeGateLoad;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AddedComponentEntry } from '../columns.js';
|
|
3
|
+
interface AddedColumnProps {
|
|
4
|
+
title: string;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
entries: AddedComponentEntry[];
|
|
8
|
+
cursor: number;
|
|
9
|
+
focused: boolean;
|
|
10
|
+
aiFlaggedByKey?: Map<string, boolean>;
|
|
11
|
+
visibleCount: number;
|
|
12
|
+
}
|
|
13
|
+
/** The accepted components, cycle members first. Rejecting from here is the only decision it allows. */
|
|
14
|
+
export declare function AddedColumn(props: AddedColumnProps): React.ReactElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SlotCycle } from '../graph/cycle-detection.js';
|
|
3
|
+
interface CyclesPanelProps {
|
|
4
|
+
cycles: SlotCycle[];
|
|
5
|
+
cursor: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function CyclesPanel({ cycles, cursor }: CyclesPanelProps): React.ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ScopeComponent, ScopeDecisions } from './types.js';
|
|
3
|
+
interface ScopeGateScreenProps {
|
|
4
|
+
components: ScopeComponent[];
|
|
5
|
+
onConfirm: (decisions: ScopeDecisions) => void;
|
|
6
|
+
onQuit: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ScopeGateScreen(props: ScopeGateScreenProps): React.ReactElement;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface GotoRow {
|
|
3
|
+
label: string;
|
|
4
|
+
jumpTarget: string;
|
|
5
|
+
kind?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GotoBannerProps {
|
|
8
|
+
title: string;
|
|
9
|
+
rows: GotoRow[];
|
|
10
|
+
/** Index used to highlight + window. Indexes `rows` directly by default. */
|
|
11
|
+
cursor: number;
|
|
12
|
+
/**
|
|
13
|
+
* Override the row index the cursor sits on, when `cursor` indexes a subset
|
|
14
|
+
* (e.g. a jumpable projection) rather than `rows`. Windowing and the default
|
|
15
|
+
* highlight center on this instead of `cursor` when provided.
|
|
16
|
+
*/
|
|
17
|
+
cursorRowIndex?: number;
|
|
18
|
+
/** Max rows rendered at once. Larger lists window around the cursor. */
|
|
19
|
+
maxRows?: number;
|
|
20
|
+
/** Constrain the box to a fixed column width (e.g. the sidebar slot). */
|
|
21
|
+
width?: number;
|
|
22
|
+
/** Footer keybinding hint. Rendered dim below the list when given. */
|
|
23
|
+
footerHint?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Escape hatch for feature-specific row rendering. Receives the row, its
|
|
26
|
+
* index into `rows`, and whether the cursor is on it. Falls back to a
|
|
27
|
+
* generic pointer row.
|
|
28
|
+
*/
|
|
29
|
+
renderRow?: (row: GotoRow, index: number, isCursor: boolean) => React.ReactElement;
|
|
30
|
+
}
|
|
31
|
+
export declare function GotoBanner({ title, rows, cursor, cursorRowIndex, maxRows, width, footerHint, renderRow, }: GotoBannerProps): React.ReactElement;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
3
|
+
import { type ComponentGraphNode, type NodeStatus } from '../../graph/composite-closure.js';
|
|
4
|
+
import type { PreviewAnnotation, RenderStatus } from '../types.js';
|
|
5
|
+
export interface GroupedSidebarItem {
|
|
6
|
+
key: string;
|
|
7
|
+
entry: CDFComponentEntry;
|
|
8
|
+
status: NodeStatus;
|
|
9
|
+
}
|
|
10
|
+
export interface GroupedSidebarProps {
|
|
11
|
+
items: GroupedSidebarItem[];
|
|
12
|
+
cycleParticipants?: Set<string>;
|
|
13
|
+
selectedIdx: number;
|
|
14
|
+
selectedRowIdx?: number;
|
|
15
|
+
onSelect: (idx: number) => void;
|
|
16
|
+
expandedGroups: Set<string>;
|
|
17
|
+
onToggleExpanded: (rootName: string) => void;
|
|
18
|
+
width: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
title?: string;
|
|
21
|
+
wrapLabels?: boolean;
|
|
22
|
+
focused: boolean;
|
|
23
|
+
renderStatusByKey?: Map<string, RenderStatus>;
|
|
24
|
+
previewAnnotationByKey?: Map<string, PreviewAnnotation>;
|
|
25
|
+
scrollOffset?: number;
|
|
26
|
+
visibleCount?: number;
|
|
27
|
+
alwaysExpanded?: boolean;
|
|
28
|
+
showFlatTier?: boolean;
|
|
29
|
+
selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
|
|
30
|
+
aiFlaggedByKey?: Map<string, boolean>;
|
|
31
|
+
dimPredicate?: (componentKey: string) => boolean;
|
|
32
|
+
viewMode?: 'grouped' | 'flat';
|
|
33
|
+
visibleRows?: VisibleRow[];
|
|
34
|
+
graph: ComponentGraphNode[];
|
|
35
|
+
filterVisibleKeys?: Set<string>;
|
|
36
|
+
}
|
|
37
|
+
type RowKind = 'cycle' | 'empty' | 'group-root' | 'group-child' | 'standalone' | 'flat' | 'flat-header';
|
|
38
|
+
export interface VisibleRow {
|
|
39
|
+
kind: RowKind;
|
|
40
|
+
key: string;
|
|
41
|
+
label: string;
|
|
42
|
+
indent: number;
|
|
43
|
+
aggregateGlyph?: string | null;
|
|
44
|
+
sharedSuffix?: boolean;
|
|
45
|
+
cycleChild?: boolean;
|
|
46
|
+
itemIdx: number;
|
|
47
|
+
rootName?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function buildVisibleRows(props: {
|
|
50
|
+
items: GroupedSidebarItem[];
|
|
51
|
+
cycleParticipants: Set<string>;
|
|
52
|
+
expandedGroups: Set<string>;
|
|
53
|
+
alwaysExpanded?: boolean;
|
|
54
|
+
showFlatTier?: boolean;
|
|
55
|
+
viewMode?: 'grouped' | 'flat';
|
|
56
|
+
graph: ComponentGraphNode[];
|
|
57
|
+
filterVisibleKeys?: Set<string>;
|
|
58
|
+
}): VisibleRow[];
|
|
59
|
+
export declare function visibleItemOrder(props: {
|
|
60
|
+
items: GroupedSidebarItem[];
|
|
61
|
+
cycleParticipants: Set<string>;
|
|
62
|
+
expandedGroups: Set<string>;
|
|
63
|
+
alwaysExpanded?: boolean;
|
|
64
|
+
showFlatTier?: boolean;
|
|
65
|
+
graph: ComponentGraphNode[];
|
|
66
|
+
}): number[];
|
|
67
|
+
export declare function labelStyleFor(input: {
|
|
68
|
+
row: VisibleRow;
|
|
69
|
+
isCursor: boolean;
|
|
70
|
+
wouldDim: boolean;
|
|
71
|
+
}): {
|
|
72
|
+
color: string | undefined;
|
|
73
|
+
bold: boolean;
|
|
74
|
+
dim: boolean;
|
|
75
|
+
};
|
|
76
|
+
export declare function selectionGlyphStyleFor(selState: 'accepted' | 'rejected' | 'undecided' | undefined, isCycleRow: boolean): {
|
|
77
|
+
glyph: string | null;
|
|
78
|
+
color: string | undefined;
|
|
79
|
+
dim: boolean;
|
|
80
|
+
bold: boolean;
|
|
81
|
+
};
|
|
82
|
+
export declare function inheritanceGlyphStyleFor(input: {
|
|
83
|
+
status: RenderStatus['status'] | undefined;
|
|
84
|
+
isOwn: boolean;
|
|
85
|
+
isCursor: boolean;
|
|
86
|
+
}): {
|
|
87
|
+
glyph: string | null;
|
|
88
|
+
color: string | undefined;
|
|
89
|
+
dim: boolean;
|
|
90
|
+
bold: boolean;
|
|
91
|
+
};
|
|
92
|
+
export declare function GroupedSidebar(props: GroupedSidebarProps): React.ReactElement;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type HelpSection = {
|
|
3
|
+
title: string;
|
|
4
|
+
entries: {
|
|
5
|
+
keys: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
type HelpOverlayProps = {
|
|
10
|
+
mode: 'analyze' | 'validate' | 'review';
|
|
11
|
+
sections?: undefined;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
handleInput?: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
mode?: undefined;
|
|
16
|
+
sections: HelpSection[];
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
handleInput?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function HelpOverlay(props: HelpOverlayProps): React.ReactElement;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PreviewAnnotation } from '../types.js';
|
|
3
|
+
export type PreviewBadgeValue = {
|
|
4
|
+
char: string;
|
|
5
|
+
color: string;
|
|
6
|
+
bold?: boolean;
|
|
7
|
+
dim?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function previewBadge(annotation: PreviewAnnotation | undefined): PreviewBadgeValue | null;
|
|
10
|
+
export declare function PreviewBadge({ badge, highlighted, }: {
|
|
11
|
+
badge: PreviewBadgeValue | null;
|
|
12
|
+
highlighted?: boolean;
|
|
13
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type BoxProps } from 'ink';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export type WindowDirection = 'up' | 'down';
|
|
4
|
+
/** Size a standalone panel to the terminal while reserving a small safety margin. */
|
|
5
|
+
export declare function terminalPanelHeight(rows: number, reservedRows?: number): number;
|
|
6
|
+
export interface WindowedPanelProps {
|
|
7
|
+
width: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
title?: string;
|
|
10
|
+
focused: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface FixedPanelProps {
|
|
14
|
+
width: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
minHeight?: BoxProps['minHeight'];
|
|
17
|
+
focused?: boolean;
|
|
18
|
+
borderStyle?: BoxProps['borderStyle'];
|
|
19
|
+
borderColor?: BoxProps['borderColor'];
|
|
20
|
+
paddingLeft?: BoxProps['paddingLeft'];
|
|
21
|
+
clipOverflow?: boolean;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/** Shared panel frame that clips content instead of resizing its layout slot. */
|
|
25
|
+
export declare function FixedPanel({ width, height, minHeight, focused, borderStyle, borderColor, paddingLeft, clipOverflow, children, }: FixedPanelProps): ReactElement;
|
|
26
|
+
/** Shared frame for panels whose viewport must not change with their contents. */
|
|
27
|
+
export declare function WindowedPanel({ width, height, title, focused, children }: WindowedPanelProps): ReactElement;
|
|
28
|
+
export declare function WindowIndicator({ direction, count }: {
|
|
29
|
+
direction: WindowDirection;
|
|
30
|
+
count: number;
|
|
31
|
+
}): ReactElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Closure } from '
|
|
1
|
+
import type { Closure } from '../graph/composite-closure.js';
|
|
2
2
|
export declare function resolveGroupRoot(key: string, closures: Map<string, Closure>, cycleSet: Set<string>): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ImmediateInputKey = {
|
|
2
|
+
upArrow: boolean;
|
|
3
|
+
downArrow: boolean;
|
|
4
|
+
leftArrow: boolean;
|
|
5
|
+
rightArrow: boolean;
|
|
6
|
+
pageDown: boolean;
|
|
7
|
+
pageUp: boolean;
|
|
8
|
+
return: boolean;
|
|
9
|
+
escape: boolean;
|
|
10
|
+
ctrl: boolean;
|
|
11
|
+
shift: boolean;
|
|
12
|
+
tab: boolean;
|
|
13
|
+
shiftTab: boolean;
|
|
14
|
+
backspace: boolean;
|
|
15
|
+
delete: boolean;
|
|
16
|
+
meta: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ImmediateInputHandler = (input: string, key: ImmediateInputKey) => void;
|
|
19
|
+
export declare function useImmediateInput(handler: ImmediateInputHandler, enabled?: boolean): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { HelpSection } from '
|
|
1
|
+
import type { HelpSection } from './components/HelpOverlay.js';
|
|
2
2
|
export declare function createSidebarViewsHelpSection(includeBreaking: boolean): HelpSection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentGraphNode, Closure } from '
|
|
2
|
-
import { type GroupedSidebarItem } from '
|
|
1
|
+
import type { ComponentGraphNode, Closure } from '../graph/composite-closure.js';
|
|
2
|
+
import { type GroupedSidebarItem } from './components/GroupedSidebar.js';
|
|
3
3
|
export declare function collectExpandedGroupRoots(closures: Map<string, Closure>, cycleParticipants: Iterable<string>): Set<string>;
|
|
4
4
|
export declare function computeSidebarViewToggle({ currentView, currentKey, currentScroll, visibleCount, items, cycleParticipants, expandedGroups, graph, showFlatTier, }: {
|
|
5
5
|
currentView: 'grouped' | 'flat';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ScopeGraph } from './graph/index.js';
|
|
2
|
+
import type { Decision, ScopeComponent, ScopeDecisions } from './types.js';
|
|
3
|
+
export type DecisionState = Map<string, Decision>;
|
|
4
|
+
export type DecisionAction = {
|
|
5
|
+
type: 'accept';
|
|
6
|
+
name: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'reject';
|
|
9
|
+
name: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'toggle-all';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'accept-unflagged';
|
|
14
|
+
};
|
|
15
|
+
export declare function reduceDecisions(state: DecisionState, action: DecisionAction, components: ScopeComponent[], graph: ScopeGraph): DecisionState;
|
|
16
|
+
/** Whether rejecting `name` touches 2 or more other components, so the screen has to ask first. */
|
|
17
|
+
export declare function rejectNeedsConfirmation(graph: ScopeGraph, name: string, state: DecisionState): boolean;
|
|
18
|
+
/** Everything not accepted counts as rejected, as legacy's `partition` did. */
|
|
19
|
+
export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState): ScopeDecisions;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ScopeComponentRow } from '@contentful/experience-design-system-backend-pipeline';
|
|
2
|
+
/**
|
|
3
|
+
* One row of the gate. The loader always fills in the slots, but the screen is handed whatever the caller has, and
|
|
4
|
+
* legacy's screen accepted rows without them (and without the AI fields), so those stay optional here.
|
|
5
|
+
*/
|
|
6
|
+
export type ScopeComponent = Omit<ScopeComponentRow, 'aiDecision' | 'aiReason' | 'needsReview' | 'slots'> & {
|
|
7
|
+
aiDecision?: 'accepted' | 'rejected' | 'failed' | null;
|
|
8
|
+
aiReason?: string | null;
|
|
9
|
+
needsReview?: boolean;
|
|
10
|
+
slots?: ScopeComponentRow['slots'];
|
|
11
|
+
};
|
|
12
|
+
export type Decision = 'accepted' | 'rejected' | 'undecided';
|
|
13
|
+
/** What the user confirmed. Becomes `ImportHandoff.scope`; the legacy wizard saves it and starts generation. */
|
|
14
|
+
export interface ScopeDecisions {
|
|
15
|
+
accepted: string[];
|
|
16
|
+
rejected: string[];
|
|
17
|
+
}
|
|
18
|
+
export type ScopeGateLoad = {
|
|
19
|
+
ok: true;
|
|
20
|
+
components: ScopeComponent[];
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type CacheCheckInput } from './cache-check.js';
|
|
2
|
+
import { loadScopeGate } from './load.js';
|
|
3
|
+
import type { ScopeDecisions, ScopeGateLoad } from './types.js';
|
|
4
|
+
export type ScopeGateFlow = {
|
|
5
|
+
status: 'failed';
|
|
6
|
+
message: string;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'deciding';
|
|
9
|
+
load: Extract<ScopeGateLoad, {
|
|
10
|
+
ok: true;
|
|
11
|
+
}>;
|
|
12
|
+
confirm: (decisions: ScopeDecisions) => void;
|
|
13
|
+
} | {
|
|
14
|
+
status: 'confirmed';
|
|
15
|
+
decisions: ScopeDecisions;
|
|
16
|
+
cachedNames: Promise<string[]>;
|
|
17
|
+
};
|
|
18
|
+
interface Deps {
|
|
19
|
+
load: typeof loadScopeGate;
|
|
20
|
+
checkCache: (input: CacheCheckInput) => Promise<string[]>;
|
|
21
|
+
}
|
|
22
|
+
/** `input` is undefined until the extraction stage has produced a session, so the hook can be called unconditionally. */
|
|
23
|
+
export declare function useScopeGateFlow(input: {
|
|
24
|
+
sessionId: string;
|
|
25
|
+
cache: CacheCheckInput;
|
|
26
|
+
} | undefined, deps?: Deps): ScopeGateFlow | undefined;
|
|
27
|
+
export {};
|