Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/highlight-prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from "react";
import { testRender } from "@opentui/react/test-utils";
import { parseDiffFromFile } from "@pierre/diffs";
import { act } from "react";
import { App } from "../src/ui/App";
import { AppHost } from "../src/ui/App";
import type { AppBootstrap, DiffFile } from "../src/core/types";

function createDiffFile(index: number, marker: string): DiffFile {
Expand Down Expand Up @@ -94,7 +94,7 @@ function frameHasHighlightedMarker(
});
}

const setup = await testRender(React.createElement(App, { bootstrap: createBootstrap() }), {
const setup = await testRender(React.createElement(AppHost, { bootstrap: createBootstrap() }), {
width: 240,
height: 24,
});
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/large-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { performance } from "perf_hooks";
import React from "react";
import { testRender } from "@opentui/react/test-utils";
import { act } from "react";
import { App } from "../src/ui/App";
import { AppHost } from "../src/ui/App";
import {
createLargeSplitStreamBootstrap,
DEFAULT_FILE_COUNT,
Expand Down Expand Up @@ -69,7 +69,7 @@ async function destroyRenderer(setup: BenchmarkRenderer) {

async function measureFirstFrameMs(notesPerFile: number) {
const setup = await testRender(
React.createElement(App, {
React.createElement(AppHost, {
bootstrap: createLargeSplitStreamBootstrap({ notesPerFile }),
}),
VIEWPORT,
Expand All @@ -87,7 +87,7 @@ async function measureFirstFrameMs(notesPerFile: number) {

async function measureScrollTicksMs(notesPerFile: number) {
const setup = await testRender(
React.createElement(App, {
React.createElement(AppHost, {
bootstrap: createLargeSplitStreamBootstrap({ notesPerFile }),
}),
VIEWPORT,
Expand Down
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { pagePlainText } from "./core/pager";
import { shutdownSession } from "./core/shutdown";
import { prepareStartupPlan } from "./core/startup";
import { resolveStartupUpdateNotice } from "./core/updateNotice";
import { App } from "./ui/App";
import { AppHost } from "./ui/App";
import { HunkHostClient } from "./mcp/client";
import { serveHunkMcpServer } from "./mcp/server";
import { createInitialSessionSnapshot, createSessionRegistration } from "./mcp/sessionRegistration";
Expand Down Expand Up @@ -74,7 +74,7 @@ async function main() {

// The app owns the full alternate screen session from this point on.
root.render(
<App
<AppHost
bootstrap={bootstrap}
hostClient={hostClient}
onQuit={shutdown}
Expand Down
32 changes: 16 additions & 16 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function clamp(value: number, min: number, max: number) {
return Math.min(Math.max(value, min), max);
}

/** Preserve the active shell view settings when rebuilding the current input. */
/** Preserve the active app view settings when rebuilding the current input. */
function withCurrentViewOptions(
input: CliInput,
view: {
Expand All @@ -85,7 +85,7 @@ function withCurrentViewOptions(
}

/** Orchestrate global app state, layout, navigation, and pane coordination. */
function AppShell({
function App({
bootstrap,
hostClient,
noticeText,
Expand All @@ -98,7 +98,7 @@ function AppShell({
onQuit?: () => void;
onReloadSession: (
nextInput: CliInput,
options?: { resetShell?: boolean; sourcePath?: string },
options?: { resetApp?: boolean; sourcePath?: string },
) => Promise<ReloadedSessionResult>;
}) {
const FILES_MIN_WIDTH = 22;
Expand Down Expand Up @@ -227,7 +227,7 @@ function AppShell({
}, [maxFilesPaneWidth, showFilesPane]);

useEffect(() => {
// Force an intermediate redraw when shell geometry or row-wrapping changes so pane relayout
// Force an intermediate redraw when app geometry or row-wrapping changes so pane relayout
// feels immediate after toggling split/stack or line wrapping.
renderer.intermediateRender();
}, [renderer, resolvedLayout, showFilesPane, terminal.height, terminal.width, wrapLines]);
Expand Down Expand Up @@ -353,7 +353,7 @@ function AppShell({
setWrapLines((current) => !current);
};

/** Toggle the sidebar, forcing it open on narrower layouts when the shell can still fit both panes. */
/** Toggle the sidebar, forcing it open on narrower layouts when the app can still fit both panes. */
const toggleSidebar = () => {
if (sidebarVisible && (responsiveLayout.showFilesPane || forceSidebarOpen)) {
setSidebarVisible(false);
Expand Down Expand Up @@ -385,7 +385,7 @@ function AppShell({
const canRefreshCurrentInput = canReloadInput(bootstrap.input);
const watchEnabled = Boolean(bootstrap.input.options.watch && canRefreshCurrentInput);

/** Rebuild the current diff source while preserving the active shell view options. */
/** Rebuild the current diff source while preserving the active app view options. */
const refreshCurrentInput = useCallback(async () => {
if (!canRefreshCurrentInput) {
return;
Expand All @@ -400,7 +400,7 @@ function AppShell({
wrapLines,
});

await onReloadSession(nextInput, { resetShell: false });
await onReloadSession(nextInput, { resetApp: false });
}, [
bootstrap.input,
canRefreshCurrentInput,
Expand Down Expand Up @@ -470,7 +470,7 @@ function AppShell({
};
}, [bootstrap.input, refreshCurrentInput, watchEnabled]);

/** Leave the app through the shell-owned shutdown path. */
/** Leave the app through the shared shutdown path. */
const requestQuit = useCallback(() => {
onQuit();
}, [onQuit]);
Expand Down Expand Up @@ -1045,8 +1045,8 @@ function AppShell({
);
}

/** Keep one live Hunk window mounted while allowing daemon-driven session reloads. */
export function App({
/** Keep one live Hunk app mounted while allowing daemon-driven session reloads. */
export function AppHost({
bootstrap,
hostClient,
onQuit = () => process.exit(0),
Expand All @@ -1058,14 +1058,14 @@ export function App({
startupNoticeResolver?: () => Promise<UpdateNotice | null>;
}) {
const [activeBootstrap, setActiveBootstrap] = useState(bootstrap);
const [shellVersion, setShellVersion] = useState(0);
const [appVersion, setAppVersion] = useState(0);
const startupNoticeText = useStartupUpdateNotice({
enabled: !bootstrap.input.options.pager,
resolver: startupNoticeResolver,
});

const reloadSession = useCallback(
async (nextInput: CliInput, options?: { resetShell?: boolean; sourcePath?: string }) => {
async (nextInput: CliInput, options?: { resetApp?: boolean; sourcePath?: string }) => {
const runtimeInput = resolveRuntimeCliInput(nextInput);
const configuredInput = resolveConfiguredCliInput(runtimeInput, {
cwd: options?.sourcePath,
Expand All @@ -1086,8 +1086,8 @@ export function App({
}

setActiveBootstrap(nextBootstrap);
if (options?.resetShell !== false) {
setShellVersion((current) => current + 1);
if (options?.resetApp !== false) {
setAppVersion((current) => current + 1);
}

return {
Expand All @@ -1104,8 +1104,8 @@ export function App({
);

return (
<AppShell
key={shellVersion}
<App
key={appVersion}
bootstrap={activeBootstrap}
hostClient={hostClient}
noticeText={startupNoticeText}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/chrome/ModalFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ReactNode } from "react";
import { fitText, padText } from "../../lib/text";
import type { AppTheme } from "../../themes";

/** Render a centered framed modal shell that other dialogs can reuse. */
/** Render a centered framed modal container that other dialogs can reuse. */
export function ModalFrame({
children,
height,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/hooks/useHunkSessionBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function useHunkSessionBridge({
openAgentNotes: () => void;
reloadSession: (
nextInput: CliInput,
options?: { resetShell?: boolean; sourcePath?: string },
options?: { resetApp?: boolean; sourcePath?: string },
) => Promise<ReloadedSessionResult>;
selectedFile: DiffFile | undefined;
selectedHunkIndex: number;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/lib/appMenus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface BuildAppMenusOptions {
wrapLines: boolean;
}

/** Build the top-level app menus from the current shell state and actions. */
/** Build the top-level app menus from the current app state and actions. */
export function buildAppMenus({
activeThemeId,
canRefreshCurrentInput,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/lib/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function mergeFileAnnotationsByFileId<T extends AgentAnnotation>(
});
}

/** Apply the shell's file filter query to the visible review stream. */
/** Apply the app's file filter query to the visible review stream. */
export function filterReviewFiles(files: DiffFile[], query: string): DiffFile[] {
const trimmedQuery = query.trim().toLowerCase();
if (!trimmedQuery) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/lib/responsive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ResponsiveLayout {
showFilesPane: boolean;
}

/** Bucket terminal widths into the viewport classes the shell layout cares about. */
/** Bucket terminal widths into the viewport classes the app layout cares about. */
function resolveResponsiveViewport(viewportWidth: number): ResponsiveViewport {
if (viewportWidth >= FULL_VIEWPORT_MIN_WIDTH) {
return "full";
Expand Down
2 changes: 1 addition & 1 deletion src/ui/lib/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** Clamp a dragged sidebar width into the shell's allowed range. */
/** Clamp a dragged sidebar width into the app layout's allowed range. */
export function resizeSidebarWidth(
startWidth: number,
dragOriginX: number,
Expand Down
Loading
Loading