@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.
Files changed (204) hide show
  1. package/dist/package.json +14 -10
  2. package/dist/src/index.js +34937 -9
  3. package/dist/src/lib/cli-path.d.ts +4 -0
  4. package/dist/src/runs/export-helpers.d.ts +1 -12
  5. package/dist/src/runs/push-helpers.d.ts +1 -6
  6. package/package.json +12 -7
  7. package/skills/generate-components.md +427 -0
  8. package/skills/generate-tokens.md +194 -0
  9. package/skills/select-components.md +224 -0
  10. package/dist/src/analytics/apply.js +0 -30
  11. package/dist/src/analytics/client.js +0 -81
  12. package/dist/src/analytics/constants.js +0 -4
  13. package/dist/src/analytics/env.js +0 -14
  14. package/dist/src/analytics/exit.js +0 -24
  15. package/dist/src/analytics/index.js +0 -9
  16. package/dist/src/analytics/normalize.js +0 -18
  17. package/dist/src/analytics/os.js +0 -13
  18. package/dist/src/analytics/session.js +0 -15
  19. package/dist/src/analytics/tracker.js +0 -126
  20. package/dist/src/analytics/types.js +0 -1
  21. package/dist/src/analyze/build-analyze-view-rows.js +0 -63
  22. package/dist/src/analyze/command.js +0 -599
  23. package/dist/src/analyze/composite-closure.js +0 -0
  24. package/dist/src/analyze/composition/agent-parser/author-prompt.js +0 -22
  25. package/dist/src/analyze/composition/agent-parser/extract-parser.js +0 -44
  26. package/dist/src/analyze/composition/agent-parser/load-prompt.js +0 -31
  27. package/dist/src/analyze/composition/agent-parser/resolve-via-parser.js +0 -88
  28. package/dist/src/analyze/composition/agent-parser/sandbox.js +0 -187
  29. package/dist/src/analyze/composition/apply-mapping.js +0 -67
  30. package/dist/src/analyze/composition/candidate-critic-agent.js +0 -39
  31. package/dist/src/analyze/composition/candidate-critic.js +0 -63
  32. package/dist/src/analyze/composition/candidate-files.js +0 -131
  33. package/dist/src/analyze/composition/composition-cache-key.js +0 -19
  34. package/dist/src/analyze/composition/interchange-schema.js +0 -61
  35. package/dist/src/analyze/composition/manifest-doc-evidence.js +0 -136
  36. package/dist/src/analyze/composition/merge-edges.js +0 -70
  37. package/dist/src/analyze/composition/parse-map-edges.js +0 -55
  38. package/dist/src/analyze/composition/resolve-mapping-cli.js +0 -29
  39. package/dist/src/analyze/composition/resolve-mapping.js +0 -111
  40. package/dist/src/analyze/cycle-detection.js +0 -234
  41. package/dist/src/analyze/cycle-view.js +0 -28
  42. package/dist/src/analyze/fuzzy-search.js +0 -55
  43. package/dist/src/analyze/issue-inheritance.js +0 -108
  44. package/dist/src/analyze/lineage.js +0 -0
  45. package/dist/src/analyze/scope-gate-cascade.js +0 -170
  46. package/dist/src/analyze/search-neighborhood.js +0 -56
  47. package/dist/src/analyze/select/command.js +0 -484
  48. package/dist/src/analyze/select/index.js +0 -5
  49. package/dist/src/analyze/select/parser.js +0 -53
  50. package/dist/src/analyze/select/persistence.js +0 -80
  51. package/dist/src/analyze/select/preview-annotations.js +0 -62
  52. package/dist/src/analyze/select/stdout.js +0 -3
  53. package/dist/src/analyze/select/tui/App.js +0 -483
  54. package/dist/src/analyze/select/tui/components/ComponentDetail.js +0 -48
  55. package/dist/src/analyze/select/tui/components/ComponentRationalePanel.js +0 -125
  56. package/dist/src/analyze/select/tui/components/FieldEditor.js +0 -1131
  57. package/dist/src/analyze/select/tui/components/FinalizeDialog.js +0 -36
  58. package/dist/src/analyze/select/tui/components/GotoBanner.js +0 -30
  59. package/dist/src/analyze/select/tui/components/GroupedSidebar.js +0 -517
  60. package/dist/src/analyze/select/tui/components/HelpOverlay.js +0 -17
  61. package/dist/src/analyze/select/tui/components/JsonEditor.js +0 -131
  62. package/dist/src/analyze/select/tui/components/JsonPanel.js +0 -66
  63. package/dist/src/analyze/select/tui/components/LineagePanel.js +0 -22
  64. package/dist/src/analyze/select/tui/components/PreviewSummaryBar.js +0 -29
  65. package/dist/src/analyze/select/tui/components/QuitDialog.js +0 -14
  66. package/dist/src/analyze/select/tui/components/RationalePanel.js +0 -80
  67. package/dist/src/analyze/select/tui/components/Sidebar.js +0 -92
  68. package/dist/src/analyze/select/tui/components/SourcePanel.js +0 -52
  69. package/dist/src/analyze/select/tui/components/StatusBar.js +0 -7
  70. package/dist/src/analyze/select/tui/components/TopBar.js +0 -10
  71. package/dist/src/analyze/select/tui/components/removed-components-text.js +0 -11
  72. package/dist/src/analyze/select/tui/hooks/scroll-offset.js +0 -26
  73. package/dist/src/analyze/select/tui/hooks/useImmediateInput.js +0 -66
  74. package/dist/src/analyze/select/tui/hooks/useKeymap.js +0 -67
  75. package/dist/src/analyze/select/tui/hooks/useSession.js +0 -52
  76. package/dist/src/analyze/select/tui/hooks/useUndo.js +0 -26
  77. package/dist/src/analyze/select/tui/theme.js +0 -28
  78. package/dist/src/analyze/select/types.js +0 -39
  79. package/dist/src/analyze/select-agent/command.js +0 -558
  80. package/dist/src/analyze/select-agent/context-builder.js +0 -197
  81. package/dist/src/analyze/select-agent/show-rationale.js +0 -92
  82. package/dist/src/analyze/selection-cascade.js +0 -19
  83. package/dist/src/analyze/slot-graph.js +0 -17
  84. package/dist/src/analyze/tui/AnalyzeView.js +0 -64
  85. package/dist/src/apply/api-client.js +0 -440
  86. package/dist/src/apply/command.js +0 -845
  87. package/dist/src/apply/manifest.js +0 -1
  88. package/dist/src/apply/preview-utils.js +0 -26
  89. package/dist/src/apply/tui/SelectView.js +0 -34
  90. package/dist/src/apply/tui/ServerApplyView.js +0 -49
  91. package/dist/src/apply/tui/ServerPreviewView.js +0 -23
  92. package/dist/src/credentials-store.js +0 -74
  93. package/dist/src/generate/command.js +0 -597
  94. package/dist/src/generate/edit/command.js +0 -127
  95. package/dist/src/generate/tui/GenerateView.js +0 -10
  96. package/dist/src/host-utils.js +0 -26
  97. package/dist/src/import/agent-model-resolve.js +0 -35
  98. package/dist/src/import/auto-filter-resolve.js +0 -16
  99. package/dist/src/import/command.js +0 -380
  100. package/dist/src/import/cycle-auto-reject.js +0 -14
  101. package/dist/src/import/orchestrator.js +0 -603
  102. package/dist/src/import/path-utils.js +0 -30
  103. package/dist/src/import/picker-dispatch.js +0 -44
  104. package/dist/src/import/print-prompt.js +0 -31
  105. package/dist/src/import/strip-allowed-components.js +0 -22
  106. package/dist/src/import/tui/CustomPromptBanner.js +0 -8
  107. package/dist/src/import/tui/WizardApp.js +0 -1670
  108. package/dist/src/import/tui/ai-flag.js +0 -6
  109. package/dist/src/import/tui/auto-filter-error.js +0 -29
  110. package/dist/src/import/tui/autocomplete.js +0 -32
  111. package/dist/src/import/tui/components/AutoFilterBanner.js +0 -19
  112. package/dist/src/import/tui/components/CounterStrip.js +0 -12
  113. package/dist/src/import/tui/components/LegendEntry.js +0 -6
  114. package/dist/src/import/tui/cycle-panel-scroll.js +0 -33
  115. package/dist/src/import/tui/final-review-host.js +0 -25
  116. package/dist/src/import/tui/group-collapse.js +0 -11
  117. package/dist/src/import/tui/history.js +0 -53
  118. package/dist/src/import/tui/hooks/useLineage.js +0 -50
  119. package/dist/src/import/tui/hooks/useOverlayPanel.js +0 -27
  120. package/dist/src/import/tui/lineage-layout.js +0 -82
  121. package/dist/src/import/tui/merge-ai-decisions.js +0 -22
  122. package/dist/src/import/tui/push-decision-gate-helpers.js +0 -8
  123. package/dist/src/import/tui/push-progress.js +0 -1
  124. package/dist/src/import/tui/run-print-files-helpers.js +0 -8
  125. package/dist/src/import/tui/run-teaser.js +0 -9
  126. package/dist/src/import/tui/runLivePreview.js +0 -82
  127. package/dist/src/import/tui/runScopeGate.js +0 -28
  128. package/dist/src/import/tui/scope-gate-columns.js +0 -94
  129. package/dist/src/import/tui/scope-gate-host.js +0 -28
  130. package/dist/src/import/tui/sidebar-width.js +0 -3
  131. package/dist/src/import/tui/spawn-generate.js +0 -53
  132. package/dist/src/import/tui/step-filters.js +0 -42
  133. package/dist/src/import/tui/steps/AtomicGenerateReviewStep.js +0 -726
  134. package/dist/src/import/tui/steps/AtomicScopeGateStep.js +0 -210
  135. package/dist/src/import/tui/steps/CredentialsStep.js +0 -108
  136. package/dist/src/import/tui/steps/DoneStep.js +0 -24
  137. package/dist/src/import/tui/steps/ErrorStep.js +0 -16
  138. package/dist/src/import/tui/steps/GateStep.js +0 -22
  139. package/dist/src/import/tui/steps/GenerateReviewStep.js +0 -1618
  140. package/dist/src/import/tui/steps/PathValidationStep.js +0 -152
  141. package/dist/src/import/tui/steps/PreviewStep.js +0 -37
  142. package/dist/src/import/tui/steps/PreviewValidationErrorStep.js +0 -23
  143. package/dist/src/import/tui/steps/PushDecisionGateStep.js +0 -73
  144. package/dist/src/import/tui/steps/PushingStep.js +0 -24
  145. package/dist/src/import/tui/steps/RunningStep.js +0 -21
  146. package/dist/src/import/tui/steps/ScopeGateStep.js +0 -907
  147. package/dist/src/import/tui/steps/TokenInputStep.js +0 -88
  148. package/dist/src/import/tui/steps/WelcomeStep.js +0 -34
  149. package/dist/src/import/tui/steps/WizardPreviewStep.js +0 -169
  150. package/dist/src/import/tui/steps/auto-reject-decision.js +0 -9
  151. package/dist/src/import/tui/steps/breaking-change-format.js +0 -24
  152. package/dist/src/import/tui/steps/enumerate-cycle-breaks.js +0 -0
  153. package/dist/src/import/tui/steps/preview-diff.js +0 -175
  154. package/dist/src/import/tui/useFinalizePreview.js +0 -0
  155. package/dist/src/import/tui/useLivePreview.js +0 -122
  156. package/dist/src/import/tui/wizard-422-helpers.js +0 -60
  157. package/dist/src/import/tui/wizard-generate-progress.js +0 -25
  158. package/dist/src/import/tui/wizard-save-flow.js +0 -20
  159. package/dist/src/import/tui/wizard-state-transitions.js +0 -32
  160. package/dist/src/lib/agent-model-options.js +0 -15
  161. package/dist/src/lib/command-options.js +0 -30
  162. package/dist/src/lib/composition-mode.js +0 -39
  163. package/dist/src/lib/contentful-urls.js +0 -27
  164. package/dist/src/lib/debug-logger.js +0 -229
  165. package/dist/src/lib/debug-preamble.js +0 -33
  166. package/dist/src/lib/error-parser.js +0 -269
  167. package/dist/src/lib/prompt-overrides.js +0 -69
  168. package/dist/src/lib/terminal-capabilities.js +0 -51
  169. package/dist/src/lib/user-agent.js +0 -29
  170. package/dist/src/output/format.js +0 -110
  171. package/dist/src/print/command.js +0 -221
  172. package/dist/src/print/validate/tui/ValidateView.js +0 -37
  173. package/dist/src/print/validate/validators/cdf-validator.js +0 -104
  174. package/dist/src/print/validate/validators/dtcg-validator.js +0 -110
  175. package/dist/src/print/validate/validators/format-errors.js +0 -18
  176. package/dist/src/program.js +0 -105
  177. package/dist/src/runs/export-helpers.js +0 -59
  178. package/dist/src/runs/fingerprint.js +0 -75
  179. package/dist/src/runs/ls-command.js +0 -137
  180. package/dist/src/runs/modify-launcher.js +0 -42
  181. package/dist/src/runs/path-prompt.js +0 -72
  182. package/dist/src/runs/push-creds-prompt.js +0 -39
  183. package/dist/src/runs/push-helpers.js +0 -72
  184. package/dist/src/runs/push-launcher.js +0 -77
  185. package/dist/src/runs/replay-helpers.js +0 -164
  186. package/dist/src/runs/resolve-run-target.js +0 -45
  187. package/dist/src/runs/run-picker-mount.js +0 -72
  188. package/dist/src/runs/run-picker.js +0 -129
  189. package/dist/src/runs/save-conflict.js +0 -56
  190. package/dist/src/runs/save-path-resolver.js +0 -75
  191. package/dist/src/runs/staleness.js +0 -140
  192. package/dist/src/runs/store.js +0 -136
  193. package/dist/src/session/cache-keys.js +0 -44
  194. package/dist/src/session/command.js +0 -261
  195. package/dist/src/session/db.js +0 -1538
  196. package/dist/src/session/migration.js +0 -117
  197. package/dist/src/session/session-id.js +0 -212
  198. package/dist/src/session/stats.js +0 -89
  199. package/dist/src/setup/analytics-prompt.js +0 -24
  200. package/dist/src/setup/auto-filter-prompt.js +0 -24
  201. package/dist/src/setup/command.js +0 -966
  202. package/dist/src/setup/composition-mode-prompt.js +0 -37
  203. package/dist/src/setup/debug-mode-prompt.js +0 -22
  204. package/dist/src/types.js +0 -1
