- AutoGLM-GUI is an AI-driven Android automation project with a Python backend and separate frontend/electron apps.
- Backend code lives in
AutoGLM_GUI/(API entrypoint examples:AutoGLM_GUI/api/__init__.py, CLI entry:AutoGLM_GUI/__main__.py). - Web frontend lives in
frontend/(entry:frontend/src/main.tsx), desktop packaging lives inelectron/. - Build/lint orchestration scripts are in
scripts/(scripts/lint.py,scripts/build.py,scripts/build_electron.py). - Tests are in
tests/andtests/integration/(example:tests/test_metrics.py,tests/integration/test_agent_integration.py).
- Required Python:
>=3.10(frompyproject.toml). - Required Node/pnpm: Node.js
18+andpnpm(fromCONTRIBUTING.md); CI commonly runs Node24(from.github/workflows/pr-lint.yml). - Required tools:
uv(dependency sync and task runner),adbin PATH (fromCONTRIBUTING.md). - Install backend dependencies (repo root):
uv sync - Install frontend dependencies:
cd frontend && pnpm install - Optional Electron dependencies (when working on desktop app):
cd electron && pnpm install - Start backend dev server:
uv run autoglm-gui --base-url http://localhost:8080/v1 --reload - Start frontend dev server:
cd frontend && pnpm dev
- Quick (backend only, check mode):
uv run python scripts/lint.py --backend --check-only - Quick (frontend only, check mode):
uv run python scripts/lint.py --frontend --check-only - Full (check mode):
uv run python scripts/lint.py --check-only
- Full auto-fix (backend + frontend):
uv run python scripts/lint.py - Backend format check:
uv run ruff format --check --diff - Backend format apply:
uv run ruff format - Frontend format check:
cd frontend && pnpm format:check - Frontend format apply:
cd frontend && pnpm format
- Backend typecheck:
uv run pyright AutoGLM_GUI/ - Frontend typecheck:
cd frontend && pnpm type-check
- TODO: 未找到“仅单元测试”的专用命令(已检查
README.md、CONTRIBUTING.md、pyproject.toml、tests/、.github/workflows/integration-tests.yml)。
- Integration tests (CI uses this):
uv run pytest -v - Docker e2e (specific file):
uv run pytest tests/integration/test_docker_e2e.py -v -s
- Build frontend + copy to backend static:
uv run python scripts/build.py - Build package (includes wheel build):
uv run python scripts/build.py --pack - Frontend-only build path:
cd frontend && pnpm build - Electron app build (CI mode):
uv run python scripts/build_electron.py --publish never - Docker compose runtime (deploy-style):
docker-compose up -d
- Prefer minimal, localized changes; follow existing patterns in nearby files.
- Reuse existing scripts in
scripts/instead of introducing parallel tooling. - Keep backend/frontend boundaries clear (
AutoGLM_GUI/vsfrontend/). - Add or update tests near changed logic when feasible (examples in
tests/andtests/integration/).
- Don’t perform broad refactors unrelated to the task.
- Don’t introduce new dependencies/toolchains if existing
uv/pnpmscripts already solve the problem. - Don’t change public API/CLI behavior (e.g.,
autoglm-guioptions) unless explicitly requested. - Don’t edit CI workflow semantics unless the task is CI-related.
- Understand scope first: read relevant module + one existing similar implementation.
- Make the smallest viable change in-place.
- Run minimal verification before full verification.
- Summarize what changed, what was run, and remaining risk.
Recommended minimal verification set:
- Python-only changes:
uv run python scripts/lint.py --backend --check-only - Frontend-only changes:
uv run python scripts/lint.py --frontend --check-only - Cross-cutting or risky changes:
uv run python scripts/lint.py --check-only+uv run pytest -v
- Ask first: target scope, compatibility constraints, and whether behavior/API changes are allowed.
- Propose a short plan before coding:
- Step 1: confirm files to touch.
- Step 2: implement minimal patch.
- Step 3: run agreed verification commands.
- Step 4: report diff + validation results + follow-up options.