Skip to main content

CLI to sync GUAP student lab tasks, manage local folders, and submit PDF reports.

Project description

🎓 guap-lab-auto

Unofficial CLI for GUAP students — sync tasks from pro.guap.ru, mirror them into local folders, track state in YAML, convert DOCX → PDF, and submit reports via Playwright.

This repository also ships an AgentSkills skill (guap-lab-workflow) so coding agents (OpenClaw, Hermes, Cursor, etc.) run lab-auto commands against your workspace instead of scraping GUAP in the browser themselves.

English · Русский

⚠️ Not affiliated with GUAP. HTML on the portal can change and break parsers. Use at your own risk.

📦 PyPI guap-lab-auto
⌨️ Command lab-auto
🤖 Agent skill guap-lab-workflowskills/guap-lab-workflow/
🐍 Python 3.11+
🌐 Portal https://pro.guap.ru/inside/student/tasks/

✨ Features

  • 🔄 Sync — scrape task list (100 rows/page), update state/works.yaml, rename labs/<subject>/[STATUS] …/ folders
  • 📥 Downloadstask.pdf (assignment); reports/site-report-<id>.pdf on first sync when GUAP has a submission (не принят / ожидает проверки / принят)
  • 🏷️ Status mapping — GUAP labels → [UNDONE] / [REFACTOR] / [SENT] / [DONE] / [UNKNOWN]; local-only [REVIEW] / [SENTFAILED]
  • 📋 State filesworks.yaml, summary.md, needs_review.md, append-only logs
  • 🔐 Session — Fernet-encrypted Playwright storage_state; SSO via auth login (headed browser)
  • 📄 Convert — DOCX → PDF (LibreOffice / Windows Word)
  • 📤 Submit — upload PDF on task detail page after [REVIEW]
  • 🗄️ Archivesync --archive or archive / unarchive for tasks gone from the list
  • 🤖 Bundled agent skillskills/guap-lab-workflow/ documents commands, workspace layout, and guardrails so agents invoke lab-auto correctly

🤖 Agent skill (guap-lab-workflow)

The CLI is the only supported integration surface for automation. The skill teaches agents which lab-auto subcommands to run, where works.yaml and lab folders live, and when human login or explicit approval is required (e.g. no unsupervised submit).

Path Purpose
skills/guap-lab-workflow/SKILL.md Main skill — workflow, prerequisites, rules
skills/guap-lab-workflow/references/ Command cheat sheet, OpenClaw/Hermes notes
.agents/skills/guap-lab-workflow/ Copy for Cursor / compatible agent loaders
AGENTS.md Maintainer-oriented agent guide for this repo
docs/integrations/ OpenClaw & Hermes setup

Requirements for agents: lab-auto on PATH, Chromium (playwright install chromium), and a configured workspace. The skill does not replace the CLI — it orchestrates it.

Install the skill

# Linux / macOS — copies into OpenClaw workspace and ~/.hermes/skills/
./scripts/install-agent-skills.sh

# Windows
.\scripts\install-agent-skills.ps1

Or symlink / copy skills/guap-lab-workflow/ into your agent’s skills directory manually.

Agent Invoke after install
OpenClaw /guap-lab-workflow (slash command)
Hermes /guap-lab-workflow or hermes -s guap-lab-workflow
Cursor Load via .agents/skills/ or project rules pointing at the skill

Example configs: examples/openclaw.json.example, examples/hermes-skills.example.yaml.


🚀 Quick start

Install

pip install guap-lab-auto
playwright install chromium
uv tool install guap-lab-auto
playwright install chromium

First run

lab-auto workspace set ~/guap-labs
lab-auto auth login
lab-auto auth check
lab-auto sync
lab-auto status

auth login uses a visible Chromium window; sync, submit, and auth check run headless.


📁 Workspace

User data stays outside the package:

workspace/
├── labs/
│   └── <subject>/
│       └── [SENT] Lab title [178541]/
│           ├── task.pdf
│           └── reports/
│               └── site-report-5283063.pdf
├── state/
│   ├── works.yaml
│   ├── summary.md
│   └── needs_review.md
├── session/
│   └── storage_state.json    # encrypted
└── logs/

