From 91ed64aa3e87d31de9e2033a14f4025c7d5599ac Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 22 Aug 2026 05:20:11 +0000 Subject: [PATCH] Add Cloud Agent dev environment setup for auto-coder - Add .cursor/environment.json and .cursor/install.sh (venv-based idempotent install that exposes CLI entry points on PATH) - Pin setuptools<81 (newer versions drop pkg_resources, which autocoder still imports) and add missing runtime deps: pandas, sqlmodel, psutil - Allow the two .cursor env files through .gitignore Co-authored-by: WilliamZhu --- .cursor/environment.json | 4 +++ .cursor/install.sh | 55 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 4 ++- requirements.txt | 6 ++++- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .cursor/environment.json create mode 100755 .cursor/install.sh diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 00000000..9fd78189 --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1,4 @@ +{ + "name": "auto-coder", + "install": "bash .cursor/install.sh" +} diff --git a/.cursor/install.sh b/.cursor/install.sh new file mode 100755 index 00000000..fc344dbf --- /dev/null +++ b/.cursor/install.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# Idempotent Cloud Agent install for auto-coder. +# Creates an isolated virtualenv (avoids conflicts with Debian-managed system +# Python packages), installs runtime dependencies plus the package in editable +# mode, and exposes the console scripts on PATH via /usr/local/bin symlinks. +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$REPO_ROOT" + +VENV="${AUTOCODER_VENV:-$HOME/autocoder-venv}" + +# System libraries required by some Python deps (cairosvg -> libcairo, +# pdf2image -> poppler, pydub/audio -> ffmpeg). apt-get install is idempotent. +if command -v apt-get >/dev/null 2>&1; then + SUDO="" + if [ "$(id -u)" -ne 0 ]; then SUDO="sudo"; fi + $SUDO apt-get update -qq || true + $SUDO apt-get install -y -qq --no-install-recommends \ + python3-venv python3.12-venv \ + libcairo2 libcairo2-dev poppler-utils ffmpeg pkg-config || true +fi + +# Create the virtualenv if it does not already exist. +if [ ! -x "$VENV/bin/python" ]; then + python3 -m venv "$VENV" +fi + +# Note: setuptools is intentionally NOT upgraded here; requirements.txt pins it +# to <81 because autocoder imports the removed pkg_resources API. +"$VENV/bin/python" -m pip install --upgrade pip wheel +"$VENV/bin/pip" install -r requirements.txt +"$VENV/bin/pip" install -e . + +# Developer tooling used by the repo's test scripts (scripts/run_test.sh, +# pytest.ini) but not part of the runtime requirements. +"$VENV/bin/pip" install pytest + +# Expose the CLI entry points on PATH without shell-profile mutation. +SCRIPTS=( + auto-coder auto-coder.core chat-auto-coder auto-coder.chat + auto-coder-serve auto-coder.serve auto-coder.rag + auto-coder.run auto-coder.cli +) +if [ -w /usr/local/bin ] || command -v sudo >/dev/null 2>&1; then + LN_SUDO="" + if [ ! -w /usr/local/bin ]; then LN_SUDO="sudo"; fi + for s in "${SCRIPTS[@]}"; do + if [ -x "$VENV/bin/$s" ]; then + $LN_SUDO ln -sf "$VENV/bin/$s" "/usr/local/bin/$s" + fi + done +fi + +echo "auto-coder install complete: $("$VENV/bin/pip" show auto-coder 2>/dev/null | awk '/^Version:/{print $2}')" diff --git a/.gitignore b/.gitignore index bf78b598..f14c6a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -68,7 +68,9 @@ notebooks/generated_image.png /examples/test_project /package-lock.json/ .windsurfrules -.cursor +.cursor/* +!.cursor/environment.json +!.cursor/install.sh .auto-coder/ diff --git a/requirements.txt b/requirements.txt index 6b78d25a..847653fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -89,6 +89,10 @@ SpeechRecognition pathvalidate pexpect mcp ; python_version >= '3.10' -setuptools +# setuptools>=81 removes the pkg_resources API that autocoder still imports. +setuptools<81 filelock argcomplete +pandas +sqlmodel +psutil