@cueloop/client 0.1.0-alpha.66 → 0.1.0-alpha.67
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/package.json +6 -5
- package/src/App.autoclose.test.tsx +2 -2
- package/src/App.diff.test.tsx +71 -39
- package/src/App.plan-review.test.tsx +20 -21
- package/src/App.readonly.test.tsx +7 -3
- package/src/App.test.tsx +73 -14
- package/src/App.tsx +375 -129
- package/src/App.walk.test.tsx +14 -15
- package/src/App.workbench.test.tsx +390 -0
- package/src/__snapshots__/view-plan.regression.test.ts.snap +1 -1
- package/src/annotation-palette.ts +61 -0
- package/src/app-screens.tsx +176 -45
- package/src/app-view-model.ts +7 -65
- package/src/components/AnnotationCard.tsx +1 -1
- package/src/components/AnnotationCards.stories.tsx +87 -0
- package/src/components/AnnotationCards.tsx +303 -0
- package/src/components/AppHeader.stories.tsx +50 -0
- package/src/components/AppHeader.tsx +83 -0
- package/src/components/AppShell.stories.tsx +47 -42
- package/src/components/AppShell.tsx +212 -100
- package/src/components/AppShell.zoom.test.tsx +94 -0
- package/src/components/ChangesColumn.tsx +49 -26
- package/src/components/DiffSheet.scroll.test.tsx +38 -55
- package/src/components/DiffSheet.split.test.tsx +140 -0
- package/src/components/DiffSheet.stories.tsx +55 -53
- package/src/components/DiffSheet.syntax.test.tsx +24 -7
- package/src/components/DiffSheet.tsx +607 -276
- package/src/components/DiscussionMarkerRail.stories.tsx +54 -0
- package/src/components/DiscussionMarkerRail.tsx +181 -0
- package/src/components/EditorGrid.stories.tsx +59 -0
- package/src/components/EditorGrid.tabs.test.tsx +105 -0
- package/src/components/EditorGrid.tsx +338 -0
- package/src/components/EditorGrid.zoom.test.tsx +68 -0
- package/src/components/FileContentsView.stories.tsx +16 -0
- package/src/components/FileContentsView.test.tsx +29 -0
- package/src/components/FileContentsView.tsx +78 -0
- package/src/components/InboxList.tsx +159 -30
- package/src/components/PaneGrid.stories.tsx +84 -0
- package/src/components/PaneGrid.tsx +128 -0
- package/src/components/PanelColumn.stories.tsx +25 -0
- package/src/components/PanelColumn.tsx +95 -0
- package/src/components/ProjectTreeView.stories.tsx +25 -0
- package/src/components/ProjectTreeView.test.tsx +32 -0
- package/src/components/ProjectTreeView.tsx +82 -0
- package/src/components/PromptDialog.tsx +8 -1
- package/src/components/RootOverlay.stories.tsx +44 -0
- package/src/components/RootOverlay.tsx +35 -0
- package/src/components/SettingsDialog.tsx +2 -1
- package/src/components/SurfaceScrollbar.stories.tsx +34 -0
- package/src/components/SurfaceScrollbar.test.tsx +111 -0
- package/src/components/SurfaceScrollbar.tsx +93 -0
- package/src/components/ThreadFooter.stories.tsx +2 -2
- package/src/components/ThreadFooter.test.tsx +31 -0
- package/src/components/ThreadFooter.tsx +12 -7
- package/src/components/ThreadView.tsx +62 -1440
- package/src/components/ThreadsSidebar.tsx +14 -1
- package/src/components/Tooltip.stories.tsx +26 -0
- package/src/components/Tooltip.tsx +72 -0
- package/src/components/WelcomeSurface.stories.tsx +12 -0
- package/src/components/WelcomeSurface.tsx +52 -0
- package/src/components/__snapshots__/stories.test.tsx.snap +509 -559
- package/src/components/diff-sheet-layout.test.ts +125 -55
- package/src/components/diff-sheet-layout.ts +3 -103
- package/src/components/editor-grid.test.ts +86 -0
- package/src/components/editor-grid.ts +138 -0
- package/src/components/fade-title.test.ts +49 -0
- package/src/components/fade-title.ts +61 -0
- package/src/components/file-tree.test.ts +15 -0
- package/src/components/file-tree.ts +59 -4
- package/src/components/pages/Workspace.stories.tsx +2 -2
- package/src/components/primitives/IconButton.tsx +21 -2
- package/src/components/primitives/Tree.tsx +13 -4
- package/src/components/primitives/icons.ts +27 -4
- package/src/components/session-tree.test.ts +20 -0
- package/src/components/session-tree.ts +16 -2
- package/src/components/stories-app.tsx +2 -2
- package/src/config.test.ts +20 -49
- package/src/config.ts +26 -28
- package/src/diff-fold.test.ts +78 -0
- package/src/diff-fold.ts +126 -0
- package/src/diff-syntax.test.ts +16 -0
- package/src/diff-syntax.ts +6 -3
- package/src/discussions.ts +79 -0
- package/src/intent-dispatch.test.ts +31 -11
- package/src/intent-dispatch.ts +93 -48
- package/src/key-bindings.test.ts +1 -1
- package/src/keymap.test.ts +3 -25
- package/src/keymap.ts +17 -18
- package/src/mark-runs.ts +120 -0
- package/src/pty.ts +10 -2
- package/src/run.ts +17 -7
- package/src/serve.test.ts +4 -8
- package/src/session-controller.curate.test.ts +75 -0
- package/src/session-controller.share.test.ts +1 -0
- package/src/session-controller.tree.test.ts +26 -0
- package/src/session-controller.ts +153 -29
- package/src/slash-palette.ts +83 -0
- package/src/split-diff.test.ts +110 -0
- package/src/split-diff.ts +149 -0
- package/src/test-support.test.ts +3 -3
- package/src/test-support.ts +39 -8
- package/src/thread-chords.test.ts +25 -9
- package/src/thread-chords.ts +33 -8
- package/src/use-annotation-surface.tsx +837 -0
- package/src/use-changes-workbench.ts +151 -0
- package/src/use-frame-measure.ts +38 -0
- package/src/use-settings-dialog.tsx +14 -24
- package/src/use-terminal-virtualizer.ts +233 -0
- package/src/view-diff.ts +114 -0
- package/src/components/ReviewPanel.stories.tsx +0 -100
- package/src/components/ReviewPanel.tsx +0 -103
- package/src/components/ReviewRail.stories.tsx +0 -232
- package/src/components/ReviewRail.tsx +0 -327
- package/src/review-panel.test.ts +0 -113
- package/src/review-panel.ts +0 -83
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual regression for the side-by-side split: the divider must be one unbroken
|
|
3
|
+
* column with no holes on wrapped continuation lines, and the two columns must not
|
|
4
|
+
* merge into each other. Rendered in a virtual terminal and asserted on the char frame.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { describe, expect, test } from "bun:test";
|
|
8
|
+
import { testRender } from "@opentui/react/test-utils";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { DiffSheet } from "./DiffSheet";
|
|
11
|
+
import { diffRows } from "../view-diff";
|
|
12
|
+
import { allowEventLoopUpdates } from "../test-support";
|
|
13
|
+
import { fixtureDiffSession } from "./story-fixtures";
|
|
14
|
+
import { annotationPaletteFor } from "../annotation-palette";
|
|
15
|
+
import { DARK } from "../theme";
|
|
16
|
+
|
|
17
|
+
const noop = (): void => {};
|
|
18
|
+
|
|
19
|
+
function hex(color: { toInts(): [number, number, number, number] }): string {
|
|
20
|
+
const [red, green, blue] = color.toInts();
|
|
21
|
+
|
|
22
|
+
return "#" + [red, green, blue].map((part) => part.toString(16).padStart(2, "0")).join("");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// spaced words so each side word-wraps several visual lines, plus an unbalanced block (filler);
|
|
26
|
+
// spaced (not one long token) so a whole word lands on a continuation line for the assertions
|
|
27
|
+
const WRAPPING_PATCH = `diff --git a/app.ts b/app.ts
|
|
28
|
+
--- a/app.ts
|
|
29
|
+
+++ b/app.ts
|
|
30
|
+
@@ -1,4 +1,5 @@
|
|
31
|
+
const alpha = the quick brown fox jumps over the lazy dog and then keeps running past the far edge
|
|
32
|
+
-const beta = old value that used to sit on this single line before the review had changed it wholly
|
|
33
|
+
+const beta = new value that now sits upon this single line after the review has changed it entirely
|
|
34
|
+
+const gamma = an added line with no deletion partner so the whole left column stays blank filler now
|
|
35
|
+
export { alpha, beta };
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
async function splitFrameLines(width: number): Promise<string[]> {
|
|
39
|
+
const setup = await testRender(
|
|
40
|
+
<DiffSheet
|
|
41
|
+
rows={diffRows(WRAPPING_PATCH)}
|
|
42
|
+
session={fixtureDiffSession()}
|
|
43
|
+
marks={new Map()}
|
|
44
|
+
quickActions={[]}
|
|
45
|
+
observer={false}
|
|
46
|
+
onAnnotate={noop}
|
|
47
|
+
onReply={noop}
|
|
48
|
+
onUpdateAnnotation={noop}
|
|
49
|
+
onExit={noop}
|
|
50
|
+
split
|
|
51
|
+
/>,
|
|
52
|
+
{ width, height: 18 },
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
allowEventLoopUpdates();
|
|
56
|
+
await setup.waitForVisualIdle();
|
|
57
|
+
const frame = setup.captureCharFrame();
|
|
58
|
+
|
|
59
|
+
setup.renderer.destroy();
|
|
60
|
+
|
|
61
|
+
return frame.split("\n");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe("split diff rendering", () => {
|
|
65
|
+
test("the caret marks only the change side, not both columns", async () => {
|
|
66
|
+
// Arrange - the caret opens on a context row, which is shown in both columns
|
|
67
|
+
const setup = await testRender(
|
|
68
|
+
<DiffSheet
|
|
69
|
+
rows={diffRows(WRAPPING_PATCH)}
|
|
70
|
+
session={fixtureDiffSession()}
|
|
71
|
+
marks={new Map()}
|
|
72
|
+
quickActions={[]}
|
|
73
|
+
observer={false}
|
|
74
|
+
onAnnotate={noop}
|
|
75
|
+
onReply={noop}
|
|
76
|
+
onUpdateAnnotation={noop}
|
|
77
|
+
onExit={noop}
|
|
78
|
+
split
|
|
79
|
+
/>,
|
|
80
|
+
{ width: 100, height: 18 },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
allowEventLoopUpdates();
|
|
84
|
+
await setup.waitForVisualIdle();
|
|
85
|
+
const caretCell = annotationPaletteFor(DARK).caretCell;
|
|
86
|
+
let cells = 0;
|
|
87
|
+
|
|
88
|
+
for (const line of setup.captureSpans().lines) {
|
|
89
|
+
for (const span of line.spans) {
|
|
90
|
+
if (span.bg && hex(span.bg) === caretCell) cells += span.text.length;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Assert - one caret cell (the change side), not one per column
|
|
95
|
+
expect(cells).toBe(1);
|
|
96
|
+
setup.renderer.destroy();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("the divider is one unbroken column across wrapped lines", async () => {
|
|
100
|
+
// Act
|
|
101
|
+
const lines = await splitFrameLines(80);
|
|
102
|
+
const dividerLines = lines.filter((line) => line.includes("│"));
|
|
103
|
+
const dividerColumns = new Set(dividerLines.map((line) => line.indexOf("│")));
|
|
104
|
+
|
|
105
|
+
// Assert - every divider sits in the same column (the columns never drift or merge)
|
|
106
|
+
expect(dividerColumns.size).toBe(1);
|
|
107
|
+
// and the code region is contiguous: no code row is missing its divider
|
|
108
|
+
const firstDivider = lines.findIndex((line) => line.includes("│"));
|
|
109
|
+
const lastDivider = lines.map((line) => line.includes("│")).lastIndexOf(true);
|
|
110
|
+
|
|
111
|
+
for (let index = firstDivider; index <= lastDivider; index++) {
|
|
112
|
+
expect(lines[index]).toContain("│");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("wrapped continuation lines carry the divider, not just the first line", async () => {
|
|
117
|
+
// Act - the alpha line wraps, so a late word sits on a continuation line (no gutter number)
|
|
118
|
+
const lines = await splitFrameLines(80);
|
|
119
|
+
const continuation = lines.find(
|
|
120
|
+
(line) => line.includes("running") && !line.includes("const alpha"),
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Assert - the continuation still shows the divider
|
|
124
|
+
expect(continuation).toBeDefined();
|
|
125
|
+
expect(continuation).toContain("│");
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("an addition with no deletion partner keeps the divider over blank left filler", async () => {
|
|
129
|
+
// Act - the gamma line has no left partner, so its left column is blank filler
|
|
130
|
+
const lines = await splitFrameLines(80);
|
|
131
|
+
const fillerRow = lines.find((line) => line.includes("no deletion partner"));
|
|
132
|
+
|
|
133
|
+
// Assert - the row still has a divider, and the left of it is blank (no merged text)
|
|
134
|
+
expect(fillerRow).toBeDefined();
|
|
135
|
+
const dividerAt = fillerRow!.indexOf("│");
|
|
136
|
+
|
|
137
|
+
expect(dividerAt).toBeGreaterThan(0);
|
|
138
|
+
expect(fillerRow!.slice(0, dividerAt).trim()).toBe("");
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Annotation } from "@cueloop/schema";
|
|
2
3
|
import { DARK } from "../theme";
|
|
4
|
+
import { annotationPaletteFor } from "../annotation-palette";
|
|
5
|
+
import { DEFAULT_QUICK_ACTIONS } from "../config";
|
|
6
|
+
import { marksByRows } from "../view-diff";
|
|
3
7
|
import type { Story, StoryMeta } from "./story";
|
|
4
8
|
import { DiffSheet } from "./DiffSheet";
|
|
5
|
-
import {
|
|
9
|
+
import { fixtureDiffRows, fixtureDiffSession } from "./story-fixtures";
|
|
6
10
|
|
|
7
11
|
export const meta: StoryMeta = { title: "Surfaces/DiffSheet" };
|
|
8
12
|
|
|
13
|
+
const palette = annotationPaletteFor(DARK);
|
|
14
|
+
const noop = (): void => {};
|
|
15
|
+
|
|
16
|
+
/** A comment on the added line, anchored the way the surface anchors a marked word. */
|
|
17
|
+
const LINE_COMMENT: Annotation = {
|
|
18
|
+
id: "a_diff_1",
|
|
19
|
+
kind: "comment",
|
|
20
|
+
anchor: { quote: "new Map()", prefix: " private items = ", suffix: ";" },
|
|
21
|
+
body: "Map needs an eviction story.",
|
|
22
|
+
createdAt: "2026-01-01T00:00:00Z",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function sheet(annotations: Annotation[], split = false): React.ReactNode {
|
|
26
|
+
const rows = fixtureDiffRows();
|
|
27
|
+
const session = fixtureDiffSession({ annotations });
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<DiffSheet
|
|
31
|
+
rows={rows}
|
|
32
|
+
session={session}
|
|
33
|
+
marks={marksByRows(annotations, rows)}
|
|
34
|
+
quickActions={DEFAULT_QUICK_ACTIONS}
|
|
35
|
+
observer={false}
|
|
36
|
+
onAnnotate={noop}
|
|
37
|
+
onReply={noop}
|
|
38
|
+
onUpdateAnnotation={noop}
|
|
39
|
+
onExit={noop}
|
|
40
|
+
split={split}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
9
45
|
export const SignedRows: Story = {
|
|
10
|
-
render: () =>
|
|
46
|
+
render: () => sheet([]),
|
|
11
47
|
expectedColors: [DARK.insertedForeground, DARK.deletedForeground],
|
|
12
48
|
size: { width: 90, height: 16 },
|
|
13
49
|
};
|
|
@@ -15,64 +51,30 @@ export const SignedRows: Story = {
|
|
|
15
51
|
// A modified line keeps the diff color on the changed words and dims the
|
|
16
52
|
// unchanged prefix to the dim token, so the intra-line change stands out.
|
|
17
53
|
export const IntralineWordDiff: Story = {
|
|
18
|
-
render: () =>
|
|
54
|
+
render: () => sheet([]),
|
|
19
55
|
expectedColors: [DARK.insertedForeground, DARK.deletedForeground, DARK.textDim],
|
|
20
56
|
size: { width: 90, height: 16 },
|
|
21
57
|
};
|
|
22
58
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
59
|
+
// The caret opens on the first code line: its cell wears the caret backdrop.
|
|
60
|
+
export const CaretOnFirstLine: Story = {
|
|
61
|
+
render: () => sheet([]),
|
|
62
|
+
expectedColors: [palette.caretCell],
|
|
26
63
|
size: { width: 90, height: 16 },
|
|
27
64
|
};
|
|
28
65
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
compose={{
|
|
36
|
-
kind: "comment",
|
|
37
|
-
rowIndex: 4,
|
|
38
|
-
quote: " private items = new Map();",
|
|
39
|
-
draft: {
|
|
40
|
-
text: "Map needs an eviction story.",
|
|
41
|
-
onInput: () => {},
|
|
42
|
-
onSave: () => {},
|
|
43
|
-
onCancel: () => {},
|
|
44
|
-
},
|
|
45
|
-
}}
|
|
46
|
-
/>
|
|
47
|
-
),
|
|
48
|
-
expectedColors: [DARK.accent],
|
|
49
|
-
size: { width: 90, height: 16 },
|
|
66
|
+
// A saved comment marks its words (backdrop + underline) and hangs its discussion
|
|
67
|
+
// card under the line, exactly as the thread view does for prose.
|
|
68
|
+
export const AnnotatedLine: Story = {
|
|
69
|
+
render: () => sheet([LINE_COMMENT]),
|
|
70
|
+
expectedColors: [palette.markBackdrop, palette.cardEdge],
|
|
71
|
+
size: { width: 90, height: 18 },
|
|
50
72
|
};
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
id: "a_story_diff",
|
|
60
|
-
kind: "comment",
|
|
61
|
-
anchor: {
|
|
62
|
-
// diff anchors quote the row text verbatim, trailing newline included
|
|
63
|
-
quote:
|
|
64
|
-
FIXTURE_PATCH.split("\n")
|
|
65
|
-
.find((line) => line.startsWith("+ "))!
|
|
66
|
-
.slice(1) + "\n",
|
|
67
|
-
prefix: "",
|
|
68
|
-
suffix: "",
|
|
69
|
-
},
|
|
70
|
-
body: "Map needs an eviction story.",
|
|
71
|
-
createdAt: "2026-01-01T00:00:00Z",
|
|
72
|
-
},
|
|
73
|
-
]}
|
|
74
|
-
/>
|
|
75
|
-
),
|
|
76
|
-
expectedColors: [DARK.markCommentBackground],
|
|
77
|
-
size: { width: 90, height: 16 },
|
|
74
|
+
// Side by side: old on the left, new on the right, divided by a thin rule; the
|
|
75
|
+
// comment card spans the full width under its pair.
|
|
76
|
+
export const SplitView: Story = {
|
|
77
|
+
render: () => sheet([LINE_COMMENT], true),
|
|
78
|
+
expectedColors: [DARK.insertedForeground, DARK.deletedForeground, palette.markBackdrop],
|
|
79
|
+
size: { width: 120, height: 18 },
|
|
78
80
|
};
|
|
@@ -3,6 +3,7 @@ import { testRender } from "@opentui/react/test-utils";
|
|
|
3
3
|
import type { RGBA } from "@opentui/core";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { DiffSheet } from "./DiffSheet";
|
|
6
|
+
import { fixtureDiffSession } from "./story-fixtures";
|
|
6
7
|
import { diffRows } from "../view-diff";
|
|
7
8
|
import { DARK } from "../theme";
|
|
8
9
|
import { allowEventLoopUpdates } from "../test-support";
|
|
@@ -28,10 +29,21 @@ afterEach(() => allowEventLoopUpdates());
|
|
|
28
29
|
|
|
29
30
|
test("renders tree-sitter colors, with the changed word in the diff color on top", async () => {
|
|
30
31
|
// Arrange
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const noop = (): void => {};
|
|
33
|
+
const setup = await testRender(
|
|
34
|
+
<DiffSheet
|
|
35
|
+
rows={diffRows(PATCH)}
|
|
36
|
+
session={fixtureDiffSession()}
|
|
37
|
+
marks={new Map()}
|
|
38
|
+
quickActions={[]}
|
|
39
|
+
observer={false}
|
|
40
|
+
onAnnotate={noop}
|
|
41
|
+
onReply={noop}
|
|
42
|
+
onUpdateAnnotation={noop}
|
|
43
|
+
onExit={noop}
|
|
44
|
+
/>,
|
|
45
|
+
{ width: 60, height: 12 },
|
|
46
|
+
);
|
|
35
47
|
|
|
36
48
|
// Act
|
|
37
49
|
// syntax highlighting resolves off the render path; pump until a keyword paints
|
|
@@ -40,10 +52,15 @@ test("renders tree-sitter colors, with the changed word in the diff color on top
|
|
|
40
52
|
for (let attempt = 0; attempt < 60 && !keywordAccent; attempt++) {
|
|
41
53
|
await setup.renderOnce();
|
|
42
54
|
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
55
|
+
// the caret cell splits the keyword's first character into its own span, so read the
|
|
56
|
+
// accent-colored text of a whole line rather than one span
|
|
43
57
|
for (const line of setup.captureSpans().lines) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
const accentText = line.spans
|
|
59
|
+
.filter((span) => hex(span.fg) === DARK.accent)
|
|
60
|
+
.map((span) => span.text)
|
|
61
|
+
.join("");
|
|
62
|
+
|
|
63
|
+
if (accentText.includes("export")) keywordAccent = true;
|
|
47
64
|
}
|
|
48
65
|
}
|
|
49
66
|
|