Skip to content
Open
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
39 changes: 39 additions & 0 deletions docs/frontend-ui-audit-2026-08-14/TerminalCore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Frontend UI Audit — TerminalCore

**File:** `src/engines/TerminalCore/index.tsx` (440 LOC)
**Date:** 2026-08-14
**Auditor:** Codex

## D1 — Raw HTML vs Design System

| Line | Element | Verdict | Reason | Suggested change |
| ---- | ------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------- |
| — | No raw interactive or covered structural elements | keep with reason | The changed surface composes existing terminal and placeholder components; xterm host internals are outside this audit | — |

## D2 — Arbitrary Tailwind Value vs Token

| Line | Value | Verdict | Reason | Suggested change |
| ---- | ---------------------------------- | ---------------- | ------------------------------------------------------- | ---------------- |
| — | No arbitrary Tailwind color values | keep with reason | The lifecycle refactor adds no class-level token bridge | — |

## D3 — Hardcoded Sizes / Colors

| Line | Value | Verdict | Reason | Suggested change |
| ---- | ------------------------------ | ---------------- | ----------------------------------------- | ---------------- |
| — | No new hardcoded size or color | keep with reason | The refactor changes mount ownership only | — |

## D4 — Accessibility

| Line | Element | Verdict | Reason | Suggested change |
| ---- | -------------------------- | ---------------- | ---------------------------------------------------------------------- | ---------------- |
| — | No new interactive element | keep with reason | Visible and hidden states continue to use existing semantic components | — |

## D5 — Visual Patterns Observed

- No new visual pattern; the change replaces retained hidden terminal surfaces with one active mounted surface.

## Summary

- 0 fixes recommended
- 0 kept UI hits with documented reason (four no-hit checks documented)
- 0 abstract candidates (>= 3 occurrences)
39 changes: 39 additions & 0 deletions docs/frontend-ui-audit-2026-08-14/TerminalMainContent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Frontend UI Audit — TerminalMainContent

**File:** `src/modules/WorkStation/CodeEditor/Panels/EditorMainPane/content/TerminalMainContent/index.tsx` (216 LOC)
**Date:** 2026-08-14
**Auditor:** Codex

## D1 — Raw HTML vs Design System

| Line | Element | Verdict | Reason | Suggested change |
| ---- | ------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------- | ---------------- |
| — | No raw interactive or covered structural elements | keep with reason | The changed branch only selects whether an existing terminal component is mounted | — |

## D2 — Arbitrary Tailwind Value vs Token

| Line | Value | Verdict | Reason | Suggested change |
| ---- | ---------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| — | No arbitrary Tailwind color values | keep with reason | The existing `backgroundColor` prop bridges the CodeMirror/terminal theme at the component boundary and was not introduced by this change | — |

## D3 — Hardcoded Sizes / Colors

| Line | Value | Verdict | Reason | Suggested change |
| ---- | ------------------------------ | ---------------- | --------------------------------------------- | ---------------- |
| — | No new hardcoded size or color | keep with reason | The lifecycle refactor adds no visual literal | — |

## D4 — Accessibility

| Line | Element | Verdict | Reason | Suggested change |
| ---- | -------------------------- | ---------------- | ----------------------------------------------------------------------------------------- | ---------------- |
| — | No new interactive element | keep with reason | Visibility controls resource mounting without changing the accessible interaction surface | — |

## D5 — Visual Patterns Observed

- No new visual pattern; the component forwards host visibility to the existing terminal surface.

## Summary

- 0 fixes recommended
- 0 kept UI hits with documented reason (four no-hit checks documented)
- 0 abstract candidates (>= 3 occurrences)
39 changes: 39 additions & 0 deletions docs/frontend-ui-audit-2026-08-14/TerminalTabRenderer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Frontend UI Audit — TerminalTabRenderer

**File:** `src/modules/WorkStation/TabContent/renderers/terminal.tsx` (51 LOC)
**Date:** 2026-08-14
**Auditor:** Codex

## D1 — Raw HTML vs Design System

| Line | Element | Verdict | Reason | Suggested change |
| ---- | ------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------- | ---------------- |
| — | No raw interactive or covered structural elements | keep with reason | The renderer composes `Suspense`, `Placeholder`, and `TerminalMainContent` only | — |

## D2 — Arbitrary Tailwind Value vs Token

