diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 00000000..9fba742f --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1,4 @@ +{ + "name": "EcuBus-Pro", + "install": "bash .cursor/install.sh" +} diff --git a/.cursor/install.sh b/.cursor/install.sh new file mode 100755 index 00000000..8c107d41 --- /dev/null +++ b/.cursor/install.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Idempotent Cloud Agent bootstrap for EcuBus-Pro. +# Refreshes JS deps, the embedded standalone Python used for ODX/CDD/DBC +# parsing, the Linux native module stubs, and the bundled worker scripts. +set -euo pipefail + +cd "$(dirname "$0")/.." + +# Pinned to match .github/actions/setup-python-build/action.yml +PY_RELEASE="20260211" +PY_VERSION="3.13.12" +PY_ARCHIVE="cpython-${PY_VERSION}+${PY_RELEASE}-x86_64-unknown-linux-gnu-install_only.tar.gz" +PY_URL="https://github.com/astral-sh/python-build-standalone/releases/download/${PY_RELEASE}/${PY_ARCHIVE}" +PYTHON_BIN="resources/python/bin/python3" + +echo "==> npm install" +npm install + +if [ ! -x "$PYTHON_BIN" ]; then + echo "==> Downloading standalone Python ${PY_VERSION}" + tmp="$(mktemp -d)" + curl -fsSL -o "${tmp}/python.tar.gz" "$PY_URL" + mkdir -p resources + tar -xzf "${tmp}/python.tar.gz" -C resources + rm -rf "$tmp" +else + echo "==> Standalone Python already present, skipping download" +fi + +echo "==> Installing Python requirements" +"$PYTHON_BIN" -m pip install -r resources/requirements.txt + +echo "==> Building native modules (Linux stubs)" +npm run native + +echo "==> Building worker scripts" +npm run worker:js + +echo "==> Install complete" diff --git a/AGENTS.md b/AGENTS.md index 49afead0..4385f3de 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,4 +103,4 @@ This section captures non-obvious, durable notes for developing EcuBus-Pro in a **Running the GUI:** This is an Electron desktop app. Run it with `DISPLAY=:1 npm run dev` (a headless X server is already running on display `:1`). It launches without extra `--no-sandbox` flags. The `Autofill.enable`/`Autofill.setAddresses` DevTools console errors at startup are harmless. -**Known pre-existing test failures on Linux (not environment issues):** There is no CI job that runs the Vitest suite, so some tests only pass on the original author's setup. `test/util/s19Parse.spec.ts > ok1` reads `./CMSIS-DAP_OpenSDA.s19` but the committed fixture is `CMSIS-DAP_OpenSDA.S19` (case mismatch, fails on case-sensitive Linux filesystems). One `test/odx` assertion (`subfunc as first param`) is sensitive to the installed `odxtools` version. Hardware-backed suites under `test/docan`, `test/dolin`, `test/pwm`, `test/sa_dll` require physical devices and are expected to fail/skip. For a quick smoke run of hardware-independent tests: `npm run test -- --run test/util test/dbc test/odx test/viewer test/cdd test/encoding`. +**Known pre-existing test failures on Linux (not environment issues):** There is no CI job that runs the Vitest suite, so some tests only pass on the original author's setup. `test/util/s19Parse.spec.ts > ok1` reads `./CMSIS-DAP_OpenSDA.s19` but the committed fixture is `CMSIS-DAP_OpenSDA.S19` (case mismatch, fails on case-sensitive Linux filesystems). `test/dbc/dbc.test.ts > id2001.dbc` has the same problem: it reads `id2001.dbc` but the committed fixture is `ID2001.dbc`. One `test/odx` assertion (`subfunc as first param`) is sensitive to the installed `odxtools` version. Hardware-backed suites under `test/docan`, `test/dolin`, `test/pwm`, `test/sa_dll` require physical devices and are expected to fail/skip. For a quick smoke run of hardware-independent tests: `npm run test -- --run test/util test/dbc test/odx test/viewer test/cdd test/encoding`.