mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-29 07:58:47 +02:00
feat: add MCP and LSP tooling support
Add global MCP/LSP settings, per-session Activity toggles, sidecar runtime integration, tests, and documentation updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, test } from 'bun:test';
|
||||
|
||||
import { applySessionEventWorkspace } from '@renderer/lib/sessionWorkspace';
|
||||
import type { SessionEventRecord } from '@shared/domain/event';
|
||||
import { createWorkspaceSettings } from '@shared/domain/tooling';
|
||||
import type { WorkspaceState } from '@shared/domain/workspace';
|
||||
|
||||
describe('session workspace helpers', () => {
|
||||
@@ -9,6 +10,7 @@ describe('session workspace helpers', () => {
|
||||
return {
|
||||
projects: [],
|
||||
patterns: [],
|
||||
settings: createWorkspaceSettings(),
|
||||
sessions: [
|
||||
{
|
||||
id: 'session-1',
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { PatternDefinition } from '@shared/domain/pattern';
|
||||
import {
|
||||
applyScratchpadSessionConfig,
|
||||
createScratchpadSessionConfig,
|
||||
resolveSessionToolingSelection,
|
||||
resolveSessionTitle,
|
||||
resolveScratchpadSessionConfig,
|
||||
type SessionRecord,
|
||||
@@ -118,3 +119,26 @@ describe('session title helpers', () => {
|
||||
).toBe('Release readiness review');
|
||||
});
|
||||
});
|
||||
|
||||
describe('session tooling helpers', () => {
|
||||
test('normalizes missing or duplicated tooling selections into stable arrays', () => {
|
||||
expect(resolveSessionToolingSelection(createSession())).toEqual({
|
||||
enabledMcpServerIds: [],
|
||||
enabledLspProfileIds: [],
|
||||
});
|
||||
|
||||
expect(
|
||||
resolveSessionToolingSelection(
|
||||
createSession({
|
||||
tooling: {
|
||||
enabledMcpServerIds: ['mcp-git', ' mcp-git ', ''],
|
||||
enabledLspProfileIds: ['ts', ' ts ', ''],
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toEqual({
|
||||
enabledMcpServerIds: ['mcp-git'],
|
||||
enabledLspProfileIds: ['ts'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import { querySessions, duplicateSessionRecord, renameSessionRecord } from '@sha
|
||||
import type { PatternDefinition } from '@shared/domain/pattern';
|
||||
import type { ProjectRecord } from '@shared/domain/project';
|
||||
import type { SessionRecord } from '@shared/domain/session';
|
||||
import { createWorkspaceSettings } from '@shared/domain/tooling';
|
||||
import type { WorkspaceState } from '@shared/domain/workspace';
|
||||
|
||||
function createPattern(overrides?: Partial<PatternDefinition>): PatternDefinition {
|
||||
@@ -66,6 +67,7 @@ function createWorkspace(overrides?: Partial<WorkspaceState>): WorkspaceState {
|
||||
return {
|
||||
projects: [createProject(), createProject({ id: 'project-scratchpad', name: 'Scratchpad', path: 'C:\\scratchpad' })],
|
||||
patterns: [createPattern(), createPattern({ id: 'pattern-single-chat', name: '1-on-1 Copilot Chat', mode: 'single' })],
|
||||
settings: createWorkspaceSettings(),
|
||||
sessions: [
|
||||
createSession(),
|
||||
createSession({
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
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({
|
||||
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',
|
||||
}),
|
||||
).toBe('LSP profile "TypeScript" needs at least one file extension.');
|
||||
});
|
||||
});
|
||||
@@ -8,6 +8,12 @@ describe('workspace seed', () => {
|
||||
|
||||
expect(workspace.projects).toEqual([]);
|
||||
expect(workspace.sessions).toEqual([]);
|
||||
expect(workspace.settings).toEqual({
|
||||
tooling: {
|
||||
mcpServers: [],
|
||||
lspProfiles: [],
|
||||
},
|
||||
});
|
||||
expect(workspace.selectedProjectId).toBeUndefined();
|
||||
expect(workspace.selectedPatternId).toBeUndefined();
|
||||
expect(workspace.selectedSessionId).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user