feat(FN-3039): bundle nerd font glyph asset and prioritize it in terminal f

Merges two features: FN-3039 bundles a 2.5MB Nerd Font glyph asset into the dashboard and updates the terminal to prioritize the bundled font, improving icon rendering across environments; FN-3035 tightens insight tool type definitions and adds corresponding tests. The CLI extension gains new tools

Fusion-Task-Id: FN-3039
This commit is contained in:
Fusion
2026-04-30 20:04:43 -07:00
committed by gsxdsm
parent e6d39bfab3
commit 3443aed5cf
8 changed files with 34 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Ship a bundled Nerd Font symbols fallback for the dashboard terminal so patched glyphs render even when users do not have a local Nerd Font installed. The dashboard now preloads `/fonts/SymbolsNerdFontMono-Regular.ttf`, applies it first in the xterm font stack, and includes build-output regression checks for the bundled font artifact and preload reference.

View File

@@ -252,7 +252,7 @@ Access a fully functional PTY (pseudo-terminal) shell directly from the dashboar
- **Real PTY Terminal**: Spawns a real shell (bash/zsh/powershell) using node-pty for authentic terminal behavior
- **Bidirectional Communication**: WebSocket connection for instant input/output
- **xterm.js Integration**: Full terminal emulation with proper ANSI support, colors, and cursor handling
- **Nerd Font-preferred rendering**: The terminal prefers a Nerd Font-capable monospace stack (`MesloLGS NF`, `JetBrainsMono Nerd Font`, `FiraCode Nerd Font`, etc.) with standard monospace fallbacks so powerline/private-use prompt glyphs render correctly when patched fonts are installed
- **Bundled Nerd Font glyph fallback**: The terminal now ships a bundled Nerd Font symbols asset (`/fonts/SymbolsNerdFontMono-Regular.ttf`) and preloads it for deterministic powerline/private-use glyph rendering, while still keeping the existing Nerd Font-preferred monospace stack (`MesloLGS NF`, `JetBrainsMono Nerd Font`, `FiraCode Nerd Font`, etc.) plus standard monospace fallbacks for normal text metrics.
- **Auto-resizing**: Terminal automatically fits to container size
- **Scrollback Buffer**: 5KB of scrollback history with replay on reconnect
- **Reconnection Support**: Automatic reconnect with exponential backoff if connection drops

View File

@@ -31,4 +31,17 @@ describe("mobile build output chunking", () => {
expect(indexHtml).toMatch(/assets\/vendor-react-[A-Za-z0-9_-]+\.js/);
expect(indexHtml).toMatch(/assets\/vendor-xterm-[A-Za-z0-9_-]+\.js/);
});
test("ships Nerd Font symbol fallback asset and preloads it in dist index", () => {
const bundledFontPath = resolve(
dashboardClientDistDir,
"fonts",
"SymbolsNerdFontMono-Regular.ttf",
);
const indexHtml = readFileSync(resolve(dashboardClientDistDir, "index.html"), "utf8");
expect(() => readFileSync(bundledFontPath)).not.toThrow();
expect(indexHtml).toContain('/fonts/SymbolsNerdFontMono-Regular.ttf');
expect(indexHtml).toContain('rel="preload"');
});
});

View File

@@ -1,3 +1,9 @@
@font-face {
font-family: "Fusion Terminal Nerd Font Symbols";
src: url("/fonts/SymbolsNerdFontMono-Regular.ttf") format("truetype");
font-display: swap;
}
/* === Terminal Modal === */
/* Center vertically (override the overlay's default top alignment). */
.modal-overlay:has(.terminal-modal) {

View File

@@ -28,7 +28,7 @@ const DEFAULT_FONT_SIZE = 14;
const MIN_TERMINAL_FONT_SIZE = 8;
const MAX_TERMINAL_FONT_SIZE = 32;
const XTERM_FONT_FAMILY =
'"MesloLGS NF", "MesloLGM Nerd Font", "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "Hack Nerd Font", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';
'"Fusion Terminal Nerd Font Symbols", "MesloLGS NF", "MesloLGM Nerd Font", "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "Hack Nerd Font", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';
export function ctrlChar(key: string): string {
if (!key) {

View File

@@ -563,7 +563,7 @@ describe("TerminalModal", () => {
expect(Terminal).toHaveBeenCalledWith(
expect.objectContaining({
fontFamily:
'"MesloLGS NF", "MesloLGM Nerd Font", "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "Hack Nerd Font", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
'"Fusion Terminal Nerd Font Symbols", "MesloLGS NF", "MesloLGM Nerd Font", "JetBrainsMono Nerd Font", "FiraCode Nerd Font", "Hack Nerd Font", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
}),
);
expect(screen.getByTestId("terminal-font-size-value").textContent).toBe("14px");

View File

@@ -7,6 +7,13 @@
<title>Fusion</title>
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
<link rel="manifest" href="/manifest.json" />
<link
rel="preload"
href="/fonts/SymbolsNerdFontMono-Regular.ttf"
as="font"
type="font/ttf"
crossorigin
/>
<meta name="theme-color" content="#1a1a2e" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />