From 6249e014198afeca994ab9791cb72106dbedce4b Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Sun, 3 May 2026 00:37:22 +0200 Subject: [PATCH] docs(compile): adopta layout local_files/ + enrichers/ + runtime/ Python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actualiza /compile para que el deploy a Desktop/apps// siga la convencion local_files/ del framework: - Copia .exe + ttfs + dlls junto al exe (read-only). - Copia /enrichers/ si existe (excluyendo pycache). - Copia /runtime/ si app.md declara python_runtime: true. Regenera el runtime via tools/freeze_python_runtime.sh windows cuando app.md es mas nuevo que runtime/.lock. - NUNCA toca local_files/ del destino — contiene estado del usuario (DBs, ini, proyectos) que NO se debe perder al recompilar. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/commands/compile.md | 44 +++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/.claude/commands/compile.md b/.claude/commands/compile.md index 873f3378..7d43eca6 100644 --- a/.claude/commands/compile.md +++ b/.claude/commands/compile.md @@ -101,7 +101,18 @@ Si el target no existe en CMake (porque la app no esta registrada en `cpp/CMakeL ### 4. Copiar a `/mnt/c/Users/lucas/Desktop/apps//` -Replica el flujo documentado en memoria (`feedback_no_adminlocal.md`): el `.exe` + las TTFs de fuentes que el shell ImGui necesita. NO usar `AdminLocal`. +Layout estandar (convencion `local_files/`, ver `cpp_apps.md` §7): + +``` +Desktop/apps// +├── .exe ← binario +├── *.ttf, *.dll ← fuentes + DLLs (junto al exe) +├── assets/ ← opcional, copiada del build +├── enrichers/ ← opcional, si /enrichers existe +├── runtime/ ← opcional, si app.md tiene python_runtime: true +└── local_files/ ← creado por la app al primer arranque + NUNCA borrar al recompilar +``` ```bash DEST="/mnt/c/Users/lucas/Desktop/apps/$APP_ARG" @@ -113,19 +124,38 @@ if [ ! -f "$EXE_SRC" ]; then exit 1 fi +# 1. Binario + TTFs + DLLs (junto al exe del build, copiados por add_imgui_app). cp -v "$EXE_SRC" "$DEST/" +find "$BUILD_WIN/apps/$APP_ARG" -maxdepth 1 -type f \ + \( -name '*.ttf' -o -name '*.dll' \) -exec cp -v {} "$DEST/" \; -# TTFs (estan junto al exe tras el build, copiados por add_imgui_app) -for ttf in "$BUILD_WIN/apps/$APP_ARG"/*.ttf; do - [ -f "$ttf" ] && cp -v "$ttf" "$DEST/" -done - -# Assets opcionales (carpeta assets/ junto al exe del build) +# 2. assets/ del build (opcional). if [ -d "$BUILD_WIN/apps/$APP_ARG/assets" ]; then rsync -a --delete "$BUILD_WIN/apps/$APP_ARG/assets/" "$DEST/assets/" fi +# 3. enrichers/ del app_dir (opcional). Excluye __pycache__ + .pyc. +if [ -d "$APP_DIR/enrichers" ]; then + rsync -a --delete --exclude '__pycache__' --exclude '*.pyc' \ + "$APP_DIR/enrichers/" "$DEST/enrichers/" +fi + +# 4. runtime/ Python embebido (si la app lo declara). +# Lee `python_runtime: true` del frontmatter de app.md. +if grep -q '^python_runtime:[[:space:]]*true' "$APP_DIR/app.md" 2>/dev/null; then + if [ ! -d "$APP_DIR/runtime/python" ] || \ + [ "$APP_DIR/app.md" -nt "$APP_DIR/runtime/.lock" ]; then + echo "[freeze] regenerando runtime Python (Windows) para $APP_ARG" + "$APP_DIR/tools/freeze_python_runtime.sh" "$APP_DIR" windows + fi + rsync -a --delete --exclude '__pycache__' --exclude '*.pyc' \ + "$APP_DIR/runtime/" "$DEST/runtime/" +fi + +# 5. NO TOCAR local_files/. Si existe en $DEST, preservar — contiene +# estado del usuario (DBs, settings, layouts ImGui, proyectos). echo "OK: $APP_ARG -> $DEST" +[ -d "$DEST/local_files" ] && echo " local_files/ preservado: $(du -sh "$DEST/local_files" | cut -f1)" ``` ### 5. Compilar Android (solo si TARGETS contiene `android`)