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
+5
View File
@@ -0,0 +1,5 @@
import type { SkillDefinition } from '../types'
import { searchWeb } from './searchWeb'
// Recherche web, independante de l'OS, commune a toutes les plateformes.
export const webSkills: SkillDefinition[] = [searchWeb]
@@ -0,0 +1,57 @@
import * as cheerio from 'cheerio'
import type { SkillDefinition } from '../types'
import { asString } from '../argUtils'
function resolveRealUrl(ddgHref: string | undefined): string | null {
if (!ddgHref) return null
try {
const url = new URL(ddgHref.startsWith('//') ? `https:${ddgHref}` : ddgHref)
return url.searchParams.get('uddg') ?? ddgHref
} catch {
return ddgHref
}
}
export const searchWeb: SkillDefinition = {
name: 'search_web',
description:
"Fait une vraie recherche web et renvoie les premiers resultats reels (titre, extrait et URL exacte) que tu peux lire et resumer. A utiliser pour toute information recente/actuelle que tu ne connais pas avec certitude, et pour trouver l'URL exacte d'un site avant de l'ouvrir avec navigate_browser (ne jamais deviner un nom de domaine). Ne jamais decrire un faux processus de recherche ou inventer un resultat : appelle cette fonction et base ta reponse uniquement sur ce qu'elle renvoie.",
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: 'Termes de recherche' }
},
required: ['query']
},
execute: async (args) => {
const query = asString(args.query).trim()
if (!query) throw new Error('query manquante')
const response = await fetch(
`https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`,
{
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36'
}
}
)
if (!response.ok) throw new Error(`Recherche web echouee (${response.status})`)
const $ = cheerio.load(await response.text())
const results: string[] = []
$('.result.web-result .result__body').each((_, el) => {
if (results.length >= 5) return
const title = $(el).find('.result__title').text().trim().replace(/\s+/g, ' ')
const snippet = $(el).find('.result__snippet').text().trim().replace(/\s+/g, ' ')
const url = resolveRealUrl($(el).find('.result__a').attr('href'))
if (!title) return
const parts = [title, url, snippet].filter(Boolean)
results.push(parts.join(' — '))
})
if (results.length === 0) return 'Aucun resultat trouve pour cette recherche.'
return results.join('\n')
}
}