@contentful/experience-design-system-cli 2.26.1-dev-build-64063df.0 → 2.26.1-dev-build-f1d1f30.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 +13 -9
- 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,907 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useStdout } from 'ink';
|
|
3
|
-
import { PALETTE } from '../../../analyze/select/tui/theme.js';
|
|
4
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { useImmediateInput } from '../../../analyze/select/tui/hooks/useImmediateInput.js';
|
|
6
|
-
import { GroupedSidebar, buildVisibleRows, } from '../../../analyze/select/tui/components/GroupedSidebar.js';
|
|
7
|
-
import { computeAllClosures } from '../../../analyze/composite-closure.js';
|
|
8
|
-
import { buildComponentGraph } from '../../../analyze/slot-graph.js';
|
|
9
|
-
import { findSlotCycles } from '../../../analyze/cycle-detection.js';
|
|
10
|
-
import { computeAutocomplete } from '../autocomplete.js';
|
|
11
|
-
import { buildFlatDimPredicate, computeFilterKeys, intersectFilterKeys } from '../step-filters.js';
|
|
12
|
-
import { useLineage } from '../hooks/useLineage.js';
|
|
13
|
-
import { useOverlayPanel } from '../hooks/useOverlayPanel.js';
|
|
14
|
-
import { computeSidebarBudget, FALLBACK_ROWS } from '../lineage-layout.js';
|
|
15
|
-
import { LineagePanel } from '../../../analyze/select/tui/components/LineagePanel.js';
|
|
16
|
-
import { GotoBanner } from '../../../analyze/select/tui/components/GotoBanner.js';
|
|
17
|
-
import { HelpOverlay } from '../../../analyze/select/tui/components/HelpOverlay.js';
|
|
18
|
-
import { legendEntry } from '../components/LegendEntry.js';
|
|
19
|
-
import { AutoFilterBanner } from '../components/AutoFilterBanner.js';
|
|
20
|
-
import { CounterStrip } from '../components/CounterStrip.js';
|
|
21
|
-
import { isAiFlagged } from '../ai-flag.js';
|
|
22
|
-
import { resolveGroupRoot } from '../group-collapse.js';
|
|
23
|
-
import { buildCycleUnits, collectReachableCycleUnits, computeCycleAwareAcceptCascade, computeCycleAwareRejectCascade, } from '../../../analyze/scope-gate-cascade.js';
|
|
24
|
-
import { fuzzyMatches } from '../../../analyze/fuzzy-search.js';
|
|
25
|
-
import { computeDirectNeighborhood, findAllAncestors } from '../../../analyze/search-neighborhood.js';
|
|
26
|
-
import { buildAddedComponentsList, buildAddedGroupsList, computeColumnWidths, computeCounters, } from '../scope-gate-columns.js';
|
|
27
|
-
const FOCUSED_REASON_MAX_LINES = 4;
|
|
28
|
-
const HELP_SECTIONS = [
|
|
29
|
-
{
|
|
30
|
-
title: 'Navigation',
|
|
31
|
-
entries: [
|
|
32
|
-
{ keys: 'j / k / ↑ / ↓', label: 'Move cursor' },
|
|
33
|
-
{ keys: 'Tab / Shift-Tab', label: 'Switch column' },
|
|
34
|
-
{ keys: 'Enter', label: 'Jump to main' },
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: 'Selection',
|
|
39
|
-
entries: [
|
|
40
|
-
{ keys: 'a', label: 'Accept' },
|
|
41
|
-
{ keys: 'r', label: 'Reject' },
|
|
42
|
-
{ keys: 'A', label: 'Toggle all' },
|
|
43
|
-
{ keys: 'Y', label: 'Accept non-flagged' },
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
title: 'Sidebar views',
|
|
48
|
-
entries: [
|
|
49
|
-
{ keys: 'L', label: 'Flat view' },
|
|
50
|
-
{ keys: 'l', label: 'Lineage' },
|
|
51
|
-
{ keys: 'i', label: 'Focus lineage' },
|
|
52
|
-
{ keys: 'o', label: 'Only cycles' },
|
|
53
|
-
{ keys: 'space', label: 'Expand/collapse group' },
|
|
54
|
-
{ keys: 'E / C', label: 'Expand/collapse all' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
title: 'Panels',
|
|
59
|
-
entries: [
|
|
60
|
-
{ keys: 'c', label: 'Cycle list' },
|
|
61
|
-
{ keys: 'x', label: 'Review flags' },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: 'Search',
|
|
66
|
-
entries: [{ keys: '/', label: 'Search' }],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
title: 'General',
|
|
70
|
-
entries: [
|
|
71
|
-
{ keys: 'f', label: 'Continue' },
|
|
72
|
-
{ keys: '?', label: 'Close help' },
|
|
73
|
-
{ keys: 'q', label: 'Quit' },
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
function capReasonForFocusedRow(reason, width) {
|
|
78
|
-
const safeWidth = Math.max(20, width);
|
|
79
|
-
const budget = safeWidth * FOCUSED_REASON_MAX_LINES;
|
|
80
|
-
if (reason.length <= budget)
|
|
81
|
-
return reason;
|
|
82
|
-
return reason.slice(0, budget - 1).trimEnd() + '…';
|
|
83
|
-
}
|
|
84
|
-
function toSidebarEntry(c) {
|
|
85
|
-
const $slots = {};
|
|
86
|
-
if (c.slots) {
|
|
87
|
-
for (const s of c.slots) {
|
|
88
|
-
$slots[s.name] = { $allowedComponents: s.allowedComponents };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const entry = {
|
|
92
|
-
$type: 'component',
|
|
93
|
-
$properties: { __scopeGate: { $type: 'string', $category: 'content' } },
|
|
94
|
-
};
|
|
95
|
-
if (Object.keys($slots).length > 0)
|
|
96
|
-
entry.$slots = $slots;
|
|
97
|
-
return entry;
|
|
98
|
-
}
|
|
99
|
-
export function ScopeGateStep({ components, onConfirm, onQuit, aiFilterStatus = 'idle', aiFilterProgress = null, aiFilterError = null, onCancelAutoFilter, }) {
|
|
100
|
-
const { stdout } = useStdout();
|
|
101
|
-
const totalWidth = stdout?.columns ?? 80;
|
|
102
|
-
const columnPlan = useMemo(() => computeColumnWidths(totalWidth), [totalWidth]);
|
|
103
|
-
const sidebarWidth = columnPlan.main;
|
|
104
|
-
const [userDecisions, setUserDecisions] = useState(new Map());
|
|
105
|
-
const [nav, setNav] = useState({ cursor: 0, scrollOffset: 0 });
|
|
106
|
-
const [focusedColumn, setFocusedColumn] = useState('main');
|
|
107
|
-
const [addedComponentsCursor, setAddedComponentsCursor] = useState(0);
|
|
108
|
-
const [addedGroupsCursor, setAddedGroupsCursor] = useState(0);
|
|
109
|
-
const cursor = nav.cursor;
|
|
110
|
-
const scrollOffset = nav.scrollOffset;
|
|
111
|
-
const lineagePanel = useOverlayPanel({ toggleKey: 'l' });
|
|
112
|
-
const [lineageCursor, setLineageCursor] = useState(0);
|
|
113
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] = useState(false);
|
|
114
|
-
const [cyclesCursor, setCyclesCursor] = useState(0);
|
|
115
|
-
const aiRationalePanel = useOverlayPanel({ toggleKey: 'x' });
|
|
116
|
-
const [aiCursor, setAiCursor] = useState(0);
|
|
117
|
-
const [pendingRejectCascade, setPendingRejectCascade] = useState(null);
|
|
118
|
-
const [searchOpen, setSearchOpen] = useState(false);
|
|
119
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
120
|
-
const [autocompleteCandidates, setAutocompleteCandidates] = useState([]);
|
|
121
|
-
const [jumpFilterTarget, setJumpFilterTarget] = useState(null);
|
|
122
|
-
const [columnOneView, setColumnOneView] = useState('grouped');
|
|
123
|
-
const [activeFilters, setActiveFilters] = useState(new Set());
|
|
124
|
-
const [showHelp, setShowHelp] = useState(false);
|
|
125
|
-
const getState = (name) => {
|
|
126
|
-
const v = userDecisions.get(name);
|
|
127
|
-
return v ?? 'undecided';
|
|
128
|
-
};
|
|
129
|
-
const isIncluded = (name) => getState(name) === 'accepted';
|
|
130
|
-
const applyDecisions = (entries) => {
|
|
131
|
-
setUserDecisions((prev) => {
|
|
132
|
-
const next = new Map(prev);
|
|
133
|
-
for (const [name, decision] of entries)
|
|
134
|
-
next.set(name, decision);
|
|
135
|
-
return next;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
const groupedItems = useMemo(() => components.map((c) => ({
|
|
139
|
-
key: c.name,
|
|
140
|
-
entry: toSidebarEntry(c),
|
|
141
|
-
status: isAiFlagged(c) ? 'warning' : 'ok',
|
|
142
|
-
})), [components]);
|
|
143
|
-
const graph = useMemo(() => buildComponentGraph(groupedItems), [groupedItems]);
|
|
144
|
-
const slotCycles = useMemo(() => {
|
|
145
|
-
try {
|
|
146
|
-
return findSlotCycles(graph);
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
return [];
|
|
150
|
-
}
|
|
151
|
-
}, [graph]);
|
|
152
|
-
const cycleParticipants = useMemo(() => {
|
|
153
|
-
const set = new Set();
|
|
154
|
-
for (const c of slotCycles)
|
|
155
|
-
for (const n of c.path)
|
|
156
|
-
set.add(n);
|
|
157
|
-
return set;
|
|
158
|
-
}, [slotCycles]);
|
|
159
|
-
const cycleUnits = useMemo(() => buildCycleUnits(slotCycles), [slotCycles]);
|
|
160
|
-
const cyclesJumpables = useMemo(() => slotCycles.map((c, i) => ({
|
|
161
|
-
cycleIndex: i,
|
|
162
|
-
jumpTarget: c.path[0],
|
|
163
|
-
})), [slotCycles]);
|
|
164
|
-
const hasCycles = slotCycles.length > 0;
|
|
165
|
-
const closures = useMemo(() => computeAllClosures(graph), [graph]);
|
|
166
|
-
const [expandedGroups, setExpandedGroups] = useState(() => {
|
|
167
|
-
const seed = new Set(closures.keys());
|
|
168
|
-
for (const p of cycleParticipants)
|
|
169
|
-
seed.add(p);
|
|
170
|
-
return seed;
|
|
171
|
-
});
|
|
172
|
-
const seededGroupsRef = useRef(closures.size > 0 || cycleParticipants.size > 0);
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (seededGroupsRef.current)
|
|
175
|
-
return;
|
|
176
|
-
if (closures.size === 0 && cycleParticipants.size === 0)
|
|
177
|
-
return;
|
|
178
|
-
seededGroupsRef.current = true;
|
|
179
|
-
const seed = new Set(closures.keys());
|
|
180
|
-
for (const p of cycleParticipants)
|
|
181
|
-
seed.add(p);
|
|
182
|
-
setExpandedGroups(seed);
|
|
183
|
-
}, [closures, cycleParticipants]);
|
|
184
|
-
const hasGroupRoots = useMemo(() => {
|
|
185
|
-
if (cycleParticipants.size > 0)
|
|
186
|
-
return true;
|
|
187
|
-
for (const c of closures.values())
|
|
188
|
-
if (c.nodes.length > 1)
|
|
189
|
-
return true;
|
|
190
|
-
return false;
|
|
191
|
-
}, [closures, cycleParticipants]);
|
|
192
|
-
const toggleExpanded = (rootName) => {
|
|
193
|
-
setExpandedGroups((prev) => {
|
|
194
|
-
const next = new Set(prev);
|
|
195
|
-
if (next.has(rootName))
|
|
196
|
-
next.delete(rootName);
|
|
197
|
-
else
|
|
198
|
-
next.add(rootName);
|
|
199
|
-
return next;
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
const brokenKeys = useMemo(() => {
|
|
203
|
-
const set = new Set();
|
|
204
|
-
for (const c of components)
|
|
205
|
-
if (isAiFlagged(c))
|
|
206
|
-
set.add(c.name);
|
|
207
|
-
return set;
|
|
208
|
-
}, [components]);
|
|
209
|
-
const filterVisibleKeys = useMemo(() => {
|
|
210
|
-
if (jumpFilterTarget) {
|
|
211
|
-
return findAllAncestors(jumpFilterTarget, graph);
|
|
212
|
-
}
|
|
213
|
-
const categoryKeys = computeFilterKeys({
|
|
214
|
-
filters: activeFilters,
|
|
215
|
-
data: { cycles: cycleParticipants, broken: brokenKeys },
|
|
216
|
-
});
|
|
217
|
-
const searchKeys = (() => {
|
|
218
|
-
if (!searchQuery)
|
|
219
|
-
return undefined;
|
|
220
|
-
const matches = groupedItems.map((it) => it.key).filter((k) => fuzzyMatches(searchQuery, k));
|
|
221
|
-
if (matches.length === 0)
|
|
222
|
-
return undefined;
|
|
223
|
-
return computeDirectNeighborhood(matches, graph);
|
|
224
|
-
})();
|
|
225
|
-
return intersectFilterKeys(categoryKeys, searchKeys);
|
|
226
|
-
}, [jumpFilterTarget, activeFilters, cycleParticipants, brokenKeys, searchQuery, groupedItems, graph]);
|
|
227
|
-
const visibleRows = useMemo(() => buildVisibleRows({
|
|
228
|
-
items: groupedItems,
|
|
229
|
-
cycleParticipants,
|
|
230
|
-
expandedGroups,
|
|
231
|
-
showFlatTier: false,
|
|
232
|
-
viewMode: columnOneView,
|
|
233
|
-
graph,
|
|
234
|
-
filterVisibleKeys,
|
|
235
|
-
}), [groupedItems, cycleParticipants, expandedGroups, columnOneView, graph, filterVisibleKeys]);
|
|
236
|
-
const total = visibleRows.length;
|
|
237
|
-
const safeCursor = Math.min(cursor, Math.max(0, total - 1));
|
|
238
|
-
const currentRow = visibleRows[safeCursor];
|
|
239
|
-
const currentRowKey = currentRow && currentRow.itemIdx >= 0 ? groupedItems[currentRow.itemIdx]?.key : undefined;
|
|
240
|
-
const focusedComponent = currentRowKey ? components.find((c) => c.name === currentRowKey) : undefined;
|
|
241
|
-
const selectionStateByKey = useMemo(() => {
|
|
242
|
-
const map = new Map();
|
|
243
|
-
for (const c of components) {
|
|
244
|
-
map.set(c.name, getState(c.name));
|
|
245
|
-
}
|
|
246
|
-
return map;
|
|
247
|
-
}, [components, userDecisions]);
|
|
248
|
-
const aiFlaggedByKey = useMemo(() => {
|
|
249
|
-
const map = new Map();
|
|
250
|
-
for (const c of components)
|
|
251
|
-
map.set(c.name, isAiFlagged(c));
|
|
252
|
-
return map;
|
|
253
|
-
}, [components]);
|
|
254
|
-
const dimPredicate = useMemo(() => buildFlatDimPredicate({
|
|
255
|
-
viewMode: columnOneView,
|
|
256
|
-
searchQuery,
|
|
257
|
-
filterVisibleKeys,
|
|
258
|
-
}), [columnOneView, searchQuery, filterVisibleKeys]);
|
|
259
|
-
const applyReject = (target) => {
|
|
260
|
-
const { toReject, toDeselect } = computeCycleAwareRejectCascade(target, graph, cycleUnits);
|
|
261
|
-
const entries = [];
|
|
262
|
-
for (const n of toReject)
|
|
263
|
-
entries.push([n, 'rejected']);
|
|
264
|
-
for (const n of toDeselect)
|
|
265
|
-
entries.push([n, 'undecided']);
|
|
266
|
-
applyDecisions(entries);
|
|
267
|
-
};
|
|
268
|
-
const applyAccept = (target) => {
|
|
269
|
-
const cascade = computeCycleAwareAcceptCascade(target, graph, cycleUnits);
|
|
270
|
-
applyDecisions([...cascade].map((n) => [n, 'accepted']));
|
|
271
|
-
};
|
|
272
|
-
const requestAccept = (name) => {
|
|
273
|
-
if (getState(name) === 'accepted')
|
|
274
|
-
return;
|
|
275
|
-
applyAccept(name);
|
|
276
|
-
};
|
|
277
|
-
const requestReject = (name) => {
|
|
278
|
-
if (getState(name) === 'rejected')
|
|
279
|
-
return;
|
|
280
|
-
const { toReject, toDeselect } = computeCycleAwareRejectCascade(name, graph, cycleUnits);
|
|
281
|
-
const ancestors = [...toReject].filter((n) => n !== name).sort();
|
|
282
|
-
const descendants = [...toDeselect].sort();
|
|
283
|
-
if (ancestors.length + descendants.length >= 2) {
|
|
284
|
-
setPendingRejectCascade({ target: name, ancestors, descendants });
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
applyReject(name);
|
|
288
|
-
};
|
|
289
|
-
const focusedRowKey = () => {
|
|
290
|
-
const row = visibleRows[safeCursor];
|
|
291
|
-
if (!row)
|
|
292
|
-
return undefined;
|
|
293
|
-
switch (row.kind) {
|
|
294
|
-
case 'standalone':
|
|
295
|
-
case 'empty':
|
|
296
|
-
case 'group-root':
|
|
297
|
-
case 'group-child':
|
|
298
|
-
case 'flat':
|
|
299
|
-
case 'cycle':
|
|
300
|
-
return row.itemIdx >= 0 ? groupedItems[row.itemIdx]?.key : undefined;
|
|
301
|
-
default:
|
|
302
|
-
return undefined;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
const partition = () => {
|
|
306
|
-
const accepted = [];
|
|
307
|
-
const rejected = [];
|
|
308
|
-
for (const c of components) {
|
|
309
|
-
if (getState(c.name) === 'accepted')
|
|
310
|
-
accepted.push(c.name);
|
|
311
|
-
else
|
|
312
|
-
rejected.push(c.name);
|
|
313
|
-
}
|
|
314
|
-
return { accepted, rejected };
|
|
315
|
-
};
|
|
316
|
-
const { entries: lineageEntries, jumpables: lineageJumpables } = useLineage(focusedComponent?.name ?? null, graph);
|
|
317
|
-
const { sidebarVisibleCount: visibleCount, panelMaxRows } = computeSidebarBudget({
|
|
318
|
-
rows: stdout?.rows ?? FALLBACK_ROWS,
|
|
319
|
-
panelOpen: lineagePanel.isOpen,
|
|
320
|
-
entryCount: lineageEntries.length,
|
|
321
|
-
});
|
|
322
|
-
useEffect(() => {
|
|
323
|
-
setNav((prev) => {
|
|
324
|
-
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
325
|
-
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
326
|
-
const nextScroll = Math.min(prev.scrollOffset, maxIdx);
|
|
327
|
-
if (nextCursor === prev.cursor && nextScroll === prev.scrollOffset)
|
|
328
|
-
return prev;
|
|
329
|
-
return { cursor: nextCursor, scrollOffset: nextScroll };
|
|
330
|
-
});
|
|
331
|
-
}, [visibleRows]);
|
|
332
|
-
const searchMatches = useMemo(() => {
|
|
333
|
-
if (!searchQuery)
|
|
334
|
-
return [];
|
|
335
|
-
return components.filter((c) => fuzzyMatches(searchQuery, c.name)).map((c) => c.name);
|
|
336
|
-
}, [components, searchQuery]);
|
|
337
|
-
const findRowIndexForName = (name) => {
|
|
338
|
-
for (let i = 0; i < visibleRows.length; i++) {
|
|
339
|
-
const row = visibleRows[i];
|
|
340
|
-
if (row.itemIdx < 0)
|
|
341
|
-
continue;
|
|
342
|
-
if (groupedItems[row.itemIdx]?.key === name)
|
|
343
|
-
return i;
|
|
344
|
-
}
|
|
345
|
-
return -1;
|
|
346
|
-
};
|
|
347
|
-
const jumpCursorTo = (name) => {
|
|
348
|
-
const idx = findRowIndexForName(name);
|
|
349
|
-
if (idx < 0)
|
|
350
|
-
return;
|
|
351
|
-
setNav(({ scrollOffset: prev }) => {
|
|
352
|
-
let nextScroll = prev;
|
|
353
|
-
if (idx < prev)
|
|
354
|
-
nextScroll = idx;
|
|
355
|
-
else if (idx >= prev + visibleCount)
|
|
356
|
-
nextScroll = idx - visibleCount + 1;
|
|
357
|
-
return { cursor: idx, scrollOffset: nextScroll };
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
useImmediateInput((input, key) => {
|
|
361
|
-
if (showHelp)
|
|
362
|
-
return;
|
|
363
|
-
if (pendingRejectCascade) {
|
|
364
|
-
if (input === 'y' || input === 'Y') {
|
|
365
|
-
applyReject(pendingRejectCascade.target);
|
|
366
|
-
setPendingRejectCascade(null);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (input === 'n' || input === 'N' || key.escape) {
|
|
370
|
-
setPendingRejectCascade(null);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
if (searchOpen) {
|
|
376
|
-
if (key.escape) {
|
|
377
|
-
setSearchOpen(false);
|
|
378
|
-
setSearchQuery('');
|
|
379
|
-
setAutocompleteCandidates([]);
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
if (key.return) {
|
|
383
|
-
if (!searchQuery || searchMatches.length === 0) {
|
|
384
|
-
setSearchOpen(false);
|
|
385
|
-
setSearchQuery('');
|
|
386
|
-
setAutocompleteCandidates([]);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
const cursorRow = visibleRows[safeCursor];
|
|
390
|
-
const cursorItemName = cursorRow && cursorRow.itemIdx >= 0 ? groupedItems[cursorRow.itemIdx]?.key : undefined;
|
|
391
|
-
let jumped = false;
|
|
392
|
-
for (let i = safeCursor; i < visibleRows.length; i++) {
|
|
393
|
-
const r = visibleRows[i];
|
|
394
|
-
if (r.itemIdx < 0)
|
|
395
|
-
continue;
|
|
396
|
-
const n = groupedItems[r.itemIdx]?.key;
|
|
397
|
-
if (n && n !== cursorItemName && fuzzyMatches(searchQuery, n)) {
|
|
398
|
-
jumpCursorTo(n);
|
|
399
|
-
jumped = true;
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
if (!jumped) {
|
|
404
|
-
for (let i = 0; i < visibleRows.length; i++) {
|
|
405
|
-
const r = visibleRows[i];
|
|
406
|
-
if (r.itemIdx < 0)
|
|
407
|
-
continue;
|
|
408
|
-
const n = groupedItems[r.itemIdx]?.key;
|
|
409
|
-
if (n && fuzzyMatches(searchQuery, n)) {
|
|
410
|
-
jumpCursorTo(n);
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
setSearchOpen(false);
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
if (key.tab) {
|
|
419
|
-
const { completion, candidates } = computeAutocomplete(searchQuery, components.map((c) => c.name));
|
|
420
|
-
setSearchQuery(completion);
|
|
421
|
-
setAutocompleteCandidates(candidates);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
if (key.backspace) {
|
|
425
|
-
setAutocompleteCandidates([]);
|
|
426
|
-
setSearchQuery((q) => q.slice(0, -1));
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
if (input && input.length === 1 && input >= ' ' && input !== '\r' && input !== '\n') {
|
|
430
|
-
setAutocompleteCandidates([]);
|
|
431
|
-
setSearchQuery((q) => q + input);
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (cyclesPanelOpen) {
|
|
437
|
-
if (key.escape || input === 'c') {
|
|
438
|
-
setCyclesPanelOpen(false);
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
if (key.upArrow || input === 'k') {
|
|
442
|
-
setCyclesCursor((c) => Math.max(0, c - 1));
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
if (key.downArrow || input === 'j') {
|
|
446
|
-
setCyclesCursor((c) => Math.min(Math.max(0, cyclesJumpables.length - 1), c + 1));
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
if (key.return) {
|
|
450
|
-
const target = cyclesJumpables[cyclesCursor];
|
|
451
|
-
if (target)
|
|
452
|
-
jumpCursorTo(target.jumpTarget);
|
|
453
|
-
setCyclesPanelOpen(false);
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
if (lineagePanel.isOpen) {
|
|
459
|
-
if (input === 'c' && hasCycles) {
|
|
460
|
-
lineagePanel.close();
|
|
461
|
-
setCyclesPanelOpen(true);
|
|
462
|
-
setCyclesCursor(0);
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
if (lineagePanel.handleInput(input, key))
|
|
466
|
-
return;
|
|
467
|
-
if (key.upArrow || input === 'k') {
|
|
468
|
-
setLineageCursor((c) => Math.max(0, c - 1));
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
if (key.downArrow || input === 'j') {
|
|
472
|
-
setLineageCursor((c) => Math.min(Math.max(0, lineageJumpables.length - 1), c + 1));
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
if (key.return) {
|
|
476
|
-
const target = lineageJumpables[lineageCursor];
|
|
477
|
-
if (target && (target.entry.kind === 'ancestor' || target.entry.kind === 'descendant')) {
|
|
478
|
-
jumpCursorTo(target.entry.jumpTarget);
|
|
479
|
-
}
|
|
480
|
-
lineagePanel.close();
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (aiRationalePanel.isOpen) {
|
|
486
|
-
if (aiRationalePanel.handleInput(input, key))
|
|
487
|
-
return;
|
|
488
|
-
if (key.upArrow || input === 'k') {
|
|
489
|
-
setAiCursor((c) => Math.max(0, c - 1));
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
if (key.downArrow || input === 'j') {
|
|
493
|
-
setAiCursor((c) => Math.min(Math.max(0, aiRows.length - 1), c + 1));
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
if (key.return) {
|
|
497
|
-
const row = aiRows[aiCursor];
|
|
498
|
-
if (row)
|
|
499
|
-
jumpCursorTo(row.jumpTarget);
|
|
500
|
-
aiRationalePanel.close();
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
if (input === 'q' || key.escape) {
|
|
506
|
-
if (aiFilterStatus === 'running' && onCancelAutoFilter) {
|
|
507
|
-
onCancelAutoFilter();
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
if (key.escape && jumpFilterTarget) {
|
|
511
|
-
setJumpFilterTarget(null);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
if (key.escape && searchQuery) {
|
|
515
|
-
setSearchQuery('');
|
|
516
|
-
setAutocompleteCandidates([]);
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
onQuit();
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
if (input === '?') {
|
|
523
|
-
setShowHelp(true);
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
if (input === 'f' || input === 'F') {
|
|
527
|
-
onConfirm(partition());
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
if (input === 'l') {
|
|
531
|
-
if (focusedColumn === 'added-components') {
|
|
532
|
-
const entry = addedComponents[safeAddedComponentsCursor];
|
|
533
|
-
if (entry)
|
|
534
|
-
jumpCursorTo(entry.name);
|
|
535
|
-
}
|
|
536
|
-
else if (focusedColumn === 'added-groups') {
|
|
537
|
-
const g = addedGroups[safeAddedGroupsCursor];
|
|
538
|
-
if (g)
|
|
539
|
-
jumpCursorTo(g.name);
|
|
540
|
-
}
|
|
541
|
-
lineagePanel.open();
|
|
542
|
-
setLineageCursor(0);
|
|
543
|
-
setCyclesPanelOpen(false);
|
|
544
|
-
aiRationalePanel.close();
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
if (input === 'c') {
|
|
548
|
-
if (!hasCycles)
|
|
549
|
-
return;
|
|
550
|
-
setCyclesPanelOpen(true);
|
|
551
|
-
setCyclesCursor(0);
|
|
552
|
-
lineagePanel.close();
|
|
553
|
-
aiRationalePanel.close();
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
if (input === 'x') {
|
|
557
|
-
if (aiRows.length === 0)
|
|
558
|
-
return;
|
|
559
|
-
aiRationalePanel.open();
|
|
560
|
-
setAiCursor(0);
|
|
561
|
-
lineagePanel.close();
|
|
562
|
-
setCyclesPanelOpen(false);
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
if (input === '/') {
|
|
566
|
-
setSearchOpen(true);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
if (input === 'o') {
|
|
570
|
-
if (!hasCycles)
|
|
571
|
-
return;
|
|
572
|
-
setActiveFilters((prev) => {
|
|
573
|
-
const next = new Set(prev);
|
|
574
|
-
if (next.has('cycles'))
|
|
575
|
-
next.delete('cycles');
|
|
576
|
-
else
|
|
577
|
-
next.add('cycles');
|
|
578
|
-
return next;
|
|
579
|
-
});
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
if (input === 'i' && !key.tab && !key.ctrl) {
|
|
583
|
-
const targetKey = focusedColumn === 'main'
|
|
584
|
-
? focusedRowKey()
|
|
585
|
-
: focusedColumn === 'added-components'
|
|
586
|
-
? addedComponents[safeAddedComponentsCursor]?.name
|
|
587
|
-
: addedGroups[safeAddedGroupsCursor]?.name;
|
|
588
|
-
if (!targetKey)
|
|
589
|
-
return;
|
|
590
|
-
setJumpFilterTarget((prev) => (prev === targetKey ? null : targetKey));
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (input === ' ') {
|
|
594
|
-
if (focusedColumn !== 'main')
|
|
595
|
-
return;
|
|
596
|
-
const key = focusedRowKey();
|
|
597
|
-
if (!key)
|
|
598
|
-
return;
|
|
599
|
-
const rootName = resolveGroupRoot(key, closures, cycleParticipants);
|
|
600
|
-
if (!rootName)
|
|
601
|
-
return;
|
|
602
|
-
toggleExpanded(rootName);
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
if (input === 'E' && focusedColumn === 'main') {
|
|
606
|
-
const roots = new Set();
|
|
607
|
-
for (const [name, closure] of closures.entries()) {
|
|
608
|
-
if (closure.nodes.length > 1)
|
|
609
|
-
roots.add(name);
|
|
610
|
-
}
|
|
611
|
-
for (const p of cycleParticipants)
|
|
612
|
-
roots.add(p);
|
|
613
|
-
setExpandedGroups(roots);
|
|
614
|
-
return;
|
|
615
|
-
}
|
|
616
|
-
if (input === 'C' && focusedColumn === 'main') {
|
|
617
|
-
setExpandedGroups(new Set());
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
if (input === 'a' || input === 'r') {
|
|
621
|
-
const isReject = input === 'r';
|
|
622
|
-
if (focusedColumn === 'added-components') {
|
|
623
|
-
if (!isReject)
|
|
624
|
-
return;
|
|
625
|
-
const entry = addedComponents[safeAddedComponentsCursor];
|
|
626
|
-
if (entry)
|
|
627
|
-
requestReject(entry.name);
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
if (focusedColumn === 'added-groups') {
|
|
631
|
-
if (!isReject)
|
|
632
|
-
return;
|
|
633
|
-
const g = addedGroups[safeAddedGroupsCursor];
|
|
634
|
-
if (g)
|
|
635
|
-
requestReject(g.name);
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
const key = focusedRowKey();
|
|
639
|
-
if (!key)
|
|
640
|
-
return;
|
|
641
|
-
if (isReject)
|
|
642
|
-
requestReject(key);
|
|
643
|
-
else
|
|
644
|
-
requestAccept(key);
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
if (input === 'L') {
|
|
648
|
-
const currentKey = currentRowKey;
|
|
649
|
-
const nextView = columnOneView === 'grouped' ? 'flat' : 'grouped';
|
|
650
|
-
const nextRows = buildVisibleRows({
|
|
651
|
-
items: groupedItems,
|
|
652
|
-
cycleParticipants,
|
|
653
|
-
expandedGroups,
|
|
654
|
-
showFlatTier: false,
|
|
655
|
-
viewMode: nextView,
|
|
656
|
-
graph,
|
|
657
|
-
});
|
|
658
|
-
let nextCursor = 0;
|
|
659
|
-
if (currentKey) {
|
|
660
|
-
for (let i = 0; i < nextRows.length; i++) {
|
|
661
|
-
const r = nextRows[i];
|
|
662
|
-
if (r.itemIdx < 0)
|
|
663
|
-
continue;
|
|
664
|
-
if (groupedItems[r.itemIdx]?.key === currentKey) {
|
|
665
|
-
nextCursor = i;
|
|
666
|
-
break;
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
const nextScroll = nextCursor < scrollOffset
|
|
671
|
-
? nextCursor
|
|
672
|
-
: nextCursor >= scrollOffset + visibleCount
|
|
673
|
-
? nextCursor - visibleCount + 1
|
|
674
|
-
: scrollOffset;
|
|
675
|
-
setColumnOneView(nextView);
|
|
676
|
-
setNav({ cursor: nextCursor, scrollOffset: nextScroll });
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
679
|
-
if (input === 'A') {
|
|
680
|
-
const nonCycle = components.filter((c) => !cycleParticipants.has(c.name)).map((c) => c.name);
|
|
681
|
-
const anyNotAccepted = nonCycle.some((n) => getState(n) !== 'accepted');
|
|
682
|
-
const target = anyNotAccepted ? 'accepted' : 'rejected';
|
|
683
|
-
if (target === 'accepted') {
|
|
684
|
-
const cyclesToInclude = collectReachableCycleUnits(nonCycle, graph, cycleUnits);
|
|
685
|
-
const entries = nonCycle.map((n) => [n, 'accepted']);
|
|
686
|
-
for (const n of cyclesToInclude)
|
|
687
|
-
entries.push([n, 'accepted']);
|
|
688
|
-
applyDecisions(entries);
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
const entries = nonCycle.map((n) => [n, 'rejected']);
|
|
692
|
-
for (const c of components) {
|
|
693
|
-
if (cycleParticipants.has(c.name) && getState(c.name) === 'accepted') {
|
|
694
|
-
entries.push([c.name, 'undecided']);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
applyDecisions(entries);
|
|
698
|
-
}
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
if (input === 'Y') {
|
|
702
|
-
const seeds = components.filter((c) => !cycleParticipants.has(c.name) && !isAiFlagged(c)).map((c) => c.name);
|
|
703
|
-
const cyclesToInclude = collectReachableCycleUnits(seeds, graph, cycleUnits);
|
|
704
|
-
const entries = seeds.map((n) => [n, 'accepted']);
|
|
705
|
-
for (const n of cyclesToInclude)
|
|
706
|
-
entries.push([n, 'accepted']);
|
|
707
|
-
applyDecisions(entries);
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
if (key.tab) {
|
|
711
|
-
if (columnPlan.layout !== 'three-column')
|
|
712
|
-
return;
|
|
713
|
-
const forward = ['main', 'added-components', 'added-groups'];
|
|
714
|
-
const curIdx = forward.indexOf(focusedColumn);
|
|
715
|
-
const delta = key.shiftTab ? -1 : 1;
|
|
716
|
-
setFocusedColumn(forward[(curIdx + delta + forward.length) % forward.length]);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
if (key.return) {
|
|
720
|
-
if (focusedColumn === 'added-components') {
|
|
721
|
-
const entry = addedComponents[safeAddedComponentsCursor];
|
|
722
|
-
if (entry)
|
|
723
|
-
jumpCursorTo(entry.name);
|
|
724
|
-
setFocusedColumn('main');
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
if (focusedColumn === 'added-groups') {
|
|
728
|
-
const g = addedGroups[safeAddedGroupsCursor];
|
|
729
|
-
if (g)
|
|
730
|
-
jumpCursorTo(g.name);
|
|
731
|
-
setFocusedColumn('main');
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
if (key.upArrow || input === 'k') {
|
|
737
|
-
if (focusedColumn === 'added-components') {
|
|
738
|
-
if (addedComponents.length === 0)
|
|
739
|
-
return;
|
|
740
|
-
setAddedComponentsCursor((c) => Math.max(0, c - 1));
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
if (focusedColumn === 'added-groups') {
|
|
744
|
-
if (addedGroups.length === 0)
|
|
745
|
-
return;
|
|
746
|
-
setAddedGroupsCursor((c) => Math.max(0, c - 1));
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
if (total === 0)
|
|
750
|
-
return;
|
|
751
|
-
setNav(({ cursor: c, scrollOffset: prev }) => {
|
|
752
|
-
const next = c <= 0 ? 0 : c - 1;
|
|
753
|
-
return { cursor: next, scrollOffset: Math.min(prev, next) };
|
|
754
|
-
});
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
if (key.downArrow || input === 'j') {
|
|
758
|
-
if (focusedColumn === 'added-components') {
|
|
759
|
-
if (addedComponents.length === 0)
|
|
760
|
-
return;
|
|
761
|
-
setAddedComponentsCursor((c) => Math.min(addedComponents.length - 1, c + 1));
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
if (focusedColumn === 'added-groups') {
|
|
765
|
-
if (addedGroups.length === 0)
|
|
766
|
-
return;
|
|
767
|
-
setAddedGroupsCursor((c) => Math.min(addedGroups.length - 1, c + 1));
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
if (total === 0)
|
|
771
|
-
return;
|
|
772
|
-
setNav(({ cursor: c, scrollOffset: prev }) => {
|
|
773
|
-
const next = c >= total - 1 ? total - 1 : c + 1;
|
|
774
|
-
const nextScroll = next >= prev + visibleCount ? next - visibleCount + 1 : prev;
|
|
775
|
-
return { cursor: next, scrollOffset: nextScroll };
|
|
776
|
-
});
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
const includedCount = useMemo(() => components.filter((c) => isIncluded(c.name)).length, [components, userDecisions]);
|
|
781
|
-
const hasAnyAi = components.some(isAiFlagged);
|
|
782
|
-
const aiExcludedCount = components.filter(isAiFlagged).length;
|
|
783
|
-
const aiExcludedWithReasons = components.filter((c) => isAiFlagged(c) && c.aiReason !== null && c.aiReason !== undefined && c.aiReason !== '');
|
|
784
|
-
const aiRows = useMemo(() => aiExcludedWithReasons.map((c) => ({
|
|
785
|
-
label: `${c.name} — ${c.aiReason}`,
|
|
786
|
-
jumpTarget: c.name,
|
|
787
|
-
})), [aiExcludedWithReasons]);
|
|
788
|
-
const selectedItemIdx = currentRow && currentRow.itemIdx >= 0 ? currentRow.itemIdx : -1;
|
|
789
|
-
const nothingIncluded = components.length > 0 && components.every((c) => !isIncluded(c.name));
|
|
790
|
-
const totalComponents = components.length;
|
|
791
|
-
const totalMatches = searchQuery ? searchMatches.length : 0;
|
|
792
|
-
const addedComponents = useMemo(() => buildAddedComponentsList(components, selectionStateByKey, cycleParticipants), [components, selectionStateByKey, cycleParticipants]);
|
|
793
|
-
const addedGroups = useMemo(() => buildAddedGroupsList(closures, selectionStateByKey, cycleParticipants, cycleUnits), [closures, selectionStateByKey, cycleParticipants, cycleUnits]);
|
|
794
|
-
const counters = useMemo(() => computeCounters(components, closures, selectionStateByKey), [components, closures, selectionStateByKey]);
|
|
795
|
-
const safeAddedComponentsCursor = Math.min(addedComponentsCursor, Math.max(0, addedComponents.length - 1));
|
|
796
|
-
const safeAddedGroupsCursor = Math.min(addedGroupsCursor, Math.max(0, addedGroups.length - 1));
|
|
797
|
-
if (showHelp) {
|
|
798
|
-
return _jsx(HelpOverlay, { sections: HELP_SECTIONS, onClose: () => setShowHelp(false) });
|
|
799
|
-
}
|
|
800
|
-
return (_jsxs(Box, { flexDirection: "column", paddingX: 2, children: [_jsx(Text, { color: PALETTE.success, children: "\u2713 Extraction complete" }), _jsxs(Text, { dimColor: true, children: ["Found ", totalComponents, " component", totalComponents === 1 ? '' : 's', ". Pick which ones to import. Generation runs only on the included set."] }), _jsx(AutoFilterBanner, { status: aiFilterStatus, progress: aiFilterProgress, error: aiFilterError }), hasAnyAi && (_jsx(Box, { children: _jsxs(Text, { dimColor: true, children: [`Review flags (${aiExcludedCount})`, aiRows.length > 0 && _jsx(Text, { color: PALETTE.info, children: ' — [x] review & jump' })] }) })), _jsx(CounterStrip, { counters: counters, totalWidth: totalWidth }), hasCycles && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "If you must have components with cycles, select them together into the generate step and then use the editor to fix them." }) })), nothingIncluded && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: PALETTE.warning, children: ["nothing selected \u2014 press ", _jsx(Text, { color: PALETTE.info, children: "[Y]" }), " to accept all non-flagged,", ' ', _jsx(Text, { color: PALETTE.info, children: "[A]" }), " to toggle all, or ", _jsx(Text, { color: PALETTE.info, children: "[a]" }), " to accept the highlighted row"] }) })), _jsxs(Box, { flexDirection: "row", children: [aiRationalePanel.isOpen ? (_jsx(GotoBanner, { title: `Review flags (${aiExcludedCount})`, rows: aiRows, cursor: aiCursor, maxRows: panelMaxRows, width: sidebarWidth, footerHint: "[\u2191/\u2193] move \u00B7 [Enter] jump \u00B7 [x/Esc] close" })) : lineagePanel.isOpen && focusedComponent ? (_jsx(LineagePanel, { focusedComponentKey: focusedComponent.name, entries: lineageEntries, cursor: lineageCursor, jumpables: lineageJumpables, maxRows: panelMaxRows, width: sidebarWidth })) : (_jsx(GroupedSidebar, { items: groupedItems, cycleParticipants: cycleParticipants, selectedIdx: selectedItemIdx, selectedRowIdx: safeCursor, onSelect: () => { }, expandedGroups: expandedGroups, onToggleExpanded: toggleExpanded, width: sidebarWidth, focused: focusedColumn === 'main', scrollOffset: scrollOffset, visibleCount: visibleCount, showFlatTier: false, selectionStateByKey: selectionStateByKey, aiFlaggedByKey: aiFlaggedByKey, dimPredicate: dimPredicate, visibleRows: visibleRows, viewMode: columnOneView, graph: graph })), columnPlan.layout === 'three-column' && (_jsxs(_Fragment, { children: [_jsx(Box, { width: 2, flexShrink: 0 }), _jsx(AddedComponentsColumn, { width: columnPlan.added, entries: addedComponents, cursor: safeAddedComponentsCursor, focused: focusedColumn === 'added-components', aiFlaggedByKey: aiFlaggedByKey, visibleCount: visibleCount }), _jsx(Box, { width: 2, flexShrink: 0 }), _jsx(AddedGroupsColumn, { width: columnPlan.groups, entries: addedGroups, cursor: safeAddedGroupsCursor, focused: focusedColumn === 'added-groups', aiFlaggedByKey: aiFlaggedByKey, visibleCount: visibleCount })] }))] }), focusedComponent && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.info, children: focusedComponent.name }), _jsx(Text, { dimColor: true, children: ' — ' }), isIncluded(focusedComponent.name) ? (_jsx(Text, { color: PALETTE.success, children: "included" })) : (_jsx(Text, { color: PALETTE.error, children: "excluded" })), isAiFlagged(focusedComponent) && (_jsx(Text, { color: PALETTE.warning, bold: true, children: ' [×]' }))] }), isAiFlagged(focusedComponent) &&
|
|
801
|
-
focusedComponent.aiReason !== null &&
|
|
802
|
-
focusedComponent.aiReason !== undefined &&
|
|
803
|
-
focusedComponent.aiReason !== '' && (_jsx(Box, { width: totalWidth, height: FOCUSED_REASON_MAX_LINES, flexShrink: 0, children: _jsx(Text, { dimColor: true, wrap: "wrap", children: capReasonForFocusedRow(focusedComponent.aiReason, totalWidth) }) }))] })), cyclesPanelOpen && (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: PALETTE.warning, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, color: PALETTE.warning, children: `Cycles detected (${slotCycles.length}):` }), _jsx(Text, { children: " " }), slotCycles.map((cycle, i) => {
|
|
804
|
-
const isCursor = i === cyclesCursor;
|
|
805
|
-
const parts = [];
|
|
806
|
-
for (let idx = 0; idx < cycle.edges.length; idx++) {
|
|
807
|
-
parts.push(cycle.path[idx]);
|
|
808
|
-
parts.push(`[${cycle.edges[idx].slotName}]`);
|
|
809
|
-
}
|
|
810
|
-
parts.push(cycle.path[cycle.path.length - 1]);
|
|
811
|
-
const label = `Cycle ${i + 1}: ${parts.join(' → ')}`;
|
|
812
|
-
return (_jsxs(Text, { children: [isCursor ? (_jsx(Text, { color: PALETTE.info, bold: true, children: '▶' })) : (_jsx(Text, { children: " " })), _jsx(Text, { color: PALETTE.warning, inverse: isCursor, children: ' ' + label })] }, i));
|
|
813
|
-
}), _jsx(Text, { dimColor: true, children: "[\u2191/\u2193] move \u00B7 [Enter] jump \u00B7 [c/Esc] close" })] })), pendingRejectCascade && (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: PALETTE.warning, paddingX: 1, marginTop: 1, children: [_jsx(Text, { bold: true, color: PALETTE.warning, children: `Rejecting ${pendingRejectCascade.target} will:` }), pendingRejectCascade.ancestors.length > 0 && (_jsx(Text, { children: `- Reject ancestors: ${pendingRejectCascade.ancestors.join(', ')}` })), pendingRejectCascade.descendants.length > 0 && (_jsx(Text, { children: `- Deselect descendants: ${pendingRejectCascade.descendants.join(', ')}` })), _jsx(Text, { dimColor: true, children: "[y] confirm \u00B7 [n]/[Esc] cancel" })] })), searchOpen && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Text, { children: [`/${searchQuery}`, _jsx(Text, { color: PALETTE.info, children: '▎' }), searchQuery && _jsx(Text, { dimColor: true, children: ` (${totalMatches}/${totalComponents} matches)` })] }), autocompleteCandidates.length > 1 && (_jsx(Text, { dimColor: true, children: ` possibilities: ${autocompleteCandidates.join(' · ').slice(0, 120)}` }))] })), !searchOpen && searchQuery && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: `/${searchQuery} (${totalMatches}/${totalComponents} matches) · [Esc] clear` }) })), _jsxs(Box, { columnGap: 2, marginTop: 1, flexWrap: "wrap", children: [includedCount > 0 ? (_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.success, children: includedCount }), _jsxs(Text, { dimColor: true, children: ["/", totalComponents, " included"] })] })) : (_jsx(Text, { color: PALETTE.warning, children: "none included" })), legendEntry('[j/k]', 'move'), legendEntry('[a]', 'accept'), legendEntry('[r]', 'reject'), hasGroupRoots && legendEntry('[space]', 'expand/collapse group'), hasGroupRoots && legendEntry('[E/C]', 'expand/collapse all'), legendEntry('[A]', 'toggle all'), legendEntry('[Y]', 'accept non-flagged'), legendEntry('[L]', 'flat', columnOneView === 'flat'), legendEntry('[l]', 'lineage', lineagePanel.isOpen), legendEntry('[i]', 'focus lineage', jumpFilterTarget !== null), hasCycles && legendEntry('[o]', 'only cycles', activeFilters.has('cycles')), hasCycles && legendEntry('[c]', 'cycle list', cyclesPanelOpen), legendEntry('[/]', 'search', searchOpen || searchQuery.length > 0), legendEntry('[f]', 'continue'), legendEntry('[?]', 'help'), legendEntry('[q]', 'quit'), columnPlan.layout === 'three-column' && legendEntry('[Tab/Shift-Tab]', 'switch column'), columnPlan.layout === 'three-column' && legendEntry('[Enter]', 'jump to main'), hasAnyAi && legendEntry('[x]', 'review flags', aiRationalePanel.isOpen), hasAnyAi && (_jsxs(Text, { children: [_jsx(Text, { color: PALETTE.warning, bold: true, children: "[\u00D7]" }), ' ', _jsx(Text, { dimColor: true, children: "requires review" })] }))] })] }));
|
|
814
|
-
}
|
|
815
|
-
function ColumnHeader(props) {
|
|
816
|
-
const { title, width, focused } = props;
|
|
817
|
-
const sep = '─'.repeat(Math.max(0, width - 2));
|
|
818
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, color: focused ? PALETTE.inverse : PALETTE.info, inverse: focused, children: title }), _jsx(Text, { dimColor: true, children: sep })] }));
|
|
819
|
-
}
|
|
820
|
-
export function sideColumnLabelStyle(input) {
|
|
821
|
-
const { isCycle, isSelected, focused } = input;
|
|
822
|
-
const isCursor = isSelected && focused;
|
|
823
|
-
if (isCursor) {
|
|
824
|
-
return {
|
|
825
|
-
nameColor: PALETTE.inverse,
|
|
826
|
-
nameBold: true,
|
|
827
|
-
nameInverse: true,
|
|
828
|
-
nameUnderline: false,
|
|
829
|
-
suffixColor: PALETTE.inverse,
|
|
830
|
-
suffixDim: false,
|
|
831
|
-
suffixInverse: true,
|
|
832
|
-
suffixUnderline: false,
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
const underline = isSelected && !focused;
|
|
836
|
-
if (isCycle) {
|
|
837
|
-
return {
|
|
838
|
-
nameColor: PALETTE.warning,
|
|
839
|
-
nameBold: false,
|
|
840
|
-
nameInverse: false,
|
|
841
|
-
nameUnderline: underline,
|
|
842
|
-
suffixColor: PALETTE.warning,
|
|
843
|
-
suffixDim: false,
|
|
844
|
-
suffixInverse: false,
|
|
845
|
-
suffixUnderline: underline,
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
return {
|
|
849
|
-
nameColor: PALETTE.success,
|
|
850
|
-
nameBold: false,
|
|
851
|
-
nameInverse: false,
|
|
852
|
-
nameUnderline: underline,
|
|
853
|
-
suffixColor: PALETTE.info,
|
|
854
|
-
suffixDim: true,
|
|
855
|
-
suffixInverse: false,
|
|
856
|
-
suffixUnderline: underline,
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
export function computeColumnWindow(total, cursor, visibleCount) {
|
|
860
|
-
if (total <= visibleCount)
|
|
861
|
-
return { start: 0, end: total, above: 0, below: 0 };
|
|
862
|
-
let start = Math.max(0, cursor - Math.floor(visibleCount / 2));
|
|
863
|
-
start = Math.min(start, total - visibleCount);
|
|
864
|
-
const end = start + visibleCount;
|
|
865
|
-
return { start, end, above: start, below: total - end };
|
|
866
|
-
}
|
|
867
|
-
function AddedComponentsColumn(props) {
|
|
868
|
-
const { width, entries, cursor, focused, aiFlaggedByKey, visibleCount } = props;
|
|
869
|
-
const reserveAiBadge = entries.some((e) => aiFlaggedByKey?.get(e.name) === true);
|
|
870
|
-
const firstNonCycleIdx = entries.findIndex((e) => !e.isCycle);
|
|
871
|
-
const window = computeColumnWindow(entries.length, cursor, Math.max(1, visibleCount));
|
|
872
|
-
return (_jsxs(Box, { flexDirection: "column", width: width, flexShrink: 0, borderStyle: "single", borderColor: focused ? PALETTE.inverse : undefined, children: [_jsx(ColumnHeader, { title: "Added components", width: width, focused: focused }), entries.length === 0 ? (_jsx(Text, { dimColor: true, children: "(none)" })) : (_jsxs(_Fragment, { children: [window.above > 0 && _jsx(Text, { dimColor: true, children: `↑ ${window.above} more` }), entries.slice(window.start, window.end).map((entry, vi) => {
|
|
873
|
-
const i = window.start + vi;
|
|
874
|
-
const isSelected = i === cursor;
|
|
875
|
-
const isCursor = focused && isSelected;
|
|
876
|
-
const aiFlagged = aiFlaggedByKey?.get(entry.name) === true;
|
|
877
|
-
const showSeparator = firstNonCycleIdx > 0 && i === firstNonCycleIdx;
|
|
878
|
-
const style = sideColumnLabelStyle({
|
|
879
|
-
isCycle: entry.isCycle,
|
|
880
|
-
isSelected,
|
|
881
|
-
focused,
|
|
882
|
-
});
|
|
883
|
-
return (_jsxs(React.Fragment, { children: [showSeparator && _jsx(Text, { dimColor: true, children: '─'.repeat(Math.max(0, width - 2)) }), _jsxs(Box, { children: [isCursor ? (_jsx(Text, { color: PALETTE.info, bold: true, children: '▶' })) : (_jsx(Text, { children: " " })), reserveAiBadge &&
|
|
884
|
-
(aiFlagged ? (_jsx(Text, { color: PALETTE.warning, bold: true, children: ' [×]' })) : (_jsx(Text, { children: ' ' }))), entry.isCycle && (_jsx(Text, { color: isCursor ? PALETTE.inverse : PALETTE.warning, bold: true, inverse: isCursor, underline: style.nameUnderline, children: ' ⚠' })), _jsx(Text, { color: style.nameColor, bold: style.nameBold, inverse: style.nameInverse, underline: style.nameUnderline, wrap: "truncate", children: ' ' + entry.name })] })] }, entry.name));
|
|
885
|
-
}), window.below > 0 && _jsx(Text, { dimColor: true, children: `↓ ${window.below} more` })] }))] }));
|
|
886
|
-
}
|
|
887
|
-
function AddedGroupsColumn(props) {
|
|
888
|
-
const { width, entries, cursor, focused, aiFlaggedByKey, visibleCount } = props;
|
|
889
|
-
const reserveAiBadge = entries.some((g) => aiFlaggedByKey?.get(g.name) === true);
|
|
890
|
-
const firstNonCycleIdx = entries.findIndex((e) => !e.isCycle);
|
|
891
|
-
const window = computeColumnWindow(entries.length, cursor, Math.max(1, visibleCount));
|
|
892
|
-
return (_jsxs(Box, { flexDirection: "column", width: width, flexShrink: 0, borderStyle: "single", borderColor: focused ? PALETTE.inverse : undefined, children: [_jsx(ColumnHeader, { title: "Added groups", width: width, focused: focused }), entries.length === 0 ? (_jsx(Text, { dimColor: true, children: "(none)" })) : (_jsxs(_Fragment, { children: [window.above > 0 && _jsx(Text, { dimColor: true, children: `↑ ${window.above} more` }), entries.slice(window.start, window.end).map((g, vi) => {
|
|
893
|
-
const i = window.start + vi;
|
|
894
|
-
const isSelected = i === cursor;
|
|
895
|
-
const isCursor = focused && isSelected;
|
|
896
|
-
const suffix = ` (${g.depCount} dep${g.depCount === 1 ? '' : 's'})`;
|
|
897
|
-
const aiFlagged = aiFlaggedByKey?.get(g.name) === true;
|
|
898
|
-
const showSeparator = firstNonCycleIdx > 0 && i === firstNonCycleIdx;
|
|
899
|
-
const style = sideColumnLabelStyle({
|
|
900
|
-
isCycle: g.isCycle,
|
|
901
|
-
isSelected,
|
|
902
|
-
focused,
|
|
903
|
-
});
|
|
904
|
-
return (_jsxs(React.Fragment, { children: [showSeparator && _jsx(Text, { dimColor: true, children: '─'.repeat(Math.max(0, width - 2)) }), _jsxs(Box, { children: [isCursor ? (_jsx(Text, { color: PALETTE.info, bold: true, children: '▶' })) : (_jsx(Text, { children: " " })), reserveAiBadge &&
|
|
905
|
-
(aiFlagged ? (_jsx(Text, { color: PALETTE.warning, bold: true, children: ' [×]' })) : (_jsx(Text, { children: ' ' }))), g.isCycle && (_jsx(Text, { color: isCursor ? PALETTE.inverse : PALETTE.warning, bold: true, inverse: isCursor, underline: style.nameUnderline, children: ' ⚠' })), _jsx(Text, { color: style.nameColor, bold: style.nameBold, inverse: style.nameInverse, underline: style.nameUnderline, wrap: "truncate", children: ' ' + g.name }), _jsx(Text, { color: style.suffixColor, dimColor: style.suffixDim, inverse: style.suffixInverse, underline: style.suffixUnderline, bold: style.nameBold, wrap: "truncate", children: suffix })] })] }, g.name));
|
|
906
|
-
}), window.below > 0 && _jsx(Text, { dimColor: true, children: `↓ ${window.below} more` })] }))] }));
|
|
907
|
-
}
|