refactor: move app code into Max Avatar/ subfolder (monorepo prep for backend)

Step 1 of adding a backend proxy server (API keys held server-side instead
of shipped in the installer). Moves everything app-specific into
"Max Avatar/" via git mv (preserves history): src/, tests/, scripts/,
assets/, build/, resources/, package.json/-lock.json, electron-builder.yml,
electron.vite.config.ts, eslint.config.mjs, playwright.config.ts,
vitest.config.mts, sonar-project.properties, tsconfig*.json, Dockerfile,
.editorconfig/.env*/.gitignore/.prettier*.

CLAUDE.md, README.md, docs/, .claude/, .gitea/, .husky/, .vscode/, and the
docker-compose files stay at the repo root, since they'll apply to both the
app and the future backend.

No application code needed changes (all its internal paths are relative to
its own tree). Adjusted what referenced the old root from outside:
- .husky/pre-commit: cd into "Max Avatar" before lint-staged
- .gitea/workflows/*.yml: working-directory + cache-dependency-path +
  artifact paths + SonarQube projectBaseDir
- docker-compose.yml: build context -> ./Max Avatar
- Max Avatar/Dockerfile: node:20-alpine -> node:24-alpine (same node:sqlite
  issue already fixed elsewhere, never applied here before)
- .vscode/launch.json, README.md: updated paths/instructions

Verified from Max Avatar/ after the move: npm ci, typecheck, lint,
test:coverage (473/473, same coverage numbers), build, and dev all work
unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 12:15:30 +01:00
co-authored by Claude Sonnet 5
parent 60e2fb26af
commit 1c2f002eb3
224 changed files with 135 additions and 18 deletions
@@ -0,0 +1,115 @@
import { describe, it, expect, vi } from 'vitest'
const clickElementByText = vi.fn(async (text: string) => text !== 'introuvable')
const fillField = vi.fn(async (field: string) => field !== 'introuvable')
const goBack = vi.fn(async () => true)
const highlightText = vi.fn(async (text: string) => text !== 'introuvable')
const navigateTo = vi.fn(async () => 'Titre de la page')
const readPageText = vi.fn(async () => 'Contenu de la page')
vi.mock('../../src/main/browser/browserWindow', () => ({
clickElementByText,
fillField,
goBack,
highlightText,
navigateTo,
readPageText
}))
const { clickBrowserElement } = await import('../../src/main/skills/browser/clickBrowserElement')
const { fillBrowserField } = await import('../../src/main/skills/browser/fillBrowserField')
const { goBackBrowser } = await import('../../src/main/skills/browser/goBackBrowser')
const { highlightBrowserText } = await import('../../src/main/skills/browser/highlightBrowserText')
const { navigateBrowser } = await import('../../src/main/skills/browser/navigateBrowser')
const { readBrowserPage } = await import('../../src/main/skills/browser/readBrowserPage')
describe('click_browser_element', () => {
it('should refuse an empty text', async () => {
await expect(clickBrowserElement.execute({ text: '' })).rejects.toThrow(/text manquant/)
})
it('should report success when the element is found and clicked', async () => {
const result = await clickBrowserElement.execute({ text: 'Connexion' })
expect(result).toMatch(/Clic effectue/)
})
it('should report failure when no matching element is found', async () => {
const result = await clickBrowserElement.execute({ text: 'introuvable' })
expect(result).toMatch(/Echec/)
})
})
describe('fill_browser_field', () => {
it('should refuse an empty field name', async () => {
await expect(fillBrowserField.execute({ field: '', value: 'x' })).rejects.toThrow(
/field manquant/
)
})
it('should report success and mention submission when requested', async () => {
const result = await fillBrowserField.execute({
field: 'email',
value: 'a@b.com',
submit: true
})
expect(result).toMatch(/rempli et formulaire valide/)
})
it('should report failure when no matching field is found', async () => {
const result = await fillBrowserField.execute({ field: 'introuvable', value: 'x' })
expect(result).toMatch(/Echec/)
})
})
describe('go_back_browser', () => {
it('should report success when going back worked', async () => {
const result = await goBackBrowser.execute({})
expect(result).toMatch(/Retour/)
})
it('should report failure when there is no previous page', async () => {
goBack.mockResolvedValueOnce(false)
const result = await goBackBrowser.execute({})
expect(result).toMatch(/Echec/)
})
})
describe('highlight_browser_text', () => {
it('should refuse an empty text', async () => {
await expect(highlightBrowserText.execute({ text: '' })).rejects.toThrow(/text manquant/)
})
it('should report success when the text is found', async () => {
const result = await highlightBrowserText.execute({ text: 'un passage' })
expect(result).toMatch(/surligne/)
})
it('should report failure when the text is not found', async () => {
const result = await highlightBrowserText.execute({ text: 'introuvable' })
expect(result).toMatch(/Echec/)
})
})
describe('navigate_browser', () => {
it('should refuse an empty URL', async () => {
await expect(navigateBrowser.execute({ url: '' })).rejects.toThrow(/url manquante/)
})
it('should navigate and report the page title', async () => {
const result = await navigateBrowser.execute({ url: 'https://example.com' })
expect(result).toMatch(/Titre de la page/)
})
})
describe('read_browser_page', () => {
it('should return the page text', async () => {
const result = await readBrowserPage.execute({})
expect(result).toBe('Contenu de la page')
})
it('should report an empty/unreadable page', async () => {
readPageText.mockResolvedValueOnce('')
const result = await readBrowserPage.execute({})
expect(result).toMatch(/vide ou n'a pas pu/)
})
})