chore(cleanup): remove mode selection system

Max no longer has a Basic/Coach/Assistant mode selection: it will start
directly as a freelance coach, with a single server-side pipeline built in
a later step. Removes the Mode type/state, the skill-to-mode mapping, the
per-mode skill filtering and system prompt branching, and the 3-way mode
submenu in the context menu. Skills now always load as a single flat set
via loadSkills(); mode-specific behavior removal is a prerequisite for
retiring the old pipeline itself in the next cleanup commit.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 17:51:30 +01:00
parent 885e24d037
commit 9aa5abc121
12 changed files with 28 additions and 494 deletions
@@ -149,7 +149,7 @@ describe('<App />', () => {
render(<App />)
const container = screen.getByTestId('avatar-viewer').parentElement!
fireEvent.contextMenu(container)
expect(showContextMenu).toHaveBeenCalledWith(false, false)
expect(showContextMenu).toHaveBeenCalledWith(false)
})
it('should enable listening once getAuthStatus reports an existing session', async () => {
@@ -159,7 +159,7 @@ describe('<App />', () => {
await waitFor(() => {
fireEvent.contextMenu(container)
expect(showContextMenu).toHaveBeenCalledWith(true, false)
expect(showContextMenu).toHaveBeenCalledWith(true)
})
})
-30
View File
@@ -1,30 +0,0 @@
import { describe, it, expect, beforeEach } from 'vitest'
import { getMode, setMode } from '../../src/main/mode/modeState'
import { getModesForSkill } from '../../src/main/skills/modeMap'
describe('modeState', () => {
beforeEach(() => setMode('basic'))
it('should default to basic mode', () => {
expect(getMode()).toBe('basic')
})
it('should persist the mode after setMode()', () => {
setMode('coach')
expect(getMode()).toBe('coach')
setMode('assistant')
expect(getMode()).toBe('assistant')
})
})
describe('getModesForSkill()', () => {
it('should return the modes registered for a known skill', () => {
expect(getModesForSkill('search_web')).toEqual(['basic', 'coach', 'assistant'])
expect(getModesForSkill('open_app')).toEqual(['basic', 'assistant'])
expect(getModesForSkill('draw_schema')).toEqual(['coach'])
})
it('should return an empty array and warn for an unregistered skill', () => {
expect(getModesForSkill('skill_totalement_inconnu')).toEqual([])
})
})
+2 -8
View File
@@ -11,12 +11,8 @@ interface FakeSkill {
}
let currentSkills: FakeSkill[] = []
const getSkillsForMode = vi.fn(() => currentSkills)
vi.mock('../../src/main/skills', () => ({ getSkillsForMode }))
let currentMode: 'basic' | 'coach' | 'assistant' = 'basic'
const getMode = vi.fn(() => currentMode)
vi.mock('../../src/main/mode/modeState', () => ({ getMode }))
const loadSkills = vi.fn(() => currentSkills)
vi.mock('../../src/main/skills', () => ({ loadSkills }))
const getMemoriesText = vi.fn(() => '')
const getMood = vi.fn(() => 0)
@@ -69,7 +65,6 @@ describe('getAssistantReply()', () => {
vi.clearAllMocks()
vi.stubGlobal('fetch', vi.fn())
currentSkills = []
currentMode = 'basic'
getSubjectLevel.mockReturnValue(null)
process.env.OPENROUTER_API_KEY = 'test-key'
setCurrentUserEmail('test@example.com')
@@ -208,7 +203,6 @@ describe('getAssistantReply() — garde-fous du pipeline Coach', () => {
beforeEach(() => {
vi.clearAllMocks()
vi.stubGlobal('fetch', vi.fn())
currentMode = 'coach'
getSubjectLevel.mockReturnValue(null)
process.env.OPENROUTER_API_KEY = 'test-key'
setCurrentUserEmail('test@example.com')
+3 -14
View File
@@ -39,7 +39,7 @@ vi.mock('@electron-toolkit/utils', () => ({
optimizer: { watchWindowShortcuts: vi.fn() }
}))
const { loadSkills, getSkillsForMode, findSkill } = await import('../../src/main/skills')
const { loadSkills, findSkill } = await import('../../src/main/skills')
describe('loadSkills()', () => {
it('should load a non-empty list of skills without throwing', () => {
@@ -51,20 +51,9 @@ describe('loadSkills()', () => {
const names = loadSkills().map((s) => s.name)
expect(new Set(names).size).toBe(names.length)
})
})
describe('getSkillsForMode()', () => {
it('should include a coach-only skill in coach mode but not in basic mode', () => {
const coachSkills = getSkillsForMode('coach').map((s) => s.name)
const basicSkills = getSkillsForMode('basic').map((s) => s.name)
expect(coachSkills).toContain('draw_schema')
expect(basicSkills).not.toContain('draw_schema')
})
it('should include a transversal skill in every mode', () => {
for (const mode of ['basic', 'coach', 'assistant'] as const) {
expect(getSkillsForMode(mode).map((s) => s.name)).toContain('search_web')
}
it('should include a transversal skill', () => {
expect(loadSkills().map((s) => s.name)).toContain('search_web')
})
})