# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## What is BioLab BioLab Parameter Explorer is a scientific web application that estimates kinetic parameters for microbial growth and substrate consumption models. Given time-series measurements of biomass (cells, g/L) and residual substrate (g/L), it runs Particle Swarm Optimization (PSO) over seven built-in kinetic models and ranks them by the Akaike Information Criterion (AIC). The app is packaged with Apache Cordova and targets Electron (desktop), Android, and Browser. ## Commands ### Tests (run from `www/`) ```sh cd www && node tests/demo.mjs cd www && node tests/synthetic-search.mjs # or both at once: cd www && npm test ``` Tests use Node.js directly — no test runner or build step needed. ### Run / build (Electron) ```sh nix-shell --run "cordova run electron" # dev run ``` Release build produces an AppImage (Linux) in two steps — cordova-electron bundles electron-builder v24 which ignores the Linux target, so electron-builder v26 from devDependencies is called directly: ```sh nix-shell --run "cordova build electron --release" # prepare platform nix-shell --run "node_modules/.bin/electron-builder --linux AppImage --config res/electron/build.json" # output: platforms/electron/build/BioLab-1.0.0.AppImage ``` ### Build release APK (Android) Signing keys are managed via agenix (`android-signing-env`). Use `--packageType=apk` to force APK output instead of AAB: ```sh android-signing-env python3 -c " import json, os cfg = {'android': {'release': { 'keystore': os.environ['ANDROID_KEYSTORE_PATH'], 'keystoreType': 'pkcs12', 'alias': os.environ['ANDROID_KEY_ALIAS'], 'storePassword': os.environ['ANDROID_KEYSTORE_PASSWORD'], 'password': os.environ['ANDROID_KEY_PASSWORD'] }}} open('/tmp/biolab-build.json','w').write(__import__('json').dumps(cfg)) " nix-shell --run "ANDROID_HOME=\$HOME/Android/Sdk ANDROID_SDK_ROOT=\$HOME/Android/Sdk \ GRADLE_USER_HOME=\$(pwd)/.gradle \ cordova build android --release --buildConfig /tmp/biolab-build.json -- --packageType=apk" rm /tmp/biolab-build.json # output: platforms/android/app/build/outputs/apk/release/app-release.apk ``` ### Build release .exe (Windows VM) ```sh # VM: user@192.168.122.187, cordova global at C:\Users\User\AppData\Roaming\npm\cordova.cmd ssh user@192.168.122.187 "cd C:\\Users\\user\\BioLab && git pull && C:\\Users\\User\\AppData\\Roaming\\npm\\cordova.cmd build electron --release" scp "user@192.168.122.187:C:/Users/user/BioLab/platforms/electron/build/BioLab Setup 1.0.0.exe" /tmp/ # output: /tmp/BioLab Setup 1.0.0.exe ``` ### Run on Android (dev) ```sh # Set up environment first (or source env.sh): source env.sh # env.sh sets ANDROID_HOME, ANDROID_SDK_ROOT, PATH entries for the SDK, # and isolates Gradle cache to ./.gradle, then calls `cordova run android`. ``` ### Serve in browser ```sh cordova run browser # or just open www/index.html via any static file server ``` ## Architecture ``` www/ index.html — single-page app; all UI logic is an inline