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,88 @@
import { describe, it, expect } from 'vitest'
import { validateModuleContent, missingContentSections } from '../../src/main/coach/coachStore'
function buildValidContent(): string {
return [
'Accroche',
'Un vendeur doit calculer rapidement combien de tissu acheter pour couvrir un mur triangulaire. '.repeat(
16
),
'Developpement theorique',
'Idee centrale, analogie, definition formelle, exemple resolu et contre-exemple. '.repeat(35),
'Phase guidee',
'ETAPE 1 : identifier les donnees. ETAPE 2 : appliquer la formule. ETAPE 3 : verifier le resultat.',
'Exercices progressifs',
'EXERCICE 1 facile. EXERCICE 2 facile. EXERCICE 3 moyen. EXERCICE 4 moyen. EXERCICE 5 difficile. EXERCICE 6 difficile.',
'Exercice de debogage',
"Trouve l'erreur dans ce calcul errone et corrige-la.",
'Synthese',
'Resume final avec question de meta-cognition et test Feynman. '.repeat(15)
].join('\n\n')
}
describe('missingContentSections()', () => {
it('should return every required section when content is empty', () => {
const missing = missingContentSections('')
expect(missing).toContain('Accroche')
expect(missing).toContain('Synthese')
expect(missing.length).toBe(6)
})
it('should return no missing section when all section headers are present', () => {
expect(missingContentSections(buildValidContent())).toEqual([])
})
})
describe('validateModuleContent()', () => {
it('should accept well-structured content meeting all requirements', () => {
expect(validateModuleContent(buildValidContent())).toEqual([])
})
it('should reject content with missing sections', () => {
const violations = validateModuleContent('Accroche\nTrop court.')
expect(violations.length).toBeGreaterThan(0)
expect(violations[0]).toMatch(/Sections manquantes/)
})
it('should accept accented "ETAPE"/"EXERCICE" headers (regression: accent-insensitive match)', () => {
const content = buildValidContent().replace('ETAPE', 'ÉTAPE').replace('EXERCICE', 'ÉXERCICE')
expect(validateModuleContent(content)).toEqual([])
})
it('should reject a "Phase guidee" section with fewer than 3 numbered steps', () => {
const content = buildValidContent().replace(
'ETAPE 1 : identifier les donnees. ETAPE 2 : appliquer la formule. ETAPE 3 : verifier le resultat.',
'ETAPE 1 : identifier les donnees.'
)
const violations = validateModuleContent(content)
expect(violations.some((v) => /Phase guidee/.test(v))).toBe(true)
})
it('should reject an "Exercices progressifs" section with fewer than 6 numbered exercises', () => {
const content = buildValidContent().replace(
'EXERCICE 1 facile. EXERCICE 2 facile. EXERCICE 3 moyen. EXERCICE 4 moyen. EXERCICE 5 difficile. EXERCICE 6 difficile.',
'EXERCICE 1 facile. EXERCICE 2 moyen.'
)
const violations = validateModuleContent(content)
expect(violations.some((v) => /Exercices progressifs/.test(v))).toBe(true)
})
it('should reject an "Exercice de debogage" section that never mentions an error', () => {
const content = buildValidContent().replace(
"Trouve l'erreur dans ce calcul errone et corrige-la.",
'Resous ce calcul.'
)
const violations = validateModuleContent(content)
expect(violations.some((v) => /debogage/.test(v))).toBe(true)
})
it('should reject a section shorter than its required minimum word count', () => {
const shortAccroche =
'Un vendeur doit calculer rapidement combien de tissu acheter pour couvrir un mur triangulaire. '.repeat(
16
)
const content = buildValidContent().replace(shortAccroche, 'Phrase courte.')
const violations = validateModuleContent(content)
expect(violations.some((v) => /Accroche.*trop courte/.test(v))).toBe(true)
})
})