@@ -1 +0,0 @@
1
- export { readTokensFromPath, hasBreakingChangesWithImpact } from './command.js';
@@ -1,26 +0,0 @@
1
- /**
2
- * True when a preview response describes zero server-side changes across
3
- * every diff bucket (components, tokens, taxonomies). Used by:
4
- * - `experiences apply` (CLI): short-circuit the confirm-and-push step.
5
- * - `experiences import` wizard: block finalize when the resulting push
6
- * would be a pure no-op (INTEG-4411 refined guard).
7
- *
8
- * A push that produces ANY entry in ANY bucket — including a rejection that
9
- * removes a server-side component — is NOT empty. Note the server hides
10
- * removals entirely (empty removed[]) unless the preview was fetched with
11
- * allowDeletions: true, so "empty" here also correctly describes a preview
12
- * with pending-but-hidden deletions: pushing without --allow-deletions is a
13
- * genuine no-op in that case too, since the apply gate hides them the same way.
14
- */
15
- export function isEmptyPreview(preview) {
16
- const { components, tokens, taxonomies } = preview;
17
- return (components.new.length === 0 &&
18
- components.changed.length === 0 &&
19
- components.removed.length === 0 &&
20
- tokens.new.length === 0 &&
21
- tokens.changed.length === 0 &&
22
- tokens.removed.length === 0 &&
23
- taxonomies.new.length === 0 &&
24
- taxonomies.changed.length === 0 &&
25
- taxonomies.removed.length === 0);
26
- }
@@ -1,34 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Text } from 'ink';
3
- export function makeSelectKey(kind, id) {
4
- return `${kind}:${id}`;
5
- }
6
- const STATUS_ICON = {
7
- new: '✦',
8
- changed: '~',
9
- };
10
- const STATUS_COLOR = {
11
- new: 'green',
12
- changed: 'yellow',
13
- };
14
- export function SelectView({ entities, spaceId, environmentId, selectedIndex, selected, importing, }) {
15
- const tokens = entities.filter((e) => e.kind === 'token');
16
- const components = entities.filter((e) => e.kind === 'component');
17
- return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, width: "100%", children: [_jsxs(Text, { bold: true, children: ["Select \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), tokens.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: " Design Tokens" }), tokens.map((entity, i) => {
18
- const key = makeSelectKey('token', entity.id);
19
- return renderRow(entity, i, selectedIndex, selected.has(key), importing);
20
- }), _jsx(Text, { children: " " })] })), components.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: " Component Types" }), components.map((entity, i) => {
21
- const globalIdx = tokens.length + i;
22
- const key = makeSelectKey('component', entity.id);
23
- return renderRow(entity, globalIdx, selectedIndex, selected.has(key), importing);
24
- }), _jsx(Text, { children: " " })] })), entities.length === 0 && _jsx(Text, { dimColor: true, children: " No entities to display." }), importing ? (_jsx(Text, { dimColor: true, children: " Applying selected entities..." })) : (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: [" ", selected.size, " selected"] }), _jsx(Text, { dimColor: true, children: " \u2191\u2193 navigate Space toggle A all N none I apply selected Q quit" })] }))] }));
25
- }
26
- function renderRow(entity, globalIdx, selectedIndex, checked, importing) {
27
- const isCursor = globalIdx === selectedIndex;
28
- const icon = STATUS_ICON[entity.status] ?? '?';
29
- const color = STATUS_COLOR[entity.status] ?? 'white';
30
- const checkbox = checked ? '[✓]' : '[ ]';
31
- const cursor = isCursor ? '>' : ' ';
32
- const breakingNote = entity.isBreaking ? ' ⚠ breaking' : '';
33
- return (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: isCursor ? 'cyan' : undefined, children: [cursor, " "] }), _jsxs(Text, { color: checked ? 'cyan' : 'gray', children: [checkbox, " "] }), _jsxs(Text, { color: color, children: [icon, " "] }), _jsx(Box, { flexGrow: 1, marginRight: 1, children: _jsx(Text, { color: isCursor ? 'cyan' : undefined, wrap: "wrap", children: entity.id }) }), _jsxs(Text, { color: color, children: [entity.status, breakingNote] }), importing && checked && isCursor && _jsx(Text, { dimColor: true, children: " (writing...)" })] }, entity.id));
34
- }
@@ -1,49 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { Box, Text, useInput } from 'ink';
4
- import { ServerPreviewView } from './ServerPreviewView.js';
5
- import { buildPostPushUrl } from '../../lib/contentful-urls.js';
6
- import { formatEdsiError } from '../../lib/error-parser.js';
7
- export function ServerPreviewConfirm({ preview, spaceId, environmentId, breakingWithImpact, allowDeletions: fetchedAllowDeletions, onConfirm, onCancel, }) {
8
- const [allowDeletions, setAllowDeletions] = useState(fetchedAllowDeletions);
9
- const removedCount = preview.components.removed.length + preview.tokens.removed.length;
10
- useInput((input, key) => {
11
- if (key.return) {
12
- onConfirm(breakingWithImpact, allowDeletions);
13
- return;
14
- }
15
- if ((input === 'x' || input === 'X') && fetchedAllowDeletions && removedCount > 0) {
16
- setAllowDeletions((prev) => !prev);
17
- return;
18
- }
19
- if (key.escape || input === 'q')
20
- onCancel();
21
- });
22
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(ServerPreviewView, { preview: preview, spaceId: spaceId, environmentId: environmentId, allowDeletions: allowDeletions }), _jsxs(Box, { paddingX: 2, flexDirection: "column", children: [breakingWithImpact && (_jsxs(Text, { color: "red", bold: true, children: [' ', "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply."] })), allowDeletions && removedCount > 0 && (_jsxs(Text, { color: "red", bold: true, children: [' ', "\u26A0 ", removedCount, " missing ", removedCount === 1 ? 'entity' : 'entities', " will be permanently deleted. Press Enter to confirm."] })), fetchedAllowDeletions && removedCount > 0 && (_jsxs(Text, { dimColor: true, children: [" [x] ", allowDeletions ? '[✓]' : '[ ]', " Allow deletions"] })), _jsxs(Text, { children: [' ', "Press ", _jsx(Text, { bold: true, children: "Enter" }), " to apply, ", _jsx(Text, { bold: true, children: "Esc" }), " to cancel"] })] })] }));
23
- }
24
- export function ServerPreviewApp({ preview, spaceId, environmentId, allowDeletions, }) {
25
- useInput((input, key) => {
26
- if (key.escape || input === 'q')
27
- process.exit(0);
28
- });
29
- return (_jsx(ServerPreviewView, { preview: preview, spaceId: spaceId, environmentId: environmentId, allowDeletions: allowDeletions }));
30
- }
31
- export function ServerApplyProgress({ spaceId, environmentId, status, operationId, error, }) {
32
- useInput((_input, key) => {
33
- if (status === 'error' && (key.escape || _input === 'q'))
34
- process.exit(1);
35
- });
36
- return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, children: ["Import \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), status === 'applying' && _jsx(Text, { children: " Submitting apply request..." }), status === 'polling' && _jsxs(Text, { children: [" Operation ", operationId, " in progress..."] }), status === 'error' && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "red", children: [" \u2717 Error: ", error] }), _jsx(Text, { children: " " }), _jsx(Text, { dimColor: true, children: " Press Q to exit." })] }))] }));
37
- }
38
- export function ServerApplyDone({ operation, spaceId, environmentId, host }) {
39
- useInput((input, key) => {
40
- if (key.escape || input === 'q') {
41
- process.exit(operation.sys.status === 'succeeded' ? 0 : 1);
42
- }
43
- });
44
- const failures = (operation.items ?? []).filter((item) => item.status === 'failed');
45
- return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, children: ["Import complete \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), _jsxs(Text, { color: "green", children: [" \u2713 ", operation.summary.succeeded, " succeeded"] }), operation.summary.failed > 0 && _jsxs(Text, { color: "red", children: [" \u2717 ", operation.summary.failed, " failed"] }), operation.summary.failed === 0 && _jsx(Text, { dimColor: true, children: " All entities imported successfully." }), failures.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: " " }), _jsx(Text, { bold: true, children: " Failures:" }), failures.map((item, i) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "red", children: [' ', "\u2717 ", item.entityType, ": ", item.id] }), item.error && _jsxs(Text, { dimColor: true, children: [" ", formatItemError(item.error)] })] }, i)))] })), operation.sys.status === 'succeeded' && operation.summary.succeeded > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: " " }), _jsx(Text, { dimColor: true, children: " View your design system:" }), _jsxs(Text, { color: "cyan", children: [" ", buildPostPushUrl({ host: host ?? 'api.contentful.com', spaceId, environmentId })] }), _jsx(Text, { dimColor: true, children: " View your design tokens:" }), _jsxs(Text, { color: "cyan", children: [' ', buildPostPushUrl({ host: host ?? 'api.contentful.com', spaceId, environmentId, view: 'design_tokens' })] })] })), _jsx(Text, { children: " " }), _jsx(Text, { dimColor: true, children: " Press Q to exit." })] }));
46
- }
47
- function formatItemError(error) {
48
- return formatEdsiError(error);
49
- }
@@ -1,23 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Text } from 'ink';
3
- function BreakingBadge({ item }) {
4
- if (!item.changeClassification || item.changeClassification.classification !== 'breaking')
5
- return null;
6
- const reasons = item.changeClassification.breakingChanges
7
- .map((bc) => `${'slotId' in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`)
8
- .join(', ');
9
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "red", children: [" \u26A0 BREAKING: ", reasons] }), item.impact && (item.impact.affectedFragments > 0 || item.impact.affectedExperiences > 0) && (_jsxs(Text, { color: "red", children: [' ', "\u2192 affects ", item.impact.affectedFragments, " Fragments, ", item.impact.affectedExperiences, " Experiences"] }))] }));
10
- }
11
- function DraftWarning({ hasDraft }) {
12
- if (!hasDraft)
13
- return null;
14
- return _jsx(Text, { color: "yellow", children: " \u26A1 has pending draft changes" });
15
- }
16
- export function ServerPreviewView({ preview, spaceId, environmentId, allowDeletions, }) {
17
- const { components, tokens } = preview;
18
- const totalComponents = components.new.length + components.changed.length + components.unchanged.length + components.removed.length;
19
- const totalTokens = tokens.new.length + tokens.changed.length + tokens.unchanged.length + tokens.removed.length;
20
- return (_jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [_jsxs(Text, { bold: true, children: ["Preview \u2014 ", environmentId, " @ ", spaceId] }), _jsx(Text, { children: " " }), totalComponents > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: [" Component Types (", totalComponents, " total)"] }), _jsxs(Text, { color: "green", children: [" \u2746 ", components.new.length, " to create"] }), _jsxs(Text, { color: "yellow", children: [" ~ ", components.changed.length, " to update"] }), _jsxs(Text, { color: allowDeletions ? 'red' : 'yellow', children: [' ', allowDeletions ? '✗' : '⊘', " ", components.removed.length, " to ", allowDeletions ? 'delete' : 'skip'] }), _jsxs(Text, { dimColor: true, children: [" \u00B7 ", components.unchanged.length, " unchanged"] }), components.changed.map((item, i) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: "yellow", children: [" ~ ", item.current.name] }), _jsx(DraftWarning, { hasDraft: item.hasPendingDraftChanges })] }), _jsx(BreakingBadge, { item: item })] }, i))), _jsx(Text, { children: " " })] })), totalTokens > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: [" Design Tokens (", totalTokens, " total)"] }), _jsxs(Text, { color: "green", children: [" \u2746 ", tokens.new.length, " to create"] }), _jsxs(Text, { color: "yellow", children: [" ~ ", tokens.changed.length, " to update"] }), _jsxs(Text, { color: allowDeletions ? 'red' : 'yellow', children: [' ', allowDeletions ? '✗' : '⊘', " ", tokens.removed.length, " to ", allowDeletions ? 'delete' : 'skip'] }), _jsxs(Text, { dimColor: true, children: [" \u00B7 ", tokens.unchanged.length, " unchanged"] }), tokens.changed
21
- .filter((t) => t.hasPendingDraftChanges)
22
- .map((item, i) => (_jsxs(Box, { flexDirection: "row", children: [_jsxs(Text, { color: "yellow", children: [" ~ ", item.current.name] }), _jsx(DraftWarning, { hasDraft: true })] }, i))), _jsx(Text, { children: " " })] })), _jsx(Text, { dimColor: true, children: " Press Q to exit." })] }));
23
- }
@@ -1,74 +0,0 @@
1
- import { readFile, writeFile, mkdir } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { homedir } from 'node:os';
4
- import { toConfiguredHost } from './host-utils.js';
5
- import { isCompositionMode } from './lib/composition-mode.js';
6
- const CREDENTIALS_DIR = join(homedir(), '.config', 'experiences');
7
- const CREDENTIALS_PATH = join(CREDENTIALS_DIR, 'credentials.json');
8
- /**
9
- * Read persisted Contentful credentials.
10
- *
11
- * Precedence (INTEG-4410): what the operator saved on disk via
12
- * `experiences setup` or the wizard's credentials step wins over ambient
13
- * `CONTENTFUL_*` / `EDS_HOST` env vars. Env vars are still consulted as a
14
- * fallback when the field on disk is missing or empty — this preserves
15
- * back-compat for CI / scripts that only export env and never call setup.
16
- *
17
- * The pre-INTEG-4410 order (env-first) silently shadowed saved values, so
18
- * operators who saved a different space via setup kept seeing the env one
19
- * pre-filled in the wizard. The saved value now wins; the env fallback only
20
- * fires when the on-disk field is empty.
21
- */
22
- export async function readExperiencesCredentials() {
23
- try {
24
- const raw = await readFile(CREDENTIALS_PATH, 'utf8');
25
- const parsed = JSON.parse(raw);
26
- // Disk value wins when non-empty; env is the fallback.
27
- const host = toConfiguredHost(parsed.host || process.env['EDS_HOST']);
28
- return {
29
- spaceId: parsed.spaceId || process.env['CONTENTFUL_SPACE_ID'] || '',
30
- environmentId: parsed.environmentId || process.env['CONTENTFUL_ENVIRONMENT_ID'] || '',
31
- cmaToken: parsed.cmaToken || process.env['CONTENTFUL_MANAGEMENT_TOKEN'] || '',
32
- ...(host ? { host } : {}),
33
- ...(parsed.agent ? { agent: parsed.agent } : {}),
34
- ...(parsed.agentModel ? { agentModel: parsed.agentModel } : {}),
35
- ...(parsed.selectPromptPath ? { selectPromptPath: parsed.selectPromptPath } : {}),
36
- ...(parsed.generatePromptPath ? { generatePromptPath: parsed.generatePromptPath } : {}),
37
- ...(typeof parsed.autoFilter === 'boolean' ? { autoFilter: parsed.autoFilter } : {}),
38
- ...(typeof parsed.debug === 'boolean' ? { debug: parsed.debug } : {}),
39
- ...(typeof parsed.analyticsDisabled === 'boolean' ? { analyticsDisabled: parsed.analyticsDisabled } : {}),
40
- ...(typeof parsed.compositionMode === 'string' && isCompositionMode(parsed.compositionMode)
41
- ? { compositionMode: parsed.compositionMode }
42
- : {}),
43
- };
44
- }
45
- catch {
46
- const host = toConfiguredHost(process.env['EDS_HOST']);
47
- return {
48
- spaceId: process.env['CONTENTFUL_SPACE_ID'] ?? '',
49
- environmentId: process.env['CONTENTFUL_ENVIRONMENT_ID'] ?? '',
50
- cmaToken: process.env['CONTENTFUL_MANAGEMENT_TOKEN'] ?? '',
51
- ...(host ? { host } : {}),
52
- };
53
- }
54
- }
55
- export async function writeExperiencesCredentials(creds) {
56
- const { host: _host, agent, agentModel, selectPromptPath, generatePromptPath, autoFilter, debug, analyticsDisabled, compositionMode, ...rest } = creds;
57
- const host = toConfiguredHost(creds.host);
58
- await mkdir(CREDENTIALS_DIR, { recursive: true });
59
- await writeFile(CREDENTIALS_PATH, JSON.stringify({
60
- ...rest,
61
- ...(host ? { host } : {}),
62
- ...(agent ? { agent } : {}),
63
- ...(agentModel ? { agentModel } : {}),
64
- ...(selectPromptPath ? { selectPromptPath } : {}),
65
- ...(generatePromptPath ? { generatePromptPath } : {}),
66
- ...(typeof autoFilter === 'boolean' ? { autoFilter } : {}),
67
- ...(typeof debug === 'boolean' ? { debug } : {}),
68
- ...(typeof analyticsDisabled === 'boolean' ? { analyticsDisabled } : {}),
69
- ...(compositionMode && isCompositionMode(compositionMode) ? { compositionMode } : {}),
70
- }, null, 2) + '\n', { mode: 0o600 });
71
- }
72
- export function experiencesCredentialsPath() {
73
- return CREDENTIALS_PATH;
74
- }