@cueloop/client 0.1.0-alpha.9 → 0.1.0-alpha.91
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/native/build-pty.sh +51 -0
- package/native/build.sh +82 -0
- package/native/darwin-arm64/libcuelooppty.dylib +0 -0
- package/native/darwin-arm64/libcueloopvt.dylib +0 -0
- package/native/src/pty.zig +193 -0
- package/native/src/shim.zig +114 -0
- package/package.json +42 -34
- package/src/App.appearance.test.tsx +53 -0
- package/src/App.autoclose.test.tsx +77 -51
- package/src/App.diff.test.tsx +259 -45
- package/src/App.export.test.tsx +58 -41
- package/src/App.focus.test.ts +89 -0
- package/src/App.identity.test.tsx +78 -0
- package/src/App.plan-render.test.tsx +209 -0
- package/src/App.plan-review.test.tsx +330 -161
- package/src/App.prototype-markdown.test.tsx +128 -0
- package/src/App.prototype.test.tsx +176 -0
- package/src/App.readonly.test.tsx +129 -67
- package/src/App.regression.test.tsx +94 -0
- package/src/App.rendering.test.tsx +61 -35
- package/src/App.share-dialog.test.tsx +172 -0
- package/src/App.submit-confirm.test.tsx +264 -0
- package/src/App.test.tsx +402 -126
- package/src/App.toast.test.tsx +98 -0
- package/src/App.tsx +1406 -1060
- package/src/App.visual.test.tsx +57 -0
- package/src/App.walk.test.tsx +299 -0
- package/src/App.workbench.test.tsx +787 -0
- package/src/__snapshots__/view-plan.regression.test.ts.snap +100 -0
- package/src/annotation-palette.ts +62 -0
- package/src/ansi-screen.test.ts +28 -0
- package/src/ansi-screen.ts +72 -0
- package/src/app-key-state.ts +61 -0
- package/src/app-screens.tsx +577 -0
- package/src/app-view-model.ts +168 -0
- package/src/attribution.test.ts +31 -0
- package/src/attribution.ts +42 -0
- package/src/client-extension-registry.test.tsx +61 -0
- package/src/client-extension-registry.ts +159 -0
- package/src/clipboard.test.ts +23 -0
- package/src/clipboard.ts +33 -0
- package/src/components/AnnotatableFileView.stories.tsx +42 -0
- package/src/components/AnnotatableFileView.test.tsx +102 -0
- package/src/components/AnnotatableFileView.tsx +134 -0
- package/src/components/AnnotationCards.stories.tsx +86 -0
- package/src/components/AnnotationCards.tsx +341 -0
- package/src/components/AnsiScreen.stories.tsx +12 -0
- package/src/components/AnsiScreen.tsx +28 -0
- package/src/components/AppHeader.stories.tsx +50 -0
- package/src/components/AppHeader.tsx +83 -0
- package/src/components/AppShell.brand.test.tsx +58 -0
- package/src/components/AppShell.extensions.test.tsx +191 -0
- package/src/components/AppShell.stories.tsx +89 -0
- package/src/components/AppShell.tsx +362 -0
- package/src/components/AppShell.zoom.test.tsx +135 -0
- package/src/components/BareWorkbenchFileView.stories.tsx +27 -0
- package/src/components/BareWorkbenchFileView.tsx +64 -0
- package/src/components/Breadcrumb.stories.tsx +19 -0
- package/src/components/Breadcrumb.tsx +45 -0
- package/src/components/ChangesColumn.stories.tsx +44 -0
- package/src/components/ChangesColumn.tsx +199 -0
- package/src/components/ChangesFileTree.test.tsx +61 -0
- package/src/components/CodeBlock.stories.tsx +42 -0
- package/src/components/CodeBlock.tsx +84 -0
- package/src/components/CompletionOverlay.stories.tsx +37 -0
- package/src/components/CompletionOverlay.tsx +77 -0
- package/src/components/ConfirmCard.stories.tsx +37 -0
- package/src/components/ConfirmCard.tsx +150 -0
- package/src/components/ConfirmDialog.stories.tsx +21 -0
- package/src/components/ConfirmDialog.tsx +72 -0
- package/src/components/DiffContentView.scroll.test.tsx +149 -0
- package/src/components/DiffContentView.split.test.tsx +140 -0
- package/src/components/DiffContentView.stories.tsx +80 -0
- package/src/components/DiffContentView.syntax.test.tsx +82 -0
- package/src/components/DiffContentView.tsx +906 -0
- package/src/components/DiscussionMarkerRail.stories.tsx +54 -0
- package/src/components/DiscussionMarkerRail.tsx +186 -0
- package/src/components/EditorGrid.stories.tsx +59 -0
- package/src/components/EditorGrid.tabs.test.tsx +118 -0
- package/src/components/EditorGrid.tsx +426 -0
- package/src/components/EditorGrid.zoom.test.tsx +68 -0
- package/src/components/ExtensionZone.stories.tsx +28 -0
- package/src/components/ExtensionZone.tsx +145 -0
- package/src/components/FileContentsView.stories.tsx +16 -0
- package/src/components/FileContentsView.test.tsx +29 -0
- package/src/components/FileContentsView.tsx +98 -0
- package/src/components/GridTabContent.stories.tsx +59 -0
- package/src/components/GridTabContent.tsx +182 -0
- package/src/components/HandleChipsInput.stories.tsx +24 -0
- package/src/components/HandleChipsInput.test.tsx +35 -0
- package/src/components/HandleChipsInput.tsx +145 -0
- package/src/components/KeybindsDialog.stories.tsx +31 -0
- package/src/components/KeybindsDialog.tsx +103 -0
- package/src/components/MarkdownGridBlock.stories.tsx +33 -0
- package/src/components/MarkdownGridBlock.tsx +72 -0
- package/src/components/MarkdownThreadEditor.stories.tsx +15 -0
- package/src/components/MarkdownThreadEditor.test.tsx +98 -0
- package/src/components/MarkdownThreadEditor.tsx +162 -0
- package/src/components/MenuBar.stories.tsx +28 -0
- package/src/components/MenuBar.tsx +44 -0
- package/src/components/NavModeHint.stories.tsx +40 -0
- package/src/components/NavModeHint.tsx +31 -0
- package/src/components/OverlayScrollbar.stories.tsx +33 -0
- package/src/components/OverlayScrollbar.test.tsx +139 -0
- package/src/components/OverlayScrollbar.tsx +129 -0
- 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 +98 -0
- package/src/components/ProjectTreeView.stories.tsx +25 -0
- package/src/components/ProjectTreeView.test.tsx +75 -0
- package/src/components/ProjectTreeView.tsx +125 -0
- package/src/components/PromptDialog.stories.tsx +36 -0
- package/src/components/PromptDialog.test.tsx +61 -0
- package/src/components/PromptDialog.tsx +99 -0
- package/src/components/PrototypeContentView.stories.tsx +19 -0
- package/src/components/PrototypeContentView.tsx +446 -0
- package/src/components/RootOverlay.stories.tsx +45 -0
- package/src/components/RootOverlay.tsx +48 -0
- package/src/components/ScrollArea.stories.tsx +20 -0
- package/src/components/ScrollArea.tsx +44 -0
- package/src/components/SettingsDialog.stories.tsx +117 -0
- package/src/components/SettingsDialog.tsx +186 -0
- package/src/components/SettingsRows.stories.tsx +18 -0
- package/src/components/SettingsRows.tsx +112 -0
- package/src/components/ShareDialog.stories.tsx +121 -0
- package/src/components/ShareDialog.tsx +552 -0
- package/src/components/ShellHeader.stories.tsx +50 -0
- package/src/components/ShellHeader.tsx +137 -0
- package/src/components/SlashComposer.stories.tsx +37 -0
- package/src/components/SlashComposer.tsx +87 -0
- package/src/components/ThreadFooter.stories.tsx +30 -0
- package/src/components/ThreadFooter.test.tsx +47 -0
- package/src/components/ThreadFooter.tsx +76 -0
- package/src/components/ThreadTree.stories.tsx +46 -0
- package/src/components/ThreadTree.tsx +255 -0
- package/src/components/ThreadView.selection.test.tsx +951 -0
- package/src/components/ThreadView.slash.test.tsx +146 -0
- package/src/components/ThreadView.stories.tsx +26 -0
- package/src/components/ThreadView.tsx +525 -0
- package/src/components/Toast.stories.tsx +19 -0
- package/src/components/Toast.tsx +52 -0
- package/src/components/Tooltip.stories.tsx +26 -0
- package/src/components/Tooltip.tsx +72 -0
- package/src/components/TreePane.stories.tsx +106 -0
- package/src/components/TreePane.tsx +157 -0
- package/src/components/WalkWizard.stories.tsx +100 -0
- package/src/components/WalkWizard.tsx +150 -0
- package/src/components/WelcomePlayground.stories.tsx +12 -0
- package/src/components/WelcomePlayground.test.tsx +49 -0
- package/src/components/WelcomePlayground.tsx +139 -0
- package/src/components/WorkspacePanels.stories.tsx +36 -0
- package/src/components/WorkspacePanels.tsx +116 -0
- package/src/components/__snapshots__/stories.test.tsx.snap +2264 -0
- package/src/components/diff-content-view-layout.test.ts +198 -0
- package/src/components/diff-content-view-layout.ts +84 -0
- package/src/components/editor-grid.test.ts +86 -0
- package/src/components/editor-grid.ts +138 -0
- package/src/components/file-tree.test.ts +60 -0
- package/src/components/file-tree.ts +112 -0
- package/src/components/menu-control.stories.tsx +35 -0
- package/src/components/menu-control.tsx +43 -0
- package/src/components/pages/Workspace.stories.tsx +181 -0
- package/src/components/primitives/Button.stories.tsx +32 -0
- package/src/components/primitives/Button.tsx +59 -0
- package/src/components/primitives/Card.stories.tsx +25 -0
- package/src/components/primitives/Card.tsx +63 -0
- package/src/components/primitives/Dialog.stories.tsx +24 -0
- package/src/components/primitives/Dialog.test.tsx +37 -0
- package/src/components/primitives/Dialog.tsx +71 -0
- package/src/components/primitives/DialogActions.stories.tsx +20 -0
- package/src/components/primitives/DialogActions.tsx +39 -0
- package/src/components/primitives/IconButton.stories.tsx +36 -0
- package/src/components/primitives/IconButton.tsx +62 -0
- package/src/components/primitives/StatusBar.stories.tsx +11 -0
- package/src/components/primitives/StatusBar.tsx +23 -0
- package/src/components/primitives/Switch.stories.tsx +17 -0
- package/src/components/primitives/Switch.tsx +32 -0
- package/src/components/primitives/Tabs.stories.tsx +29 -0
- package/src/components/primitives/Tabs.tsx +102 -0
- package/src/components/primitives/Toolbar.stories.tsx +17 -0
- package/src/components/primitives/Toolbar.tsx +14 -0
- package/src/components/primitives/Tree.stories.tsx +124 -0
- package/src/components/primitives/Tree.tsx +100 -0
- package/src/components/primitives/frame.test.ts +12 -0
- package/src/components/primitives/frame.ts +17 -0
- package/src/components/primitives/icons.ts +61 -0
- package/src/components/primitives/tree-model.test.ts +99 -0
- package/src/components/primitives/tree-model.ts +137 -0
- package/src/components/quick-actions-editor.stories.tsx +58 -0
- package/src/components/quick-actions-editor.test.tsx +117 -0
- package/src/components/quick-actions-editor.tsx +226 -0
- package/src/components/share-dialog-store.ts +58 -0
- package/src/components/stories-app.tsx +193 -0
- package/src/components/stories.test.tsx +74 -0
- package/src/components/story-fixtures.ts +102 -0
- package/src/components/story-tree.test.ts +108 -0
- package/src/components/story.ts +159 -0
- package/src/components/syntax-highlight.ts +133 -0
- package/src/components/terminal-pane.test.tsx +40 -0
- package/src/components/terminal-pane.ts +199 -0
- package/src/components/theme-context.stories.tsx +46 -0
- package/src/components/theme-context.tsx +37 -0
- package/src/components/thread-tree.test.ts +134 -0
- package/src/components/thread-tree.ts +109 -0
- package/src/components/truncate-text.ts +7 -0
- package/src/components/truncate-title.test.ts +31 -0
- package/src/components/truncate-title.ts +15 -0
- package/src/config-identity.test.ts +78 -0
- package/src/config.test.ts +579 -34
- package/src/config.ts +533 -57
- package/src/diff-fold.test.ts +78 -0
- package/src/diff-fold.ts +126 -0
- package/src/diff-hunk-curate.test.ts +315 -0
- package/src/diff-hunk-curate.ts +153 -0
- package/src/diff-intraline.test.ts +238 -0
- package/src/diff-intraline.ts +236 -0
- package/src/diff-syntax.test.ts +112 -0
- package/src/diff-syntax.ts +179 -0
- package/src/discussions.ts +79 -0
- package/src/editor.test.ts +149 -0
- package/src/editor.ts +139 -9
- package/src/ghostty-terminal.test.ts +85 -0
- package/src/ghostty-terminal.ts +199 -0
- package/src/github-identity.test.ts +58 -0
- package/src/github-identity.ts +41 -0
- package/src/herdr.test.ts +9 -34
- package/src/herdr.ts +25 -21
- package/src/index.ts +29 -0
- package/src/integrations.test.ts +41 -0
- package/src/integrations.ts +32 -0
- package/src/intent-dispatch.test.ts +724 -0
- package/src/intent-dispatch.ts +690 -0
- package/src/key-bindings.test.ts +156 -0
- package/src/key-bindings.ts +459 -0
- package/src/keymap.test.ts +456 -115
- package/src/keymap.ts +315 -81
- package/src/kitty-image.test.ts +66 -0
- package/src/kitty-image.ts +138 -0
- package/src/launch-layout.test.ts +78 -0
- package/src/launch-layout.ts +62 -0
- package/src/mark-runs.ts +121 -0
- package/src/markdown-editor-syntax-style.ts +50 -0
- package/src/markdown-grid.test.ts +101 -0
- package/src/markdown-grid.ts +203 -0
- package/src/markdown-highlight.test.ts +61 -0
- package/src/markdown-highlight.ts +122 -0
- package/src/pasted-image.test.ts +67 -0
- package/src/pasted-image.ts +60 -0
- package/src/perf/otlp-trace.test.ts +116 -0
- package/src/perf/otlp-trace.ts +130 -0
- package/src/perf/perf-report.ts +17 -0
- package/src/perf/perf-timings.test.ts +18 -0
- package/src/perf/perf-timings.ts +38 -0
- package/src/prototype-browser.test.ts +81 -0
- package/src/prototype-browser.ts +329 -0
- package/src/prototype-pixels.tsx +35 -0
- package/src/pty.test.ts +81 -0
- package/src/pty.ts +245 -0
- package/src/ready-signal.test.ts +85 -0
- package/src/ready-signal.ts +52 -0
- package/src/run.ts +85 -12
- package/src/serve.test.ts +24 -12
- package/src/serve.ts +52 -10
- package/src/share.ts +237 -0
- package/src/skills.test.ts +74 -0
- package/src/skills.ts +75 -0
- package/src/slash-palette.test.ts +103 -0
- package/src/slash-palette.ts +129 -0
- package/src/split-diff.test.ts +110 -0
- package/src/split-diff.ts +149 -0
- package/src/test-support.test.ts +264 -0
- package/src/test-support.ts +369 -0
- package/src/theme-presets.test.ts +51 -0
- package/src/theme-presets.ts +219 -0
- package/src/theme.ts +88 -19
- package/src/thread-chords.test.ts +79 -0
- package/src/thread-chords.ts +163 -0
- package/src/thread-code-syntax.ts +45 -0
- package/src/thread-controller.curate.test.ts +476 -0
- package/src/thread-controller.derivation.test.ts +62 -0
- package/src/thread-controller.live-diff.test.ts +322 -0
- package/src/thread-controller.optimistic.test.ts +69 -0
- package/src/thread-controller.share.test.ts +561 -0
- package/src/thread-controller.switch-cache.test.ts +176 -0
- package/src/thread-controller.tree.test.ts +261 -0
- package/src/thread-controller.ts +2050 -0
- package/src/thread-selection.test.ts +210 -0
- package/src/thread-selection.ts +243 -0
- package/src/tree-view.test.ts +128 -0
- package/src/tree-view.ts +153 -0
- package/src/use-annotation-surface.tsx +975 -0
- package/src/use-changes-workbench.ts +190 -0
- package/src/use-frame-measure.ts +41 -0
- package/src/use-remember-layout.ts +31 -0
- package/src/use-repo-changes.ts +87 -0
- package/src/use-settings-dialog.tsx +364 -0
- package/src/use-terminal-virtualizer.ts +259 -0
- package/src/use-thread-body-editing.tsx +58 -0
- package/src/version.ts +5 -0
- package/src/view-diff.test.ts +279 -9
- package/src/view-diff.ts +460 -24
- package/src/view-plan.regression.test.ts +60 -0
- package/src/view-plan.test.ts +545 -0
- package/src/view-plan.ts +1019 -0
- package/src/visual/contrast.test.ts +35 -0
- package/src/visual/contrast.ts +33 -0
- package/src/walk.test.ts +121 -0
- package/src/walk.ts +74 -0
- package/src/workbench-snapshot.test.ts +99 -0
- package/src/workbench-snapshot.ts +59 -0
- package/src/session-controller.ts +0 -398
- package/src/syntax.test.ts +0 -41
- package/src/syntax.ts +0 -88
- package/src/view.test.ts +0 -157
- package/src/view.ts +0 -364
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
/** The four-pane workbench in the virtual terminal, mirroring the browser prototype's interactions:
|
|
2
|
+
* a diff session lays out Threads | Thread | Changes editor | Project sidebar; the diff (±) and tree
|
|
3
|
+
* toggles are mutually exclusive and switching to tree keeps the Changes editor open; a project-tree
|
|
4
|
+
* file opens as a read-only contents tab; the split control offers four directions and the arrow keys
|
|
5
|
+
* split; dismissing the Changes tab collapses the Changes pane but keeps the Project sidebar;
|
|
6
|
+
* the right-sidebar toggle collapses the region to a thin rail and reopens it; zoom hides the Thread pane
|
|
7
|
+
* while the sidebars stay. */
|
|
8
|
+
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
10
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { testRender } from "@opentui/react/test-utils";
|
|
15
|
+
import { DaemonServer } from "@cueloop/daemon";
|
|
16
|
+
import type { Thread } from "@cueloop/schema";
|
|
17
|
+
import { App } from "./App";
|
|
18
|
+
import { loadConfig } from "./config";
|
|
19
|
+
import { pairLayout, planLayout, reviewLayout } from "./launch-layout";
|
|
20
|
+
import {
|
|
21
|
+
dragText,
|
|
22
|
+
isolateUserConfig,
|
|
23
|
+
locateText,
|
|
24
|
+
press,
|
|
25
|
+
pressKey,
|
|
26
|
+
typeText,
|
|
27
|
+
waitForState,
|
|
28
|
+
waitForText,
|
|
29
|
+
waitForTextGone,
|
|
30
|
+
renderReadyApp,
|
|
31
|
+
} from "./test-support";
|
|
32
|
+
import { NERD } from "./components/primitives/icons";
|
|
33
|
+
|
|
34
|
+
const PATCH = `diff --git a/src/store.ts b/src/store.ts
|
|
35
|
+
index 111..222 100644
|
|
36
|
+
--- a/src/store.ts
|
|
37
|
+
+++ b/src/store.ts
|
|
38
|
+
@@ -1,3 +1,3 @@
|
|
39
|
+
export class Store {
|
|
40
|
+
- private items = [];
|
|
41
|
+
+ private items = new Map();
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
let home: string;
|
|
46
|
+
let repo: string;
|
|
47
|
+
let restoreUserConfig: () => void;
|
|
48
|
+
let server: DaemonServer;
|
|
49
|
+
let session: Thread;
|
|
50
|
+
|
|
51
|
+
/** A throwaway git repo so the Project tree (git ls-files) and file contents resolve without a real checkout. */
|
|
52
|
+
function makeRepo(): string {
|
|
53
|
+
const root = mkdtempSync(join(tmpdir(), "cueloop-workbench-repo-"));
|
|
54
|
+
|
|
55
|
+
mkdirSync(join(root, "src"), { recursive: true });
|
|
56
|
+
writeFileSync(join(root, "README.md"), "# Workbench Fixture\n\nA tiny tracked repo.\n");
|
|
57
|
+
writeFileSync(join(root, "src", "store.ts"), "export class Store {}\n");
|
|
58
|
+
writeFileSync(join(root, "src", "util.ts"), "export const noop = () => {};\n");
|
|
59
|
+
const git = (args: string[]) => Bun.spawnSync(["git", "-C", root, ...args]);
|
|
60
|
+
|
|
61
|
+
git(["init", "-q"]);
|
|
62
|
+
git(["config", "user.email", "fixture@example.com"]);
|
|
63
|
+
git(["config", "user.name", "Fixture"]);
|
|
64
|
+
git(["add", "-A"]);
|
|
65
|
+
git(["commit", "-q", "-m", "seed"]);
|
|
66
|
+
|
|
67
|
+
return root;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
beforeEach(() => {
|
|
71
|
+
home = mkdtempSync(join(tmpdir(), "cueloop-workbench-"));
|
|
72
|
+
repo = makeRepo();
|
|
73
|
+
restoreUserConfig = isolateUserConfig(home);
|
|
74
|
+
server = new DaemonServer({ home, idleExitMs: 0 });
|
|
75
|
+
server.start();
|
|
76
|
+
session = server.core.sessionCreate({
|
|
77
|
+
workspace: { repoRoot: repo, branch: "main" },
|
|
78
|
+
artifact: { type: "diff", content: PATCH, meta: { title: "working tree" } },
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
afterEach(() => {
|
|
82
|
+
restoreUserConfig();
|
|
83
|
+
server.stop();
|
|
84
|
+
rmSync(home, { recursive: true, force: true });
|
|
85
|
+
rmSync(repo, { recursive: true, force: true });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
async function renderApp() {
|
|
89
|
+
const setup = await renderReadyApp(<App home={home} sessionId={session.id} />, {
|
|
90
|
+
width: 160,
|
|
91
|
+
height: 20,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
await waitForText(setup, "store.ts");
|
|
95
|
+
|
|
96
|
+
return setup;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type Setup = Awaited<ReturnType<typeof renderApp>>;
|
|
100
|
+
|
|
101
|
+
/** The header controls sit on the top content row of the compact header. */
|
|
102
|
+
const HEADER_ROW = 0;
|
|
103
|
+
const BARE_NAV_HINT = "c comment · z fold · type to leave";
|
|
104
|
+
|
|
105
|
+
/** Column of a Project-header toggle, located by its own glyph so spacing changes never break the click. */
|
|
106
|
+
function toggleColumn(setup: Setup, glyph: string): number {
|
|
107
|
+
return setup.captureCharFrame().split("\n")[HEADER_ROW]!.lastIndexOf(glyph);
|
|
108
|
+
}
|
|
109
|
+
const diffToggleColumn = (setup: Setup): number => toggleColumn(setup, "changes");
|
|
110
|
+
const treeToggleColumn = (setup: Setup): number => toggleColumn(setup, "project");
|
|
111
|
+
const rightToggleColumn = (setup: Setup): number => toggleColumn(setup, NERD.sidebarRight);
|
|
112
|
+
// the collapsed rail shows the outline (off) variant, mirroring the left toggle's filled/outline states
|
|
113
|
+
const railToggleColumn = (setup: Setup): number => toggleColumn(setup, NERD.sidebarRightOff);
|
|
114
|
+
|
|
115
|
+
describe("the four-pane workbench", () => {
|
|
116
|
+
test("pair starts focused on the Project tree beside the zoomed Changes editor", async () => {
|
|
117
|
+
const setup = await renderReadyApp(
|
|
118
|
+
<App home={home} sessionId={session.id} layout={pairLayout()} />,
|
|
119
|
+
{ width: 160, height: 20 },
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
await waitForText(setup, "README.md");
|
|
123
|
+
expect(setup.captureCharFrame()).toContain("Changes");
|
|
124
|
+
await pressKey(setup, "RETURN");
|
|
125
|
+
await waitForText(setup, "Workbench Fixture");
|
|
126
|
+
setup.renderer.destroy();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("a live thread's Changes tree follows edits and a clean working tree", async () => {
|
|
130
|
+
const liveSession = server.core.sessionCreate({
|
|
131
|
+
workspace: { repoRoot: repo, branch: "main" },
|
|
132
|
+
artifact: { type: "diff", content: "", meta: { title: "live changes", workbench: true } },
|
|
133
|
+
});
|
|
134
|
+
writeFileSync(join(repo, "README.md"), "# Edited\n");
|
|
135
|
+
const setup = await renderReadyApp(
|
|
136
|
+
<App home={home} sessionId={liveSession.id} layout={reviewLayout()} />,
|
|
137
|
+
{
|
|
138
|
+
width: 160,
|
|
139
|
+
height: 20,
|
|
140
|
+
},
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
await waitForText(setup, "README.md");
|
|
144
|
+
writeFileSync(join(repo, "README.md"), "# Workbench Fixture\n\nA tiny tracked repo.\n");
|
|
145
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("README.md"));
|
|
146
|
+
writeFileSync(join(repo, "src", "util.ts"), "export const noop = () => 1;\n");
|
|
147
|
+
await waitForText(setup, "util.ts");
|
|
148
|
+
}, 12_000);
|
|
149
|
+
|
|
150
|
+
test("a frozen diff's Changes tree follows a new captured revision", async () => {
|
|
151
|
+
const frozen = server.core.sessionCreate({
|
|
152
|
+
workspace: { repoRoot: repo, branch: "main" },
|
|
153
|
+
artifact: {
|
|
154
|
+
type: "diff",
|
|
155
|
+
content: "diff --git a/README.md b/README.md\n",
|
|
156
|
+
files: [
|
|
157
|
+
{
|
|
158
|
+
path: "README.md",
|
|
159
|
+
status: "modified",
|
|
160
|
+
oldContents: "before\n",
|
|
161
|
+
newContents: "after\n",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
meta: { title: "captured diff" },
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const setup = await renderReadyApp(
|
|
168
|
+
<App home={home} sessionId={frozen.id} layout={reviewLayout()} />,
|
|
169
|
+
{ width: 160, height: 20 },
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
await waitForText(setup, "README.md");
|
|
173
|
+
server.core.sessionSubmitRevision(
|
|
174
|
+
frozen.id,
|
|
175
|
+
"diff --git a/src/util.ts b/src/util.ts\n",
|
|
176
|
+
[],
|
|
177
|
+
[
|
|
178
|
+
{
|
|
179
|
+
path: "src/util.ts",
|
|
180
|
+
status: "modified",
|
|
181
|
+
oldContents: "before\n",
|
|
182
|
+
newContents: "after\n",
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
);
|
|
186
|
+
await waitForState(setup, () => {
|
|
187
|
+
const frame = setup.captureCharFrame();
|
|
188
|
+
|
|
189
|
+
return frame.includes("util.ts") && !frame.includes("README.md");
|
|
190
|
+
});
|
|
191
|
+
setup.renderer.destroy();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test("a diff session lays out the four panes with the diff toggle active", async () => {
|
|
195
|
+
const setup = await renderApp();
|
|
196
|
+
|
|
197
|
+
const frame = setup.captureCharFrame();
|
|
198
|
+
expect(frame).toContain("cueloop");
|
|
199
|
+
expect(frame).toContain("Changes");
|
|
200
|
+
expect(frame).toContain("store.ts");
|
|
201
|
+
// the diff (±) toggle exists in the Project header
|
|
202
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test("switching to the project tree keeps the Changes editor open", async () => {
|
|
206
|
+
const setup = await renderApp();
|
|
207
|
+
|
|
208
|
+
// the diff and tree toggles are mutually exclusive; switch to the full project tree
|
|
209
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
210
|
+
await waitForText(setup, "README.md");
|
|
211
|
+
|
|
212
|
+
const frame = setup.captureCharFrame();
|
|
213
|
+
// the full tree is showing...
|
|
214
|
+
expect(frame).toContain("README.md");
|
|
215
|
+
expect(frame).toContain("src");
|
|
216
|
+
// ...and the Changes editor stayed open through the mode switch
|
|
217
|
+
expect(frame).toContain("Changes");
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
test("opening a project-tree file adds a read-only contents tab", async () => {
|
|
221
|
+
const setup = await renderApp();
|
|
222
|
+
|
|
223
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
224
|
+
await waitForText(setup, "README.md");
|
|
225
|
+
|
|
226
|
+
const readme = locateText(setup, "README.md");
|
|
227
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
228
|
+
await waitForText(setup, "Workbench Fixture");
|
|
229
|
+
|
|
230
|
+
const frame = setup.captureCharFrame();
|
|
231
|
+
// the contents tab carries the file's text with no diff markers
|
|
232
|
+
expect(frame).toContain("A tiny tracked repo.");
|
|
233
|
+
expect(frame.split("\n")[HEADER_ROW]!).toContain("README.md");
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("the split control offers four directions and arrow-right makes two groups", async () => {
|
|
237
|
+
const setup = await renderApp();
|
|
238
|
+
|
|
239
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
240
|
+
await waitForText(setup, "README.md");
|
|
241
|
+
const readme = locateText(setup, "README.md");
|
|
242
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
243
|
+
await waitForText(setup, "Workbench Fixture");
|
|
244
|
+
|
|
245
|
+
// the split control appears only on a file tab
|
|
246
|
+
const split = locateText(setup, "split");
|
|
247
|
+
await setup.mockMouse.click(split.column, split.row);
|
|
248
|
+
await waitForText(setup, "right");
|
|
249
|
+
|
|
250
|
+
const menu = setup.captureCharFrame();
|
|
251
|
+
expect(menu).toContain("left");
|
|
252
|
+
expect(menu).toContain("right");
|
|
253
|
+
expect(menu).toContain("up");
|
|
254
|
+
expect(menu).toContain("down");
|
|
255
|
+
|
|
256
|
+
// the arrow keys drive the popover: right splits the group into two
|
|
257
|
+
await pressKey(setup, "ARROW_RIGHT");
|
|
258
|
+
await waitForState(setup, () => setup.captureCharFrame().split("split").length - 1 >= 2);
|
|
259
|
+
expect((setup.captureCharFrame().match(/README\.md/g) ?? []).length).toBeGreaterThanOrEqual(2);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test("dismissing the Changes tab collapses the Changes pane but keeps the Project sidebar", async () => {
|
|
263
|
+
const setup = await renderApp();
|
|
264
|
+
|
|
265
|
+
const changes = locateText(setup, "Changes");
|
|
266
|
+
// the tab's close box sits just past the label; the ✕ is a hover affordance, the box always clicks
|
|
267
|
+
await setup.mockMouse.click(changes.column + 8, changes.row);
|
|
268
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("store.ts"));
|
|
269
|
+
|
|
270
|
+
const frame = setup.captureCharFrame();
|
|
271
|
+
// the Changes editor is gone...
|
|
272
|
+
expect(frame).not.toContain("store.ts");
|
|
273
|
+
// ...but the Project sidebar and its toggles remain
|
|
274
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test("the right-sidebar toggle closes the region and its header toggle reopens it", async () => {
|
|
278
|
+
const setup = await renderApp();
|
|
279
|
+
|
|
280
|
+
await setup.mockMouse.click(rightToggleColumn(setup), HEADER_ROW);
|
|
281
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("store.ts"));
|
|
282
|
+
|
|
283
|
+
// the right region is closed: no Changes editor, no Project tree toggles, no gutter
|
|
284
|
+
expect(setup.captureCharFrame()).not.toContain("store.ts");
|
|
285
|
+
expect(diffToggleColumn(setup)).toBe(-1);
|
|
286
|
+
|
|
287
|
+
// the reopen toggle (outline/off variant) rides the thread header; clicking it reopens the region
|
|
288
|
+
await setup.mockMouse.click(railToggleColumn(setup), HEADER_ROW);
|
|
289
|
+
await waitForText(setup, "store.ts");
|
|
290
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
test("the Threads toggle opens and closes the sidebar, relocating the brand", async () => {
|
|
294
|
+
const setup = await renderApp();
|
|
295
|
+
|
|
296
|
+
// deep-linked into a session, the Threads sidebar starts collapsed: the brand rides in the
|
|
297
|
+
// Thread header and the inbox groups are hidden
|
|
298
|
+
const collapsed = setup.captureCharFrame();
|
|
299
|
+
expect(collapsed).toContain("cueloop");
|
|
300
|
+
expect(collapsed).not.toContain("Threads");
|
|
301
|
+
|
|
302
|
+
// the sidebar toggle sits just left of the brand (one glyph plus its margin)
|
|
303
|
+
const brand = locateText(setup, "cueloop");
|
|
304
|
+
await setup.mockMouse.click(brand.column - 3, brand.row);
|
|
305
|
+
await waitForText(setup, "Threads");
|
|
306
|
+
|
|
307
|
+
// the Threads pane is open with its inbox groups, and the brand moved into its header
|
|
308
|
+
expect(setup.captureCharFrame()).toContain("Threads");
|
|
309
|
+
|
|
310
|
+
// toggling again collapses it back
|
|
311
|
+
const reopened = locateText(setup, "cueloop");
|
|
312
|
+
await setup.mockMouse.click(reopened.column - 3, reopened.row);
|
|
313
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("Threads"));
|
|
314
|
+
expect(setup.captureCharFrame()).not.toContain("Threads");
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
test("zoom hides the Thread pane while the sidebars stay", async () => {
|
|
318
|
+
const setup = await renderApp();
|
|
319
|
+
|
|
320
|
+
const zoom = locateText(setup, NERD.zoom);
|
|
321
|
+
await setup.mockMouse.click(zoom.column, zoom.row);
|
|
322
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("Select a thread"));
|
|
323
|
+
|
|
324
|
+
const frame = setup.captureCharFrame();
|
|
325
|
+
// the Thread pane's prompt is gone...
|
|
326
|
+
expect(frame).not.toContain("Select a thread");
|
|
327
|
+
// ...while the Changes editor and Project sidebar stay
|
|
328
|
+
expect(frame).toContain("store.ts");
|
|
329
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
test("a create-command session remembers its zoom toggle for the next bare launch", async () => {
|
|
333
|
+
// a create-command opens the review zoomed; toggling zoom off must persist to the remembered layout
|
|
334
|
+
const setup = await renderReadyApp(
|
|
335
|
+
<App home={home} sessionId={session.id} layout={reviewLayout()} />,
|
|
336
|
+
{
|
|
337
|
+
width: 160,
|
|
338
|
+
height: 20,
|
|
339
|
+
},
|
|
340
|
+
);
|
|
341
|
+
await waitForText(setup, "store.ts");
|
|
342
|
+
|
|
343
|
+
const zoom = locateText(setup, NERD.zoom);
|
|
344
|
+
await setup.mockMouse.click(zoom.column, zoom.row);
|
|
345
|
+
await waitForState(
|
|
346
|
+
setup,
|
|
347
|
+
() =>
|
|
348
|
+
loadConfig({ userConfigPath: process.env.CUELOOP_CONFIG }).ui.layout?.zoomChanges === false,
|
|
349
|
+
);
|
|
350
|
+
expect(loadConfig({ userConfigPath: process.env.CUELOOP_CONFIG }).ui.layout?.zoomChanges).toBe(
|
|
351
|
+
false,
|
|
352
|
+
);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
test("selecting a non-diff thread while zoomed exits zoom and restores the Thread pane", async () => {
|
|
356
|
+
// a second, non-diff thread to navigate to; its sync has no Changes editor to fill a zoom
|
|
357
|
+
server.core.sessionCreate({
|
|
358
|
+
workspace: { repoRoot: repo, branch: "main" },
|
|
359
|
+
artifact: {
|
|
360
|
+
type: "plan",
|
|
361
|
+
content: "# Zoomed Plan\n\nReview this plan.\n",
|
|
362
|
+
meta: { title: "Zoomed Plan" },
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
const setup = await renderApp();
|
|
366
|
+
|
|
367
|
+
// open the collapsed Threads sidebar first (its toggle sits three cells left of the brand); the
|
|
368
|
+
// brand rides the Thread header, which zoom then hides, so it must be reached before zooming
|
|
369
|
+
const brand = locateText(setup, "cueloop");
|
|
370
|
+
await setup.mockMouse.click(brand.column - 3, brand.row);
|
|
371
|
+
await waitForText(setup, "Zoomed Plan");
|
|
372
|
+
|
|
373
|
+
// zoom the diff - the Thread pane hides and the footer rides the Changes pane
|
|
374
|
+
const zoom = locateText(setup, NERD.zoom);
|
|
375
|
+
await setup.mockMouse.click(zoom.column, zoom.row);
|
|
376
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("Select a thread"));
|
|
377
|
+
|
|
378
|
+
// switch to the plan thread: it has no Changes editor, so a stranded zoom would blank the middle
|
|
379
|
+
const planRow = locateText(setup, "Zoomed Plan");
|
|
380
|
+
await setup.mockMouse.click(planRow.column, planRow.row);
|
|
381
|
+
await waitForText(setup, "Review this plan.");
|
|
382
|
+
|
|
383
|
+
const frame = setup.captureCharFrame();
|
|
384
|
+
// the Thread pane is back with the plan, and the diff's Changes editor is gone - never a blank middle
|
|
385
|
+
expect(frame).toContain("Review this plan.");
|
|
386
|
+
expect(frame).not.toContain("store.ts");
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
test("toggling the right sidebar while zoomed exits zoom and restores the Thread pane", async () => {
|
|
390
|
+
const setup = await renderApp();
|
|
391
|
+
|
|
392
|
+
// zoom the Changes editor - the Thread pane hides
|
|
393
|
+
const zoom = locateText(setup, NERD.zoom);
|
|
394
|
+
await setup.mockMouse.click(zoom.column, zoom.row);
|
|
395
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("Select a thread"));
|
|
396
|
+
|
|
397
|
+
// toggling the right sidebar off must not strand a blank screen: zoom exits, the Thread pane returns
|
|
398
|
+
await setup.mockMouse.click(rightToggleColumn(setup), HEADER_ROW);
|
|
399
|
+
await waitForText(setup, "Select a thread");
|
|
400
|
+
const frame = setup.captureCharFrame();
|
|
401
|
+
expect(frame).toContain("Select a thread");
|
|
402
|
+
// the right region is collapsed and the Changes editor is gone
|
|
403
|
+
expect(frame).not.toContain("store.ts");
|
|
404
|
+
expect(diffToggleColumn(setup)).toBe(-1);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
test("hovering the right-sidebar icon surfaces its tooltip label at the screen root", async () => {
|
|
408
|
+
const setup = await renderApp();
|
|
409
|
+
|
|
410
|
+
// the tip is not painted until the pointer is over the control
|
|
411
|
+
expect(setup.captureCharFrame()).not.toContain("Toggle Sidebar");
|
|
412
|
+
|
|
413
|
+
await setup.mockMouse.moveTo(rightToggleColumn(setup), HEADER_ROW);
|
|
414
|
+
// the label surfaces at the root, escaping the header cell that would otherwise clip it
|
|
415
|
+
await waitForText(setup, "Toggle Sidebar");
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
/** The bare-launch (no thread) shell is the same four panes as a thread: the Thread pane waits in its
|
|
420
|
+
* empty state and a disposable Welcome tab rides in the Changes editor. The right-region toggles behave
|
|
421
|
+
* like the thread shell, dismissing Welcome collapses the editor without stranding an empty screen, and
|
|
422
|
+
* a closed right region moves its reopen toggle into the header rather than leaving a gutter. */
|
|
423
|
+
describe("the bare-launch welcome shell", () => {
|
|
424
|
+
let welcomeHome: string;
|
|
425
|
+
let welcomeRepo: string;
|
|
426
|
+
let restoreWelcome: () => void;
|
|
427
|
+
let welcomeServer: DaemonServer;
|
|
428
|
+
|
|
429
|
+
beforeEach(() => {
|
|
430
|
+
welcomeHome = mkdtempSync(join(tmpdir(), "cueloop-welcome-"));
|
|
431
|
+
// a small, controlled launch repo so the welcome tree/changes resolve fast and deterministically
|
|
432
|
+
welcomeRepo = makeRepo();
|
|
433
|
+
writeFileSync(join(welcomeRepo, "README.md"), "# Fixture\n\nedited in the working tree\n");
|
|
434
|
+
restoreWelcome = isolateUserConfig(welcomeHome);
|
|
435
|
+
welcomeServer = new DaemonServer({ home: welcomeHome, idleExitMs: 0 });
|
|
436
|
+
welcomeServer.start();
|
|
437
|
+
});
|
|
438
|
+
afterEach(() => {
|
|
439
|
+
restoreWelcome();
|
|
440
|
+
welcomeServer.stop();
|
|
441
|
+
rmSync(welcomeHome, { recursive: true, force: true });
|
|
442
|
+
rmSync(welcomeRepo, { recursive: true, force: true });
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
async function renderWelcome() {
|
|
446
|
+
const setup = await testRender(
|
|
447
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
448
|
+
{ width: 180, height: 14 },
|
|
449
|
+
);
|
|
450
|
+
await waitForText(setup, "cueloop");
|
|
451
|
+
|
|
452
|
+
return setup;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
test("the project tree shows the launch repo's files even with no thread open", async () => {
|
|
456
|
+
const setup = await renderWelcome();
|
|
457
|
+
|
|
458
|
+
// the tree toggle loads the git repo the client launched in
|
|
459
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
460
|
+
await waitForText(setup, "README.md");
|
|
461
|
+
expect(setup.captureCharFrame()).toContain("README.md");
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
test("the first comment in the bare shell creates and persists a per-repo workbench thread", async () => {
|
|
465
|
+
const setup = await renderWelcome();
|
|
466
|
+
|
|
467
|
+
// open a project file in the bare shell (no thread yet - nothing on disk)
|
|
468
|
+
expect(welcomeServer.core.sessionList().length).toBe(0);
|
|
469
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
470
|
+
await waitForText(setup, "README.md");
|
|
471
|
+
const readme = locateText(setup, "README.md");
|
|
472
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
473
|
+
await waitForText(setup, "edited in the working tree");
|
|
474
|
+
|
|
475
|
+
// comment on a line - the first note find-or-creates the workbench thread
|
|
476
|
+
const line = "edited in the working tree";
|
|
477
|
+
await dragText(setup, line, line, line.length);
|
|
478
|
+
await typeText(setup, "workbench note");
|
|
479
|
+
await pressKey(setup, "RETURN", { meta: true });
|
|
480
|
+
|
|
481
|
+
// the daemon persisted one per-repo workbench thread carrying the note
|
|
482
|
+
await waitForState(setup, () =>
|
|
483
|
+
welcomeServer.core.sessionList().some((thread) => thread.artifact.meta.workbench === true),
|
|
484
|
+
);
|
|
485
|
+
const workbench = welcomeServer.core
|
|
486
|
+
.sessionList()
|
|
487
|
+
.find((thread) => thread.artifact.meta.workbench === true)!;
|
|
488
|
+
expect(workbench.workspace.rootCommit).toBeTruthy();
|
|
489
|
+
await waitForState(setup, () =>
|
|
490
|
+
welcomeServer.core
|
|
491
|
+
.sessionGet(workbench.id)
|
|
492
|
+
.annotations.some((note) => note.body.includes("workbench note")),
|
|
493
|
+
);
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
test("the changes tree lists the launch repo's working-tree changes", async () => {
|
|
497
|
+
const setup = await renderWelcome();
|
|
498
|
+
|
|
499
|
+
// changes mode is the default; the edited README shows with its status
|
|
500
|
+
await waitForText(setup, "README.md");
|
|
501
|
+
expect(setup.captureCharFrame()).toContain("README.md");
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
test("the changes tree clears after the launch repo becomes clean", async () => {
|
|
505
|
+
const setup = await renderWelcome();
|
|
506
|
+
|
|
507
|
+
await waitForText(setup, "README.md");
|
|
508
|
+
writeFileSync(join(welcomeRepo, "README.md"), "# Workbench Fixture\n\nA tiny tracked repo.\n");
|
|
509
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("README.md"));
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
test("a review layout opens the Changes panel, listing the working-tree changes", async () => {
|
|
513
|
+
const setup = await testRender(
|
|
514
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} layout={reviewLayout()} />,
|
|
515
|
+
{ width: 180, height: 14 },
|
|
516
|
+
);
|
|
517
|
+
await waitForText(setup, "README.md");
|
|
518
|
+
expect(setup.captureCharFrame()).toContain("README.md");
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
test("a plan layout opens with the right region closed, so no Changes panel shows", async () => {
|
|
522
|
+
const setup = await testRender(
|
|
523
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} layout={planLayout()} />,
|
|
524
|
+
{ width: 180, height: 14 },
|
|
525
|
+
);
|
|
526
|
+
await waitForText(setup, "cueloop");
|
|
527
|
+
// rightSidebar "off": neither the Changes list nor the launch repo's files paint
|
|
528
|
+
expect(setup.captureCharFrame()).not.toContain("README.md");
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
test("a hand-edited off+zoom layout drops the zoom so the center is not stranded blank", async () => {
|
|
532
|
+
// zoom fills the middle with the Changes editor; with the region off there is none, so honoring zoom
|
|
533
|
+
// would hide the Thread pane over a blank center. The Thread placeholder must still render.
|
|
534
|
+
const setup = await testRender(
|
|
535
|
+
<App
|
|
536
|
+
home={welcomeHome}
|
|
537
|
+
sessionId={undefined}
|
|
538
|
+
cwd={welcomeRepo}
|
|
539
|
+
layout={{ threads: true, rightSidebar: "off", zoomChanges: true }}
|
|
540
|
+
/>,
|
|
541
|
+
{ width: 180, height: 14 },
|
|
542
|
+
);
|
|
543
|
+
await waitForText(setup, "Select a thread");
|
|
544
|
+
expect(setup.captureCharFrame()).toContain("Select a thread");
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
test("closing the right region on the vanilla shell remembers it for the next launch", async () => {
|
|
548
|
+
const setup = await testRender(
|
|
549
|
+
<App
|
|
550
|
+
home={welcomeHome}
|
|
551
|
+
sessionId={undefined}
|
|
552
|
+
cwd={welcomeRepo}
|
|
553
|
+
layout={{ threads: true, rightSidebar: "changes", zoomChanges: false }}
|
|
554
|
+
/>,
|
|
555
|
+
{ width: 180, height: 14 },
|
|
556
|
+
);
|
|
557
|
+
await waitForText(setup, "README.md");
|
|
558
|
+
|
|
559
|
+
// close the Changes/Project region; the remembered layout follows it to "off"
|
|
560
|
+
await setup.mockMouse.click(rightToggleColumn(setup), HEADER_ROW);
|
|
561
|
+
await waitForState(
|
|
562
|
+
setup,
|
|
563
|
+
() =>
|
|
564
|
+
loadConfig({ userConfigPath: process.env.CUELOOP_CONFIG }).ui.layout?.rightSidebar ===
|
|
565
|
+
"off",
|
|
566
|
+
);
|
|
567
|
+
expect(loadConfig({ userConfigPath: process.env.CUELOOP_CONFIG }).ui.layout).toEqual({
|
|
568
|
+
threads: true,
|
|
569
|
+
rightSidebar: "off",
|
|
570
|
+
zoomChanges: false,
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
test("clicking a changed file in the bare shell opens its diff, not its contents", async () => {
|
|
575
|
+
const setup = await renderWelcome();
|
|
576
|
+
|
|
577
|
+
await waitForText(setup, "README.md");
|
|
578
|
+
const readme = locateText(setup, "README.md");
|
|
579
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
580
|
+
|
|
581
|
+
// a diff shows both the removed old line and the added new line; contents would show only the new
|
|
582
|
+
await waitForText(setup, "A tiny tracked repo.");
|
|
583
|
+
const frame = setup.captureCharFrame();
|
|
584
|
+
expect(frame).toContain("A tiny tracked repo.");
|
|
585
|
+
expect(frame).toContain("edited in the working tree");
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
test("nav mode on the Welcome tab offers only comment and fold; a diff letter types", async () => {
|
|
589
|
+
const setup = await renderReadyApp(
|
|
590
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
591
|
+
{ width: 160, height: 28 },
|
|
592
|
+
);
|
|
593
|
+
await waitForText(setup, "quick brown fox");
|
|
594
|
+
const line = locateText(setup, "quick brown fox");
|
|
595
|
+
await setup.mockMouse.click(line.column, line.row);
|
|
596
|
+
|
|
597
|
+
// esc enters nav; the footer names what this surface can do, not the diff commands
|
|
598
|
+
await press(setup, "escape");
|
|
599
|
+
await waitForText(setup, BARE_NAV_HINT);
|
|
600
|
+
expect(setup.captureCharFrame()).not.toContain("x reject");
|
|
601
|
+
|
|
602
|
+
// a diff letter has no command here, so it leaves nav and types, as the footer says
|
|
603
|
+
await pressKey(setup, "d");
|
|
604
|
+
await waitForText(setup, "● d");
|
|
605
|
+
await press(setup, "escape");
|
|
606
|
+
await waitForTextGone(setup, "● d");
|
|
607
|
+
|
|
608
|
+
// c opens a comment on the caret word; z folds the saved card
|
|
609
|
+
await press(setup, "escape");
|
|
610
|
+
await waitForText(setup, BARE_NAV_HINT);
|
|
611
|
+
await pressKey(setup, "c");
|
|
612
|
+
await typeText(setup, "note");
|
|
613
|
+
await waitForText(setup, "● note");
|
|
614
|
+
await pressKey(setup, "RETURN", { meta: true });
|
|
615
|
+
await waitForText(setup, "note");
|
|
616
|
+
await press(setup, "escape");
|
|
617
|
+
await waitForText(setup, BARE_NAV_HINT);
|
|
618
|
+
await pressKey(setup, "z");
|
|
619
|
+
await waitForText(setup, "○ 1 comment ›");
|
|
620
|
+
|
|
621
|
+
setup.renderer.destroy();
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
test("nav mode on a bare changed-file diff has no reject or walk; x types instead", async () => {
|
|
625
|
+
const setup = await renderReadyApp(
|
|
626
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
627
|
+
{ width: 160, height: 28 },
|
|
628
|
+
);
|
|
629
|
+
await waitForText(setup, "README.md");
|
|
630
|
+
const readme = locateText(setup, "README.md");
|
|
631
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
632
|
+
await waitForText(setup, "edited in the working tree");
|
|
633
|
+
const line = locateText(setup, "edited in the working tree");
|
|
634
|
+
await setup.mockMouse.click(line.column, line.row);
|
|
635
|
+
|
|
636
|
+
await press(setup, "escape");
|
|
637
|
+
await waitForText(setup, BARE_NAV_HINT);
|
|
638
|
+
expect(setup.captureCharFrame()).not.toContain("x reject");
|
|
639
|
+
await pressKey(setup, "x");
|
|
640
|
+
await waitForText(setup, "● x");
|
|
641
|
+
const frame = setup.captureCharFrame();
|
|
642
|
+
expect(frame).toContain("edited in the working tree");
|
|
643
|
+
expect(frame).not.toContain("change rejected");
|
|
644
|
+
|
|
645
|
+
setup.renderer.destroy();
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
test("nav mode on a project file offers only comment and fold", async () => {
|
|
649
|
+
const setup = await renderReadyApp(
|
|
650
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
651
|
+
{ width: 160, height: 28 },
|
|
652
|
+
);
|
|
653
|
+
await waitForText(setup, "README.md");
|
|
654
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
655
|
+
await waitForText(setup, "README.md");
|
|
656
|
+
const readme = locateText(setup, "README.md");
|
|
657
|
+
await setup.mockMouse.click(readme.column, readme.row);
|
|
658
|
+
await waitForText(setup, "edited in the working tree");
|
|
659
|
+
const line = locateText(setup, "edited in the working tree");
|
|
660
|
+
await setup.mockMouse.click(line.column, line.row);
|
|
661
|
+
|
|
662
|
+
await press(setup, "escape");
|
|
663
|
+
await waitForText(setup, BARE_NAV_HINT);
|
|
664
|
+
expect(setup.captureCharFrame()).not.toContain("x reject");
|
|
665
|
+
await pressKey(setup, "d");
|
|
666
|
+
await waitForText(setup, "● d");
|
|
667
|
+
|
|
668
|
+
setup.renderer.destroy();
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
test("a bare launch rides a Welcome tab in the editor while the Thread pane waits empty", async () => {
|
|
672
|
+
const setup = await renderWelcome();
|
|
673
|
+
|
|
674
|
+
// the Welcome playground measures its width before it paints, so wait for its copy
|
|
675
|
+
await waitForText(setup, "Getting started");
|
|
676
|
+
const frame = setup.captureCharFrame();
|
|
677
|
+
// the getting-started surface is an editor tab, not the thread pane
|
|
678
|
+
expect(frame.split("\n")[HEADER_ROW]!).toContain("Welcome");
|
|
679
|
+
expect(frame).toContain("Getting started");
|
|
680
|
+
// the Thread pane shows its empty state until a thread is opened
|
|
681
|
+
expect(frame).toContain("Select a thread");
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
test("the Threads sidebar owns the keyboard until a pane is clicked, so nav never touches the editor", async () => {
|
|
685
|
+
const setup = await renderReadyApp(
|
|
686
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
687
|
+
{ width: 160, height: 24 },
|
|
688
|
+
);
|
|
689
|
+
await waitForText(setup, "Getting started");
|
|
690
|
+
|
|
691
|
+
// focus starts on the Threads sidebar: a letter drives the inbox, it never drafts in the editor
|
|
692
|
+
await typeText(setup, "zzz");
|
|
693
|
+
expect(setup.captureCharFrame()).not.toContain("zzz");
|
|
694
|
+
|
|
695
|
+
// clicking a line in the Welcome editor focuses that pane; now typing composes there
|
|
696
|
+
const line = locateText(setup, "quick brown fox");
|
|
697
|
+
await setup.mockMouse.click(line.column, line.row);
|
|
698
|
+
await typeText(setup, "note");
|
|
699
|
+
await waitForText(setup, "● note");
|
|
700
|
+
|
|
701
|
+
setup.renderer.destroy();
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
test("typing in the welcome composer never reaches the inbox keys", async () => {
|
|
705
|
+
// a pending thread in the sidebar so the inbox keys (delete, open) have a target to act on
|
|
706
|
+
welcomeServer.core.sessionCreate({
|
|
707
|
+
workspace: { repoRoot: welcomeRepo, branch: "main" },
|
|
708
|
+
artifact: { type: "plan", content: "# Seeded\n", meta: { title: "Seeded Plan" } },
|
|
709
|
+
});
|
|
710
|
+
const setup = await testRender(
|
|
711
|
+
<App home={welcomeHome} sessionId={undefined} cwd={welcomeRepo} />,
|
|
712
|
+
{ width: 160, height: 28 },
|
|
713
|
+
);
|
|
714
|
+
await waitForText(setup, "quick brown fox");
|
|
715
|
+
|
|
716
|
+
// open the playground composer, then type letters that are also inbox keys (j, k, d), one at a
|
|
717
|
+
// time as a person would - each keystroke settles a frame, the way real input arrives
|
|
718
|
+
await dragText(setup, "quick brown fox", "quick brown fox", "quick brown fox".length);
|
|
719
|
+
for (const character of "note: jkd") await typeText(setup, character);
|
|
720
|
+
await waitForText(setup, "note: jkd");
|
|
721
|
+
|
|
722
|
+
// the letters landed in the note, not the inbox: no delete confirmation opened
|
|
723
|
+
expect(setup.captureCharFrame()).not.toContain("This removes the plan");
|
|
724
|
+
|
|
725
|
+
// Cmd+Enter saves the note; it must not dispatch openSession and replace the playground
|
|
726
|
+
await pressKey(setup, "RETURN", { meta: true });
|
|
727
|
+
expect(setup.captureCharFrame()).toContain("Getting started");
|
|
728
|
+
|
|
729
|
+
setup.renderer.destroy();
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
test("dismissing the Welcome tab collapses the editor without stranding an empty screen", async () => {
|
|
733
|
+
const setup = await renderWelcome();
|
|
734
|
+
|
|
735
|
+
const welcome = locateText(setup, "Welcome");
|
|
736
|
+
// the close box sits just past the label
|
|
737
|
+
await setup.mockMouse.click(welcome.column + 8, welcome.row);
|
|
738
|
+
await waitForState(
|
|
739
|
+
setup,
|
|
740
|
+
() => !setup.captureCharFrame().includes("comment on agent-authored work"),
|
|
741
|
+
);
|
|
742
|
+
|
|
743
|
+
// the Threads sidebar and the Thread empty state remain - never a blank shell
|
|
744
|
+
const frame = setup.captureCharFrame();
|
|
745
|
+
expect(frame).toContain("cueloop");
|
|
746
|
+
expect(frame).toContain("Select a thread");
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
test("the changed-files and tree toggles switch navigator mode without collapsing", async () => {
|
|
750
|
+
const setup = await renderWelcome();
|
|
751
|
+
|
|
752
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
753
|
+
|
|
754
|
+
// the tree toggle switches to the project view (the launch repo's tree) without collapsing
|
|
755
|
+
await setup.mockMouse.click(treeToggleColumn(setup), HEADER_ROW);
|
|
756
|
+
await waitForText(setup, "src");
|
|
757
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
758
|
+
|
|
759
|
+
// the changed-files toggle switches back, still open
|
|
760
|
+
await setup.mockMouse.click(diffToggleColumn(setup), HEADER_ROW);
|
|
761
|
+
await waitForState(setup, () => !setup.captureCharFrame().includes("src"));
|
|
762
|
+
expect(diffToggleColumn(setup)).toBeGreaterThan(0);
|
|
763
|
+
|
|
764
|
+
// the sidebar toggle closes the region
|
|
765
|
+
await setup.mockMouse.click(rightToggleColumn(setup), HEADER_ROW);
|
|
766
|
+
await waitForState(setup, () => diffToggleColumn(setup) === -1);
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
test("a closed region draws its reopen divider in the header only, not full-height", async () => {
|
|
770
|
+
const setup = await renderWelcome();
|
|
771
|
+
|
|
772
|
+
// close the right region so only the header toggle remains
|
|
773
|
+
await setup.mockMouse.click(rightToggleColumn(setup), HEADER_ROW);
|
|
774
|
+
await waitForState(setup, () => diffToggleColumn(setup) === -1);
|
|
775
|
+
|
|
776
|
+
const lines = setup.captureCharFrame().split("\n");
|
|
777
|
+
// the reopen toggle's divider sits at the far right; find its column on the header row
|
|
778
|
+
const headerDivider = lines[HEADER_ROW]!.lastIndexOf("│");
|
|
779
|
+
expect(headerDivider).toBeGreaterThan(0);
|
|
780
|
+
// that column stays clear below the two-row header - no full-height column rule
|
|
781
|
+
const bodyRows = lines.slice(3).filter((line) => line.length > headerDivider);
|
|
782
|
+
expect(bodyRows.length).toBeGreaterThan(0);
|
|
783
|
+
for (const line of bodyRows) {
|
|
784
|
+
expect(line[headerDivider]).not.toBe("│");
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
});
|