mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-25 05:58:39 +02:00
Add appearance theme support (dark/light/system) using CSS custom property overrides. In light mode the Tailwind zinc scale is inverted and semantic surface/border tokens are swapped, so all existing utility classes pick up the new palette automatically. - Add AppearanceTheme type and theme field to WorkspaceSettings - Add setTheme IPC channel wiring (contracts, preload, handler, service) - Add [data-theme='light'] CSS overrides for zinc scale, surface tokens, scrollbar, and markdown prose colours - Add Appearance section to SettingsPanel with radio-button theme picker - Apply data-theme attribute on document root via useEffect in App.tsx, with matchMedia listener for the system option Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
159 lines
4.4 KiB
TypeScript
159 lines
4.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
|
|
import {
|
|
normalizeWorkspaceSettings,
|
|
validateLspProfileDefinition,
|
|
validateMcpServerDefinition,
|
|
type LspProfileDefinition,
|
|
type McpServerDefinition,
|
|
} from '@shared/domain/tooling';
|
|
|
|
const TIMESTAMP = '2026-03-23T00:00:00.000Z';
|
|
|
|
describe('tooling settings helpers', () => {
|
|
test('normalizes persisted MCP and LSP definitions into trimmed stable settings', () => {
|
|
const workspaceSettings = normalizeWorkspaceSettings({
|
|
tooling: {
|
|
mcpServers: [
|
|
{
|
|
id: 'mcp-local',
|
|
name: ' Local MCP ',
|
|
transport: 'local',
|
|
command: ' node ',
|
|
args: [' --stdio ', ' --stdio ', ''],
|
|
cwd: ' C:\\workspace\\repo ',
|
|
tools: [' git.status ', '', ' git.status '],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
{
|
|
id: 'mcp-remote',
|
|
name: ' Remote MCP ',
|
|
transport: 'http',
|
|
url: ' https://example.com/mcp ',
|
|
tools: [],
|
|
timeoutMs: 1000,
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
],
|
|
lspProfiles: [
|
|
{
|
|
id: 'lsp-ts',
|
|
name: ' TypeScript ',
|
|
command: ' typescript-language-server ',
|
|
args: [' --stdio ', ' --stdio ', ''],
|
|
languageId: ' typescript ',
|
|
fileExtensions: ['ts', ' .tsx ', ''],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
expect(workspaceSettings).toEqual({
|
|
theme: 'dark',
|
|
tooling: {
|
|
mcpServers: [
|
|
{
|
|
id: 'mcp-local',
|
|
name: 'Local MCP',
|
|
transport: 'local',
|
|
command: 'node',
|
|
args: ['--stdio'],
|
|
cwd: 'C:\\workspace\\repo',
|
|
tools: ['git.status'],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
{
|
|
id: 'mcp-remote',
|
|
name: 'Remote MCP',
|
|
transport: 'http',
|
|
url: 'https://example.com/mcp',
|
|
tools: [],
|
|
timeoutMs: 1000,
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
],
|
|
lspProfiles: [
|
|
{
|
|
id: 'lsp-ts',
|
|
name: 'TypeScript',
|
|
command: 'typescript-language-server',
|
|
args: ['--stdio'],
|
|
languageId: 'typescript',
|
|
fileExtensions: ['.ts', '.tsx'],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
},
|
|
],
|
|
},
|
|
});
|
|
});
|
|
|
|
test('validates required MCP transport settings', () => {
|
|
const localServer: McpServerDefinition = {
|
|
id: 'mcp-local',
|
|
name: 'Local MCP',
|
|
transport: 'local',
|
|
command: '',
|
|
args: [],
|
|
tools: ['*'],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
};
|
|
const remoteServer: McpServerDefinition = {
|
|
id: 'mcp-remote',
|
|
name: 'Remote MCP',
|
|
transport: 'sse',
|
|
url: 'not-a-url',
|
|
tools: ['*'],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
};
|
|
|
|
expect(validateMcpServerDefinition(localServer)).toBe('MCP server "Local MCP" needs a command.');
|
|
expect(validateMcpServerDefinition(remoteServer)).toBe('MCP server "Remote MCP" has an invalid URL.');
|
|
});
|
|
|
|
test('validates required LSP profile settings', () => {
|
|
const profile: LspProfileDefinition = {
|
|
id: 'lsp-empty',
|
|
name: 'TypeScript',
|
|
command: '',
|
|
args: [],
|
|
languageId: 'typescript',
|
|
fileExtensions: [],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
};
|
|
|
|
expect(validateLspProfileDefinition(profile)).toBe('LSP profile "TypeScript" needs a command.');
|
|
expect(
|
|
validateLspProfileDefinition({
|
|
...profile,
|
|
command: 'typescript-language-server',
|
|
args: ['--stdio'],
|
|
}),
|
|
).toBe('LSP profile "TypeScript" needs at least one file extension.');
|
|
});
|
|
|
|
test('requires the stdio flag for the TypeScript language server profile', () => {
|
|
expect(
|
|
validateLspProfileDefinition({
|
|
id: 'lsp-ts',
|
|
name: 'Typescript LSP',
|
|
command: 'typescript-language-server',
|
|
args: [],
|
|
languageId: 'typescript',
|
|
fileExtensions: ['.ts', '.tsx'],
|
|
createdAt: TIMESTAMP,
|
|
updatedAt: TIMESTAMP,
|
|
}),
|
|
).toBe('LSP profile "Typescript LSP" needs the "--stdio" argument.');
|
|
});
|
|
});
|