| Line | Value | Verdict | Reason | Suggested change |
| ---- | --------------------------- | ---------------- | ------------------------------------------------ | ---------------- |
| — | No arbitrary Tailwind value | keep with reason | No styling is introduced in the changed renderer | — |

## D3 — Hardcoded Sizes / Colors

| Line | Value | Verdict | Reason | Suggested change |
| ---- | -------------------------- | ---------------- | ------------------------------------------------ | ---------------- |
| — | No hardcoded size or color | keep with reason | No visual literal exists in the changed renderer | — |

## D4 — Accessibility

| Line | Element | Verdict | Reason | Suggested change |
| ---- | ---------------------- | ---------------- | -------------------------------------------------- | ---------------- |
| — | No interactive element | keep with reason | The renderer only forwards the host's active state | — |

## D5 — Visual Patterns Observed

- No new visual pattern; this is a lifecycle-only renderer adapter.

## Summary

- 0 fixes recommended
- 0 kept UI hits with documented reason (four no-hit checks documented)
- 0 abstract candidates (>= 3 occurrences)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { beforeEach, describe, expect, it, vi } from "vitest";

import { invokeTauri, isTauriReady } from "@src/util/platform/tauri/init";

import { cleanupPtyListeners } from "../terminalLifecycle";
import { unregisterPane } from "../terminalOutputScheduler";

vi.mock("@src/util/platform/tauri/init", () => ({
invokeTauri: vi.fn().mockResolvedValue(undefined),
isTauriReady: vi.fn().mockReturnValue(true),
}));
vi.mock("../terminalOutputScheduler", () => ({
unregisterPane: vi.fn(),
}));

describe("cleanupPtyListeners", () => {
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(isTauriReady).mockReturnValue(true);
vi.mocked(invokeTauri).mockResolvedValue(undefined);
});

it("detaches the renderer stream without closing the running PTY", () => {
const unlistenOutput = vi.fn();
const unlistenExit = vi.fn();
const sessionIdRef = { current: "terminal-pty-agent-a" };

cleanupPtyListeners({
unlistenOutputRef: { current: unlistenOutput },
unlistenExitRef: { current: unlistenExit },
sessionIdRef,
});

expect(unlistenOutput).toHaveBeenCalledOnce();
expect(unlistenExit).toHaveBeenCalledOnce();
expect(unregisterPane).toHaveBeenCalledWith("terminal-pty-agent-a");
expect(invokeTauri).toHaveBeenCalledWith("detach_pty_stream", {
sessionId: "terminal-pty-agent-a",
});
expect(invokeTauri).not.toHaveBeenCalledWith(
"close_pty",
expect.anything()
);
expect(sessionIdRef.current).toBeNull();
});

it("still clears local listeners when Tauri is unavailable", () => {
vi.mocked(isTauriReady).mockReturnValue(false);
const unlistenOutput = vi.fn();
const unlistenExit = vi.fn();
const sessionIdRef = { current: "terminal-pty-browser" };

cleanupPtyListeners({
unlistenOutputRef: { current: unlistenOutput },
unlistenExitRef: { current: unlistenExit },
sessionIdRef,
});

expect(unlistenOutput).toHaveBeenCalledOnce();
expect(unlistenExit).toHaveBeenCalledOnce();
expect(unregisterPane).toHaveBeenCalledOnce();
expect(invokeTauri).not.toHaveBeenCalled();
expect(sessionIdRef.current).toBeNull();
});
});
6 changes: 4 additions & 2 deletions src/contexts/contexts_organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Contexts for Workstation pages. Each provides session/state management.
| `BrowserContext` | Browser tab sessions |
| `EditorContext` | Editor repo selection |
| `FilesContext` | Document files management |
| `TerminalContext` | Terminal sessions |

Terminal sessions are owned by the workstation terminal atoms rather than a
parallel React context.

### `session/` - Session Contexts

Expand Down Expand Up @@ -101,7 +103,7 @@ Reorganized on 2026-01-29:

- Moved `GitStatusContext/` → `git/GitStatusContext/`
- Moved `MultiRepoGitStatusContext` → `git/`
- Moved `AutomationContext`, `BrowserContext`, `EditorContext`, `FilesContext`, `TerminalContext` → `workstation/`
- Moved `AutomationContext`, `BrowserContext`, `EditorContext`, `FilesContext` → `workstation/`
- Moved `SessionListContext`, `RecentFilesContext` → `session/`
- Moved `ToolbarThemeContext` → `ui/`
- Kept `workspace/` as-is (already organized)
Expand Down
Loading
Loading