Root resolution: --rootLAB_AUTO_ROOTlab-auto workspace set → current directory.

Platform Config
Windows %APPDATA%\lab-auto\config.yaml
Linux / macOS ~/.config/lab-auto/config.yaml

Session key: %APPDATA%\lab-auto\session.key or ~/.config/lab-auto/session.key.


⌨️ Commands

Typer help: lab-auto --help, lab-auto auth --help, lab-auto <command> --help.

Globals: --root / LAB_AUTO_ROOT, -v / --verbose.

📂 Workspace

Command Description
workspace set <path> Save default workspace directory
workspace show Print active + saved workspace and config path
workspace unset Clear saved default

🔑 Auth

Command Description
auth login SSO in headed browser; save encrypted session
auth check Headless check: can open task list
auth import-cookie <file> Import Playwright storage JSON or cookie list
auth migrate-session Re-wrap legacy plaintext session as encrypted
auth logout Remove session/storage_state.json

🔄 Workflow

Command Description
sync Fetch list + details; merge works.yaml; download missing PDFs
sync --archive Mark tasks removed from site as archived: true instead of dropping
status Print active works grouped by subject
status --all Include archived rows
review <id> Set local status [REVIEW] and rename folder
convert <id> --docx PATH DOCX → PDF (--output optional)
submit <id> --file PATH Upload PDF; set [SENT] or [SENTFAILED]
archive <id> archived: true, hide from default status
unarchive <id> Restore to active list

<id>: task-178541 or a unique substring of the folder title.

Typical sequence: sync → edit report in work folder → reviewconvertsubmitsync.


🏷️ Folder statuses

Prefix GUAP / local
[UNDONE] Status column (not submitted)
[REFACTOR] не принят
[SENT] ожидает проверки
[DONE] принят
[UNKNOWN] Any other portal status string
[REVIEW] Local only — you marked ready to check
[SENTFAILED] Local only — last submit failed

IDs: work_id = task-<site_id>; folder = [STATUS] <title> [<site_id>].

sync renames folders when mapped status changes. Report import runs once per work when reports/ is empty and site status is не принят, ожидает проверки, or принят.


🔐 Session

  • Password is prompted once in auth login and not written to disk.
  • Cookies: workspace/session/storage_state.json (encrypted wrapper).
  • auth migrate-session upgrades old plaintext exports.

🧪 Development

git clone https://github.com/R3LCH/lab_auto.git
cd lab_auto
python -m venv .venv
# Windows: .\.venv\Scripts\Activate.ps1
# Unix:    source .venv/bin/activate
pip install -e ".[dev]"
playwright install chromium
pytest

Live tests (network + saved session):

export LAB_AUTO_ROOT=~/guap-labs
pytest -m live

Fixtures

Default: synthetic HTML in tests/conftest.py. Optional local capture (gitignored):

python scripts/capture_guap_fixtures.py --task-url "https://pro.guap.ru/inside/student/tasks/<id>"

Do not commit tests/fixtures/task_list.html or task_detail.html. See tests/fixtures/README.md.

🤖 Agent skill source lives under skills/guap-lab-workflow/ — see AGENTS.md when changing CLI behavior agents depend on.


📜 License

MIT — LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guap_lab_auto-0.1.2.tar.gz (79.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guap_lab_auto-0.1.2-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file guap_lab_auto-0.1.2.tar.gz.

File metadata

  • Download URL: guap_lab_auto-0.1.2.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for guap_lab_auto-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a489b2a75f7e6ea444040939fd00c69c6589797011ffb336830e458cdea7964f
MD5 72f95faaa3f23c18cc43c9b1792294ef
BLAKE2b-256 da0b4cb3282a69dbbf49fe4729b75880d4124bc1bd34214c4d48bb616d89c828

See more details on using hashes here.

File details

Details for the file guap_lab_auto-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: guap_lab_auto-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 37.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for guap_lab_auto-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5e252356157ea6bd49cf41471071c1578725d657b2e30da6c5c4c1d4345f5da9
MD5 34a9a351aee0f32af126d6660218a620
BLAKE2b-256 609263bee33714edc5247e39885c7dec773cc28a7b7bae69e3d7418fbe3a1bb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page