@contentful/experience-design-system-cli 2.26.1-dev-build-a852362.0 → 2.26.1-dev-build-f03f014.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/package.json +14 -10
- package/dist/src/index.js +34937 -9
- package/dist/src/lib/cli-path.d.ts +4 -0
- package/dist/src/runs/export-helpers.d.ts +1 -12
- package/dist/src/runs/push-helpers.d.ts +1 -6
- package/package.json +12 -7
- package/skills/generate-components.md +427 -0
- package/skills/generate-tokens.md +194 -0
- package/skills/select-components.md +224 -0
- package/dist/src/analytics/apply.js +0 -30
- package/dist/src/analytics/client.js +0 -81
- package/dist/src/analytics/constants.js +0 -4
- package/dist/src/analytics/env.js +0 -14
- package/dist/src/analytics/exit.js +0 -24
- package/dist/src/analytics/index.js +0 -9
- package/dist/src/analytics/normalize.js +0 -18
- package/dist/src/analytics/os.js +0 -13
- package/dist/src/analytics/session.js +0 -15
- package/dist/src/analytics/tracker.js +0 -126
- package/dist/src/analytics/types.js +0 -1
- package/dist/src/analyze/build-analyze-view-rows.js +0 -63
- package/dist/src/analyze/command.js +0 -599
- package/dist/src/analyze/composite-closure.js +0 -0
- package/dist/src/analyze/composition/agent-parser/author-prompt.js +0 -22
- package/dist/src/analyze/composition/agent-parser/extract-parser.js +0 -44
- package/dist/src/analyze/composition/agent-parser/load-prompt.js +0 -31
- package/dist/src/analyze/composition/agent-parser/resolve-via-parser.js +0 -88
- package/dist/src/analyze/composition/agent-parser/sandbox.js +0 -187
- package/dist/src/analyze/composition/apply-mapping.js +0 -67
- package/dist/src/analyze/composition/candidate-critic-agent.js +0 -39
- package/dist/src/analyze/composition/candidate-critic.js +0 -63
- package/dist/src/analyze/composition/candidate-files.js +0 -131
- package/dist/src/analyze/composition/composition-cache-key.js +0 -19
- package/dist/src/analyze/composition/interchange-schema.js +0 -61
- package/dist/src/analyze/composition/manifest-doc-evidence.js +0 -136
- package/dist/src/analyze/composition/merge-edges.js +0 -70
- package/dist/src/analyze/composition/parse-map-edges.js +0 -55
- package/dist/src/analyze/composition/resolve-mapping-cli.js +0 -29
- package/dist/src/analyze/composition/resolve-mapping.js +0 -111
- package/dist/src/analyze/cycle-detection.js +0 -234
- package/dist/src/analyze/cycle-view.js +0 -28
- package/dist/src/analyze/fuzzy-search.js +0 -55
- package/dist/src/analyze/issue-inheritance.js +0 -108
- package/dist/src/analyze/lineage.js +0 -0
- package/dist/src/analyze/scope-gate-cascade.js +0 -170
- package/dist/src/analyze/search-neighborhood.js +0 -56
- package/dist/src/analyze/select/command.js +0 -484
- package/dist/src/analyze/select/index.js +0 -5
- package/dist/src/analyze/select/parser.js +0 -53
- package/dist/src/analyze/select/persistence.js +0 -80
- package/dist/src/analyze/select/preview-annotations.js +0 -62
- package/dist/src/analyze/select/stdout.js +0 -3
- package/dist/src/analyze/select/tui/App.js +0 -483
- package/dist/src/analyze/select/tui/components/ComponentDetail.js +0 -48
- package/dist/src/analyze/select/tui/components/ComponentRationalePanel.js +0 -125
- package/dist/src/analyze/select/tui/components/FieldEditor.js +0 -1131
- package/dist/src/analyze/select/tui/components/FinalizeDialog.js +0 -36
- package/dist/src/analyze/select/tui/components/GotoBanner.js +0 -30
- package/dist/src/analyze/select/tui/components/GroupedSidebar.js +0 -517
- package/dist/src/analyze/select/tui/components/HelpOverlay.js +0 -17
- package/dist/src/analyze/select/tui/components/JsonEditor.js +0 -131
- package/dist/src/analyze/select/tui/components/JsonPanel.js +0 -66
- package/dist/src/analyze/select/tui/components/LineagePanel.js +0 -22
- package/dist/src/analyze/select/tui/components/PreviewSummaryBar.js +0 -29
- package/dist/src/analyze/select/tui/components/QuitDialog.js +0 -14
- package/dist/src/analyze/select/tui/components/RationalePanel.js +0 -80
- package/dist/src/analyze/select/tui/components/Sidebar.js +0 -92
- package/dist/src/analyze/select/tui/components/SourcePanel.js +0 -52
- package/dist/src/analyze/select/tui/components/StatusBar.js +0 -7
- package/dist/src/analyze/select/tui/components/TopBar.js +0 -10
- package/dist/src/analyze/select/tui/components/removed-components-text.js +0 -11
- package/dist/src/analyze/select/tui/hooks/scroll-offset.js +0 -26
- package/dist/src/analyze/select/tui/hooks/useImmediateInput.js +0 -66
- package/dist/src/analyze/select/tui/hooks/useKeymap.js +0 -67
- package/dist/src/analyze/select/tui/hooks/useSession.js +0 -52
- package/dist/src/analyze/select/tui/hooks/useUndo.js +0 -26
- package/dist/src/analyze/select/tui/theme.js +0 -28
- package/dist/src/analyze/select/types.js +0 -39
- package/dist/src/analyze/select-agent/command.js +0 -558
- package/dist/src/analyze/select-agent/context-builder.js +0 -197
- package/dist/src/analyze/select-agent/show-rationale.js +0 -92
- package/dist/src/analyze/selection-cascade.js +0 -19
- package/dist/src/analyze/slot-graph.js +0 -17
- package/dist/src/analyze/tui/AnalyzeView.js +0 -64
- package/dist/src/apply/api-client.js +0 -440
- package/dist/src/apply/command.js +0 -845
- package/dist/src/apply/manifest.js +0 -1
- package/dist/src/apply/preview-utils.js +0 -26
- package/dist/src/apply/tui/SelectView.js +0 -34
- package/dist/src/apply/tui/ServerApplyView.js +0 -49
- package/dist/src/apply/tui/ServerPreviewView.js +0 -23
- package/dist/src/credentials-store.js +0 -74
- package/dist/src/generate/command.js +0 -597
- package/dist/src/generate/edit/command.js +0 -127
- package/dist/src/generate/tui/GenerateView.js +0 -10
- package/dist/src/host-utils.js +0 -26
- package/dist/src/import/agent-model-resolve.js +0 -35
- package/dist/src/import/auto-filter-resolve.js +0 -16
- package/dist/src/import/command.js +0 -380
- package/dist/src/import/cycle-auto-reject.js +0 -14
- package/dist/src/import/orchestrator.js +0 -603
- package/dist/src/import/path-utils.js +0 -30
- package/dist/src/import/picker-dispatch.js +0 -44
- package/dist/src/import/print-prompt.js +0 -31
- package/dist/src/import/strip-allowed-components.js +0 -22
- package/dist/src/import/tui/CustomPromptBanner.js +0 -8
- package/dist/src/import/tui/WizardApp.js +0 -1670
- package/dist/src/import/tui/ai-flag.js +0 -6
- package/dist/src/import/tui/auto-filter-error.js +0 -29
- package/dist/src/import/tui/autocomplete.js +0 -32
- package/dist/src/import/tui/components/AutoFilterBanner.js +0 -19
- package/dist/src/import/tui/components/CounterStrip.js +0 -12
- package/dist/src/import/tui/components/LegendEntry.js +0 -6
- package/dist/src/import/tui/cycle-panel-scroll.js +0 -33
- package/dist/src/import/tui/final-review-host.js +0 -25
- package/dist/src/import/tui/group-collapse.js +0 -11
- package/dist/src/import/tui/history.js +0 -53
- package/dist/src/import/tui/hooks/useLineage.js +0 -50
- package/dist/src/import/tui/hooks/useOverlayPanel.js +0 -27
- package/dist/src/import/tui/lineage-layout.js +0 -82
- package/dist/src/import/tui/merge-ai-decisions.js +0 -22
- package/dist/src/import/tui/push-decision-gate-helpers.js +0 -8
- package/dist/src/import/tui/push-progress.js +0 -1
- package/dist/src/import/tui/run-print-files-helpers.js +0 -8
- package/dist/src/import/tui/run-teaser.js +0 -9
- package/dist/src/import/tui/runLivePreview.js +0 -82
- package/dist/src/import/tui/runScopeGate.js +0 -28
- package/dist/src/import/tui/scope-gate-columns.js +0 -94
- package/dist/src/import/tui/scope-gate-host.js +0 -28
- package/dist/src/import/tui/sidebar-width.js +0 -3
- package/dist/src/import/tui/spawn-generate.js +0 -53
- package/dist/src/import/tui/step-filters.js +0 -42
- package/dist/src/import/tui/steps/AtomicGenerateReviewStep.js +0 -726
- package/dist/src/import/tui/steps/AtomicScopeGateStep.js +0 -210
- package/dist/src/import/tui/steps/CredentialsStep.js +0 -108
- package/dist/src/import/tui/steps/DoneStep.js +0 -24
- package/dist/src/import/tui/steps/ErrorStep.js +0 -16
- package/dist/src/import/tui/steps/GateStep.js +0 -22
- package/dist/src/import/tui/steps/GenerateReviewStep.js +0 -1618
- package/dist/src/import/tui/steps/PathValidationStep.js +0 -152
- package/dist/src/import/tui/steps/PreviewStep.js +0 -37
- package/dist/src/import/tui/steps/PreviewValidationErrorStep.js +0 -23
- package/dist/src/import/tui/steps/PushDecisionGateStep.js +0 -73
- package/dist/src/import/tui/steps/PushingStep.js +0 -24
- package/dist/src/import/tui/steps/RunningStep.js +0 -21
- package/dist/src/import/tui/steps/ScopeGateStep.js +0 -907
- package/dist/src/import/tui/steps/TokenInputStep.js +0 -88
- package/dist/src/import/tui/steps/WelcomeStep.js +0 -34
- package/dist/src/import/tui/steps/WizardPreviewStep.js +0 -169
- package/dist/src/import/tui/steps/auto-reject-decision.js +0 -9
- package/dist/src/import/tui/steps/breaking-change-format.js +0 -24
- package/dist/src/import/tui/steps/enumerate-cycle-breaks.js +0 -0
- package/dist/src/import/tui/steps/preview-diff.js +0 -175
- package/dist/src/import/tui/useFinalizePreview.js +0 -0
- package/dist/src/import/tui/useLivePreview.js +0 -122
- package/dist/src/import/tui/wizard-422-helpers.js +0 -60
- package/dist/src/import/tui/wizard-generate-progress.js +0 -25
- package/dist/src/import/tui/wizard-save-flow.js +0 -20
- package/dist/src/import/tui/wizard-state-transitions.js +0 -32
- package/dist/src/lib/agent-model-options.js +0 -15
- package/dist/src/lib/command-options.js +0 -30
- package/dist/src/lib/composition-mode.js +0 -39
- package/dist/src/lib/contentful-urls.js +0 -27
- package/dist/src/lib/debug-logger.js +0 -229
- package/dist/src/lib/debug-preamble.js +0 -33
- package/dist/src/lib/error-parser.js +0 -269
- package/dist/src/lib/prompt-overrides.js +0 -69
- package/dist/src/lib/terminal-capabilities.js +0 -51
- package/dist/src/lib/user-agent.js +0 -29
- package/dist/src/output/format.js +0 -110
- package/dist/src/print/command.js +0 -221
- package/dist/src/print/validate/tui/ValidateView.js +0 -37
- package/dist/src/print/validate/validators/cdf-validator.js +0 -104
- package/dist/src/print/validate/validators/dtcg-validator.js +0 -110
- package/dist/src/print/validate/validators/format-errors.js +0 -18
- package/dist/src/program.js +0 -105
- package/dist/src/runs/export-helpers.js +0 -59
- package/dist/src/runs/fingerprint.js +0 -75
- package/dist/src/runs/ls-command.js +0 -137
- package/dist/src/runs/modify-launcher.js +0 -42
- package/dist/src/runs/path-prompt.js +0 -72
- package/dist/src/runs/push-creds-prompt.js +0 -39
- package/dist/src/runs/push-helpers.js +0 -72
- package/dist/src/runs/push-launcher.js +0 -77
- package/dist/src/runs/replay-helpers.js +0 -164
- package/dist/src/runs/resolve-run-target.js +0 -45
- package/dist/src/runs/run-picker-mount.js +0 -72
- package/dist/src/runs/run-picker.js +0 -129
- package/dist/src/runs/save-conflict.js +0 -56
- package/dist/src/runs/save-path-resolver.js +0 -75
- package/dist/src/runs/staleness.js +0 -140
- package/dist/src/runs/store.js +0 -136
- package/dist/src/session/cache-keys.js +0 -44
- package/dist/src/session/command.js +0 -261
- package/dist/src/session/db.js +0 -1538
- package/dist/src/session/migration.js +0 -117
- package/dist/src/session/session-id.js +0 -212
- package/dist/src/session/stats.js +0 -89
- package/dist/src/setup/analytics-prompt.js +0 -24
- package/dist/src/setup/auto-filter-prompt.js +0 -24
- package/dist/src/setup/command.js +0 -966
- package/dist/src/setup/composition-mode-prompt.js +0 -37
- package/dist/src/setup/debug-mode-prompt.js +0 -22
- package/dist/src/types.js +0 -1
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useStdout } from 'ink';
|
|
3
|
-
import React, { useMemo, useState } from 'react';
|
|
4
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
5
|
-
import { PALETTE } from '../../../analyze/select/tui/theme.js';
|
|
6
|
-
import { AutoFilterBanner } from '../components/AutoFilterBanner.js';
|
|
7
|
-
import { CounterStrip } from '../components/CounterStrip.js';
|
|
8
|
-
import { isAiFlagged } from '../ai-flag.js';
|
|
9
|
-
// Atomic-mode scope gate (spec T9). Recovered from the pre-composite `main`
|
|
10
|
-
// implementation: a flat included/excluded list with NO hierarchy affordances
|
|
11
|
-
// (no closures, cycles, cascade, lineage, grouped sidebar, or graph). Styling
|
|
12
|
-
// is ported to PALETTE and the shared AutoFilterBanner/CounterStrip so it reads
|
|
13
|
-
// as the same product as its composite sibling — "fewer panels, identical look."
|
|
14
|
-
const VISIBLE_COUNT = 10;
|
|
15
|
-
const REASON_DISPLAY_MAX = 60;
|
|
16
|
-
const AI_MARKER = '*';
|
|
17
|
-
const REASON_WRAP_INDENT = ' ';
|
|
18
|
-
function truncateReason(reason) {
|
|
19
|
-
if (reason === null || reason === undefined || reason === '')
|
|
20
|
-
return '<no reason given>';
|
|
21
|
-
if (reason.length <= REASON_DISPLAY_MAX)
|
|
22
|
-
return reason;
|
|
23
|
-
return reason.slice(0, REASON_DISPLAY_MAX - 1).trimEnd() + '…';
|
|
24
|
-
}
|
|
25
|
-
export function AtomicScopeGateStep({ components, onConfirm, onQuit, aiFilterStatus = 'idle', aiFilterProgress = null, aiFilterError = null, onCancelAutoFilter, }) {
|
|
26
|
-
const { stdout } = useStdout();
|
|
27
|
-
const totalWidth = stdout?.columns ?? 80;
|
|
28
|
-
// Inverted "included" model, kept from `main` (deliberately NOT the
|
|
29
|
-
// composite step's userDecisions Map — see spec T9 "what to NOT share").
|
|
30
|
-
const [userExcluded, setUserExcluded] = useState(new Set());
|
|
31
|
-
const [userUnExcluded, setUserUnExcluded] = useState(new Set());
|
|
32
|
-
const [cursor, setCursor] = useState(0);
|
|
33
|
-
const [scrollOffset, setScrollOffset] = useState(0);
|
|
34
|
-
const [reasonPanelOpen, setReasonPanelOpen] = useState(false);
|
|
35
|
-
const aiList = components.filter(isAiFlagged);
|
|
36
|
-
const componentsList = components.filter((c) => !isAiFlagged(c));
|
|
37
|
-
const flatList = [...aiList, ...componentsList];
|
|
38
|
-
const isIncluded = (row) => {
|
|
39
|
-
if (userExcluded.has(row.name))
|
|
40
|
-
return false;
|
|
41
|
-
if (userUnExcluded.has(row.name))
|
|
42
|
-
return true;
|
|
43
|
-
return !isAiFlagged(row);
|
|
44
|
-
};
|
|
45
|
-
const partition = () => {
|
|
46
|
-
const accepted = [];
|
|
47
|
-
const rejected = [];
|
|
48
|
-
for (const c of flatList) {
|
|
49
|
-
if (isIncluded(c))
|
|
50
|
-
accepted.push(c.name);
|
|
51
|
-
else
|
|
52
|
-
rejected.push(c.name);
|
|
53
|
-
}
|
|
54
|
-
return { accepted, rejected };
|
|
55
|
-
};
|
|
56
|
-
const toggleFocused = () => {
|
|
57
|
-
const target = flatList[cursor];
|
|
58
|
-
if (!target)
|
|
59
|
-
return;
|
|
60
|
-
const currentlyIn = isIncluded(target);
|
|
61
|
-
if (currentlyIn) {
|
|
62
|
-
setUserExcluded((prev) => {
|
|
63
|
-
if (prev.has(target.name))
|
|
64
|
-
return prev;
|
|
65
|
-
const next = new Set(prev);
|
|
66
|
-
next.add(target.name);
|
|
67
|
-
return next;
|
|
68
|
-
});
|
|
69
|
-
setUserUnExcluded((prev) => {
|
|
70
|
-
if (!prev.has(target.name))
|
|
71
|
-
return prev;
|
|
72
|
-
const next = new Set(prev);
|
|
73
|
-
next.delete(target.name);
|
|
74
|
-
return next;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
setUserUnExcluded((prev) => {
|
|
79
|
-
if (prev.has(target.name))
|
|
80
|
-
return prev;
|
|
81
|
-
const next = new Set(prev);
|
|
82
|
-
next.add(target.name);
|
|
83
|
-
return next;
|
|
84
|
-
});
|
|
85
|
-
setUserExcluded((prev) => {
|
|
86
|
-
if (!prev.has(target.name))
|
|
87
|
-
return prev;
|
|
88
|
-
const next = new Set(prev);
|
|
89
|
-
next.delete(target.name);
|
|
90
|
-
return next;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
useImmediateInput((input, key) => {
|
|
95
|
-
if (input === 'q' || key.escape) {
|
|
96
|
-
if (aiFilterStatus === 'running' && onCancelAutoFilter) {
|
|
97
|
-
onCancelAutoFilter();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (key.escape && reasonPanelOpen) {
|
|
101
|
-
setReasonPanelOpen(false);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
onQuit();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (input === 'f' || input === 'F') {
|
|
108
|
-
onConfirm(partition());
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (input === 's') {
|
|
112
|
-
setReasonPanelOpen((prev) => !prev);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (input === 'a' || input === ' ' || input === 'r') {
|
|
116
|
-
toggleFocused();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (input === 'A') {
|
|
120
|
-
const compNames = componentsList.map((c) => c.name);
|
|
121
|
-
const anyCompExcluded = componentsList.some((c) => !isIncluded(c));
|
|
122
|
-
if (anyCompExcluded) {
|
|
123
|
-
setUserUnExcluded((prev) => {
|
|
124
|
-
const next = new Set(prev);
|
|
125
|
-
for (const n of compNames)
|
|
126
|
-
next.add(n);
|
|
127
|
-
return next;
|
|
128
|
-
});
|
|
129
|
-
setUserExcluded((prev) => {
|
|
130
|
-
const next = new Set(prev);
|
|
131
|
-
for (const n of compNames)
|
|
132
|
-
next.delete(n);
|
|
133
|
-
return next;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
setUserExcluded((prev) => {
|
|
138
|
-
const next = new Set(prev);
|
|
139
|
-
for (const n of compNames)
|
|
140
|
-
next.add(n);
|
|
141
|
-
return next;
|
|
142
|
-
});
|
|
143
|
-
setUserUnExcluded((prev) => {
|
|
144
|
-
const next = new Set(prev);
|
|
145
|
-
for (const n of compNames)
|
|
146
|
-
next.delete(n);
|
|
147
|
-
return next;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (key.upArrow || input === 'k') {
|
|
153
|
-
const len = flatList.length;
|
|
154
|
-
if (len === 0)
|
|
155
|
-
return;
|
|
156
|
-
setCursor((c) => {
|
|
157
|
-
const next = c <= 0 ? 0 : c - 1;
|
|
158
|
-
setScrollOffset((prev) => Math.min(prev, next));
|
|
159
|
-
return next;
|
|
160
|
-
});
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (key.downArrow || input === 'j') {
|
|
164
|
-
const len = flatList.length;
|
|
165
|
-
if (len === 0)
|
|
166
|
-
return;
|
|
167
|
-
setCursor((c) => {
|
|
168
|
-
const next = c >= len - 1 ? len - 1 : c + 1;
|
|
169
|
-
setScrollOffset((prev) => (next >= prev + VISIBLE_COUNT ? next - VISIBLE_COUNT + 1 : prev));
|
|
170
|
-
return next;
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
const total = flatList.length;
|
|
176
|
-
const includedCount = useMemo(() => flatList.filter((c) => isIncluded(c)).length, [components, userExcluded, userUnExcluded]);
|
|
177
|
-
const hasAnyAi = flatList.some(isAiFlagged);
|
|
178
|
-
const visibleEnd = Math.min(scrollOffset + VISIBLE_COUNT, total);
|
|
179
|
-
const visible = flatList.slice(scrollOffset, visibleEnd);
|
|
180
|
-
const above = scrollOffset;
|
|
181
|
-
const below = Math.max(0, total - visibleEnd);
|
|
182
|
-
const allRejected = aiFilterStatus === 'complete' && total > 0 && flatList.every((c) => !isIncluded(c));
|
|
183
|
-
// Atomic has no groups; the counter strip shows binary included/excluded.
|
|
184
|
-
const counters = {
|
|
185
|
-
accepted: includedCount,
|
|
186
|
-
rejected: total - includedCount,
|
|
187
|
-
undecided: 0,
|
|
188
|
-
groups: 0,
|
|
189
|
-
total,
|
|
190
|
-
};
|
|
191
|
-
return (_jsxs(Box, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [_jsx(Text, { color: PALETTE.success, children: "\u2713 Extraction complete" }), _jsxs(Text, { dimColor: true, children: ["Found ", total, " component", total === 1 ? '' : 's', ". Pick which ones to import. Generation runs only on the included set."] }), _jsx(AutoFilterBanner, { status: aiFilterStatus, progress: aiFilterProgress, error: aiFilterError }), _jsx(CounterStrip, { counters: counters, totalWidth: totalWidth }), reasonPanelOpen && flatList[cursor] !== undefined && isAiFlagged(flatList[cursor]) && (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: PALETTE.border, paddingX: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, bold: true, children: `Review reason: ${flatList[cursor].name}` }), _jsx(Text, { children: flatList[cursor].aiReason ?? '<no reason given>' }), _jsx(Text, { dimColor: true, children: "[s] close \u00B7 [Esc] close" })] })), allRejected ? (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: PALETTE.warning, children: "AI excluded all components \u2014 press [a] to override or [q] to quit" }) })) : (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [above > 0 && _jsxs(Text, { dimColor: true, children: ["\u2191 ", above, " above"] }), visible.map((c, vi) => {
|
|
192
|
-
const i = vi + scrollOffset;
|
|
193
|
-
const isCursor = i === cursor;
|
|
194
|
-
const included = isIncluded(c);
|
|
195
|
-
const aiFlagged = isAiFlagged(c);
|
|
196
|
-
const prefix = isCursor ? '›' : ' ';
|
|
197
|
-
const stateGlyph = included ? '[✓]' : '[✗]';
|
|
198
|
-
const stateColor = included ? PALETTE.success : PALETTE.error;
|
|
199
|
-
const aiMarkerNode = aiFlagged ? _jsx(Text, { color: PALETTE.info, children: `${AI_MARKER} ` }) : null;
|
|
200
|
-
const inlineReason = !isCursor && aiFlagged ? ` ${truncateReason(c.aiReason)}` : '';
|
|
201
|
-
const showAiHeader = aiList.length > 0 && i === 0;
|
|
202
|
-
const showComponentsHeader = componentsList.length > 0 && i === aiList.length;
|
|
203
|
-
const header = showAiHeader ? (_jsx(Text, { bold: true, children: `Review flags (${aiList.length})` }, `hdr-ai-${i}`)) : showComponentsHeader ? (_jsx(Text, { bold: true, children: `Components (${componentsList.length})` }, `hdr-comp-${i}`)) : null;
|
|
204
|
-
if (isCursor) {
|
|
205
|
-
const wrapReason = aiFlagged && c.aiReason !== null && c.aiReason !== undefined && c.aiReason.length > 0;
|
|
206
|
-
return (_jsxs(React.Fragment, { children: [header, _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: `${prefix} ` }), aiMarkerNode, _jsx(Text, { color: stateColor, children: stateGlyph }), _jsx(Text, { color: PALETTE.info, children: ` ${c.name}` })] }), wrapReason && _jsx(Text, { dimColor: true, children: `${REASON_WRAP_INDENT}${c.aiReason}` })] }, c.componentId));
|
|
207
|
-
}
|
|
208
|
-
return (_jsxs(React.Fragment, { children: [header, _jsxs(Text, { children: [_jsx(Text, { children: `${prefix} ` }), aiMarkerNode, _jsx(Text, { color: stateColor, children: stateGlyph }), _jsx(Text, { color: stateColor, children: ` ${c.name}` }), inlineReason !== '' && _jsx(Text, { dimColor: true, children: inlineReason })] })] }, c.componentId));
|
|
209
|
-
}), below > 0 && _jsxs(Text, { dimColor: true, children: ["\u2193 ", below, " below"] })] })), _jsxs(Box, { gap: 3, marginTop: 1, children: [includedCount > 0 ? (_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.success, children: includedCount }), _jsxs(Text, { dimColor: true, children: ["/", total, " included"] })] })) : (_jsx(Text, { color: PALETTE.warning, children: "none included" })), _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[j/k]" }), " ", _jsx(Text, { dimColor: true, children: "move" })] }), _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[a/space]" }), " ", _jsx(Text, { dimColor: true, children: "toggle" })] }), _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[A]" }), " ", _jsx(Text, { dimColor: true, children: "toggle all" })] }), _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[f]" }), " ", _jsx(Text, { dimColor: true, children: "continue" })] }), _jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[q]" }), " ", _jsx(Text, { dimColor: true, children: "quit" })] }), hasAnyAi && (_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "[s]" }), " ", _jsx(Text, { dimColor: true, children: "review reason" })] })), hasAnyAi && (_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: "*" }), " ", _jsx(Text, { dimColor: true, children: "requires review" })] }))] })] }));
|
|
210
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useRef } from 'react';
|
|
3
|
-
import { PALETTE } from '../../../analyze/select/tui/theme.js';
|
|
4
|
-
import { Box, Text } from 'ink';
|
|
5
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
6
|
-
import { DEFAULT_CONFIGURED_HOST, toConfiguredHost } from '../../../host-utils.js';
|
|
7
|
-
export function CredentialsStep({ summary, error: externalError, initialSpaceId = '', initialEnvironmentId = 'master', initialCmaToken = '', initialHost, validating = false, generatePrefetchStatus = 'idle', generatePrefetchError = null, onConfirm, onContinue, onQuit, onRetryPrefetch, onSkip, }) {
|
|
8
|
-
const normalizedInitialHost = toConfiguredHost(initialHost) ?? DEFAULT_CONFIGURED_HOST;
|
|
9
|
-
const [spaceId, setSpaceId] = useState(initialSpaceId);
|
|
10
|
-
const [environmentId, setEnvironmentId] = useState(initialEnvironmentId);
|
|
11
|
-
const [cmaToken, setCmaToken] = useState(initialCmaToken);
|
|
12
|
-
const [host, setHost] = useState(normalizedInitialHost);
|
|
13
|
-
const [activeField, setActiveField] = useState('spaceId');
|
|
14
|
-
const [inlineError, setInlineError] = useState(null);
|
|
15
|
-
const [cursorVisible, setCursorVisible] = useState(true);
|
|
16
|
-
const hasTypedRef = useRef(false);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const interval = setInterval(() => setCursorVisible((v) => !v), 500);
|
|
19
|
-
return () => clearInterval(interval);
|
|
20
|
-
}, []);
|
|
21
|
-
useImmediateInput((input, key) => {
|
|
22
|
-
if (validating) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if ((input === 'r' || input === 'R') && generatePrefetchStatus === 'failed' && onRetryPrefetch) {
|
|
26
|
-
onRetryPrefetch();
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (key.return) {
|
|
30
|
-
if (activeField === 'spaceId') {
|
|
31
|
-
setActiveField('environmentId');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (activeField === 'environmentId') {
|
|
35
|
-
setActiveField('cmaToken');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (activeField === 'cmaToken') {
|
|
39
|
-
setActiveField('host');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (!spaceId.trim() || !environmentId.trim() || !cmaToken.trim()) {
|
|
43
|
-
setInlineError('All fields are required.');
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setInlineError(null);
|
|
47
|
-
const submittedHost = toConfiguredHost(host) ?? DEFAULT_CONFIGURED_HOST;
|
|
48
|
-
const unchanged = spaceId.trim() === initialSpaceId &&
|
|
49
|
-
environmentId.trim() === initialEnvironmentId &&
|
|
50
|
-
cmaToken.trim() === initialCmaToken &&
|
|
51
|
-
submittedHost === normalizedInitialHost;
|
|
52
|
-
if (unchanged && onContinue) {
|
|
53
|
-
onContinue(spaceId.trim(), environmentId.trim(), cmaToken.trim(), submittedHost);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
onConfirm(spaceId.trim(), environmentId.trim(), cmaToken.trim(), submittedHost);
|
|
57
|
-
}
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (key.tab) {
|
|
61
|
-
setActiveField((f) => f === 'spaceId' ? 'environmentId' : f === 'environmentId' ? 'cmaToken' : f === 'cmaToken' ? 'host' : 'spaceId');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (key.escape || input === 'q') {
|
|
65
|
-
onQuit();
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if ((input === 's' || input === 'S') && onSkip && !hasTypedRef.current) {
|
|
69
|
-
onSkip();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (key.backspace || key.delete) {
|
|
73
|
-
if (activeField === 'spaceId')
|
|
74
|
-
setSpaceId((v) => v.slice(0, -1));
|
|
75
|
-
else if (activeField === 'environmentId')
|
|
76
|
-
setEnvironmentId((v) => v.slice(0, -1));
|
|
77
|
-
else if (activeField === 'cmaToken')
|
|
78
|
-
setCmaToken((v) => v.slice(0, -1));
|
|
79
|
-
else
|
|
80
|
-
setHost((v) => v.slice(0, -1));
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (input && !key.ctrl && !key.meta) {
|
|
84
|
-
hasTypedRef.current = true;
|
|
85
|
-
if (activeField === 'spaceId')
|
|
86
|
-
setSpaceId((v) => v + input);
|
|
87
|
-
else if (activeField === 'environmentId')
|
|
88
|
-
setEnvironmentId((v) => v + input);
|
|
89
|
-
else if (activeField === 'cmaToken')
|
|
90
|
-
setCmaToken((v) => v + input);
|
|
91
|
-
else
|
|
92
|
-
setHost((v) => v + input);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const cursor = cursorVisible ? '█' : ' ';
|
|
96
|
-
function renderField(label, value, field, masked = false) {
|
|
97
|
-
const isActive = activeField === field;
|
|
98
|
-
const display = masked ? '•'.repeat(value.length) : value;
|
|
99
|
-
const fallback = field === 'host' ? DEFAULT_CONFIGURED_HOST : _jsx(Text, { dimColor: true, children: "(empty)" });
|
|
100
|
-
return (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: isActive ? PALETTE.info : undefined, children: '?' }), _jsxs(Text, { bold: isActive, children: [label, ":"] }), _jsx(Text, { children: isActive ? display + cursor : display || fallback })] }));
|
|
101
|
-
}
|
|
102
|
-
const displayError = inlineError ?? externalError ?? null;
|
|
103
|
-
return (_jsxs(Box, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [summary && _jsxs(Text, { color: PALETTE.success, children: ["\u2713 ", summary] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: initialSpaceId && initialCmaToken
|
|
104
|
-
? 'Credentials pre-filled from experiences setup. Press Enter to continue or edit any field to update.'
|
|
105
|
-
: 'Enter your Contentful credentials to continue.' }) }), !(initialSpaceId && initialCmaToken) && (_jsx(Text, { dimColor: true, children: "Tip: run experiences setup to save these to ~/.config/experiences/credentials.json so they pre-fill here automatically." })), _jsxs(Box, { flexDirection: "column", gap: 0, marginTop: 1, children: [renderField('Space ID', spaceId, 'spaceId'), renderField('Environment', environmentId, 'environmentId'), renderField('CMA Token', cmaToken, 'cmaToken', true), renderField('API Host', host, 'host')] }), activeField === 'host' && _jsx(Text, { dimColor: true, children: "Default: api.contentful.com \u00B7 EU spaces: api.eu.contentful.com" }), displayError && _jsxs(Text, { color: PALETTE.error, children: ["\u2717 ", displayError] }), validating && (_jsx(Text, { color: PALETTE.info, children: generatePrefetchStatus === 'running'
|
|
106
|
-
? 'Validating credentials & finishing component generation...'
|
|
107
|
-
: 'Validating credentials...' })), !validating && generatePrefetchStatus === 'running' && _jsx(Text, { dimColor: true, children: "Component generation in progress..." }), !validating && generatePrefetchStatus === 'complete' && (_jsx(Text, { color: PALETTE.success, children: "Component generation complete." })), !validating && generatePrefetchStatus === 'failed' && (_jsxs(Text, { color: PALETTE.warning, children: ["Component generation failed", generatePrefetchError ? `: ${generatePrefetchError}` : '', ". Will retry after credential validation.", onRetryPrefetch ? ' Press R to retry now.' : ''] })), _jsxs(Box, { gap: 3, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "[Enter] Next field / Submit" }), _jsx(Text, { dimColor: true, children: "[Tab] Switch field" }), _jsx(Text, { dimColor: true, children: "[q] Quit" })] }), onSkip && (_jsx(Box, { marginTop: 0, children: _jsx(Text, { dimColor: true, children: "[s] Skip \u2014 review locally only (no push, no live preview)" }) }))] }));
|
|
108
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { PALETTE } from '../../../analyze/select/tui/theme.js';
|
|
3
|
-
import { Box, Text } from 'ink';
|
|
4
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
5
|
-
import { buildPostPushUrl } from '../../../lib/contentful-urls.js';
|
|
6
|
-
export function DoneStep({ componentTypes, designTokens, summary, spaceId, environmentId, host, runTeaser, failures = [], onExit, }) {
|
|
7
|
-
useImmediateInput((input, key) => {
|
|
8
|
-
if (key.return || input === 'q' || key.escape) {
|
|
9
|
-
onExit();
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const totalFailed = componentTypes.failed + designTokens.failed;
|
|
13
|
-
const totalPushed = componentTypes.created +
|
|
14
|
-
componentTypes.updated +
|
|
15
|
-
componentTypes.removed +
|
|
16
|
-
designTokens.created +
|
|
17
|
-
designTokens.updated +
|
|
18
|
-
designTokens.removed;
|
|
19
|
-
const success = totalFailed === 0;
|
|
20
|
-
function EntityRows({ entity, label }) {
|
|
21
|
-
return (_jsxs(_Fragment, { children: [entity.created > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.success, children: "\u2713" }), _jsxs(Text, { children: [entity.created, " ", label, entity.created !== 1 ? 's' : '', " created"] })] })), entity.updated > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.success, children: "\u2713" }), _jsxs(Text, { children: [entity.updated, " ", label, entity.updated !== 1 ? 's' : '', " updated"] })] })), entity.removed > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.success, children: "\u2713" }), _jsxs(Text, { children: [entity.removed, " ", label, entity.removed !== 1 ? 's' : '', " removed"] })] })), entity.failed > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.error, children: "\u2717" }), _jsxs(Text, { color: PALETTE.error, children: [entity.failed, " ", label, entity.failed !== 1 ? 's' : '', " failed \u2014 check logs above"] })] }))] }));
|
|
22
|
-
}
|
|
23
|
-
return (_jsxs(Box, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [success ? (_jsx(Text, { bold: true, color: PALETTE.success, children: "Done!" })) : (_jsx(Text, { bold: true, color: PALETTE.warning, children: "\u26A0 Finished with errors" })), totalPushed === 0 && totalFailed === 0 && !summary ? (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Nothing was pushed \u2014 everything was already up to date." }) })) : (_jsxs(Box, { flexDirection: "column", gap: 0, marginTop: 1, children: [_jsx(EntityRows, { entity: componentTypes, label: "Component Type" }), _jsx(EntityRows, { entity: designTokens, label: "Design Token" }), summary && (_jsxs(Box, { gap: 1, marginTop: 1, children: [_jsxs(Text, { dimColor: true, children: ["Server: ", summary.succeeded, "/", summary.total, " succeeded"] }), summary.failed > 0 && _jsxs(Text, { color: PALETTE.error, children: [", ", summary.failed, " failed"] })] }))] })), failures.length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, color: PALETTE.error, children: "Failure details" }), failures.map((failure) => (_jsxs(Text, { color: PALETTE.error, children: [failure.entityType, " ", failure.entityId, ": ", failure.message] }, `${failure.entityType}:${failure.entityId}`)))] })), _jsxs(Box, { gap: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "Space:" }), _jsx(Text, { children: spaceId }), _jsx(Text, { dimColor: true, children: "/" }), _jsx(Text, { dimColor: true, children: "Environment:" }), _jsx(Text, { children: environmentId })] }), success && totalPushed > 0 && (_jsxs(Box, { flexDirection: "column", gap: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "Your design system is now in Contentful ExO." }), _jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(Text, { dimColor: true, children: "View your components here:" }), _jsx(Text, { color: PALETTE.info, children: buildPostPushUrl({ host: host ?? 'api.contentful.com', spaceId, environmentId }) })] }), _jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(Text, { dimColor: true, children: "View your design tokens here:" }), _jsx(Text, { color: PALETTE.info, children: buildPostPushUrl({ host: host ?? 'api.contentful.com', spaceId, environmentId, view: 'design_tokens' }) })] })] })), runTeaser && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: runTeaser }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "[Enter / q] Exit" }) })] }));
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PALETTE } from '../../../analyze/select/tui/theme.js';
|
|
3
|
-
import { Box, Text } from 'ink';
|
|
4
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
5
|
-
export function ErrorStep({ stepName, message, onExit, onRetryCredentials }) {
|
|
6
|
-
useImmediateInput((input, key) => {
|
|
7
|
-
if (input === 'r' && onRetryCredentials) {
|
|
8
|
-
onRetryCredentials();
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
if (key.return || input === 'q' || key.escape) {
|
|
12
|
-
onExit();
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
return (_jsxs(Box, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, color: PALETTE.error, children: ["\u2717 ", stepName, " failed"] }), _jsx(Text, { color: PALETTE.error, children: message }), _jsxs(Box, { gap: 3, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "[Enter / q] Exit" }), onRetryCredentials && _jsx(Text, { dimColor: true, children: "[r] Re-enter credentials" })] })] }));
|
|
16
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
4
|
-
export function GateStep({ successMessage, summary, context, continueLabel = 'Continue', skipLabel = 'Approve all and skip', onContinue, onSkip, onQuit, showSkip = true, intent = 'success', }) {
|
|
5
|
-
useImmediateInput((input, key) => {
|
|
6
|
-
if (key.return) {
|
|
7
|
-
onContinue();
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (input === 'a' && showSkip && onSkip) {
|
|
11
|
-
onSkip();
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (input === 'q' || key.escape) {
|
|
15
|
-
onQuit();
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const headerColor = intent === 'error' ? 'red' : 'green';
|
|
20
|
-
const headerIcon = intent === 'error' ? '✗' : '✓';
|
|
21
|
-
return (_jsxs(Box, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [_jsxs(Text, { color: headerColor, children: [headerIcon, " ", successMessage] }), summary && _jsx(Text, { dimColor: true, children: summary }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: context }) }), _jsxs(Box, { gap: 3, marginTop: 1, children: [_jsxs(Text, { dimColor: true, children: ["[Enter] ", continueLabel] }), showSkip && onSkip && _jsxs(Text, { dimColor: true, children: ["[a] ", skipLabel] }), _jsx(Text, { dimColor: true, children: "[q] Quit" })] })] }));
|
|
22
|
-
}
|