yanhekt-course-sync
/yanhekt-course-sync
Sync course materials, homework attachments and exam info from the Beijing Institute of Technology LMS (Yanhe Classroom / 延河课堂, zy-eclass.bit.edu.cn) into a local folder tree, and set up scheduled re-syncs. Use whenever the user wants to fetch or update course files, homework PDFs, deadlines or exam schedules from their LMS, or asks why a course has no files. Built on the `yhkt` CLI in this repo. Only the one-time SSO login is a human step; the agent drives everything else.
- Author
- cyancloudyang ↗
- Repository
- bit-yanhekt-sync ↗
- Licence
- MIT
- Last repository change
- 07.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 07.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Sync course materials, homework attachments and exam info from the Beijing Institute of Technology LMS (Yanhe Classroom / 延河课堂, zy-eclass.bit.edu.cn) into a local folder tree, and set up scheduled re-syncs. Use whenever the user wants to fetch or update course files, homework PDFs, deadlines or exam schedules from their LMS, or asks why a course has no files. Built on the `yhkt` CLI in this repo. Only the one-time SSO login is a human step; the agent drives everything else.
Original author description
Sync course materials, homework attachments and exam info from the Beijing Institute of Technology LMS (Yanhe Classroom / 延河课堂, zy-eclass.bit.edu.cn) into a local folder tree, and set up scheduled re-syncs. Use whenever the user wants to fetch or update course files, homework PDFs, deadlines or exam schedules from their LMS, or asks why a course has no files. Built on the `yhkt` CLI in this repo. Only the one-time SSO login is a human step; the agent drives everything else.
How it works
- Pre-conditions (check before promising results)
- Agent state you may or may not have — handle all cases
- Bootstrap (fresh environment)
- Command reference
- Scheduling recurring syncs
- Verification (run after every sync, evidence before claims)
- Gotchas
- Legal / etiquette
SKILL.md preview
--- name: yanhekt-course-sync description: >- Sync course materials, homework attachments and exam info from the Beijing Institute of Technology LMS (Yanhe Classroom / 延河课堂, zy-eclass.bit.edu.cn) into a local folder tree, and set up scheduled re-syncs. Use whenever the user wants to fetch or update course files, homework PDFs, deadlines or exam schedules from their LMS, or asks why a course has no files. Built on the `yhkt` CLI in this repo. Only the one-time SSO login is a human step; the agent drives everything else. --- # Yanhe Classroom (BIT LMS) Course Sync Sync **course materials (slides/PDFs), homework attachments and exam schedule JSON** from `https://zy-eclass.bit.edu.cn` into: ``` <root>/<course_id>_<course_name>/ materials/ # lecture slides & readings (named "<Activity Title>__<File Name>.<ext>") homework/ # assignment files exams/exams.json .yhkt_manifest.json # idempotent sync state (sha256 per file) ``` ## Pre-conditions (check before promising results) 1. Python ≥ 3.10 and `uv` installed (see `scripts/setup.sh` for bootstrap). 2. A Chrome/Chromium build for the **dedicated sync browser** (isolated profile). `scripts/launch-chrome.sh` starts it with CDP on port 9333. 3. The human user must log into `https://zy-eclass.bit.edu.cn` **once** in that window (unified identity / CAS SSO). Cookies are harvested from there via CDP — the LMS session cookie is httpOnly, so it cannot be typed in or obtained without a browser. **Never guess, ask-for-and-store, or automate SSO credentials.** If login is required, hand the browser window to the user and wait. 4. The user is enrolled in the courses (this tool only reads what their own LMS account can see). ## Agent state you may or may not have — handle all cases | Situation | What to do | |---|---| | **Fresh agent, no env** | Run full bootstrap below (steps 1–4). Do not assume uv/Chrome/cookies exist. | | **Experienced agent** | Reuse the existing cookie file (`~/.config/yhkt/cookies.json` by default); verify with `yhkt check` before syncing; register a scheduled re-sync (cron or agent-native scheduler) only after the first successful run. | | **User new to the LMS** | Walk them through the one-time login (step 3 above). Explain that sessions expire (typically ~a day); on expiry the fix is re-login + `yhkt grab-cookie`, nothing is lost. | | **User experienced with the LMS** | Skip education; just confirm the dedicated Chrome is logged in (`yhkt check`), then sync. | | **User already keeps a course directory tree** | Pass that tree (or a sub-folder of it) as `--root`. Content dedupe is ON by default: files whose content already lives in that tree are **not** re-saved — the LMS tree then holds only new/changed items, so it never doubles the user's storage. | | **No course directory yet** | Use the default root (`~/bit-yanhekt`) or ask the user to pick one (cloud-synced folders like Dropbox/OneDrive are common choices). | ## Bootstrap (fresh environment) ```bash # 1. install deps (creates .venv) bash scripts/setup.sh # 2. launch the dedicated Chrome (no-op if CDP already up on the port) bash scripts/launch-chrome.sh # -> ask the USER to log into https://zy-eclass.bit.edu.cn in that window, then continue # 3. harvest cookies (CDP -> ~/.config/yhkt/cookies.json) yhkt grab-cookie # (or: uv run yhkt grab-cookie from the repo root) # 4. health check: should print "OK: session valid, my courses = N" yhkt check # 5. first sync (pick a root per the table above) yhkt sync --all --root "$HOME/bit-yanhekt" ``` ## Command reference All commands run from the repo root as `yhkt …` (via `uv run yhkt …` before `uv sync`). | Command | Purpose | |---|---| | `yhkt check` | Session health; prints course count. 401/403 → `SessionExpired`. | | `yhkt courses` | Course list: id, name, instructors, dates. | | `yhkt activities <cid>` | Material/homework file inventory (incl. `D`/`-` = download allowed/disallowed, due dates). | | `yhkt exams <cid> [--out F]` | Exam schedule JSON (often `[]` until the instructor publishes). | | `yhkt sync <cid…>` / `yhkt sync --all` | Incremental sync. Flags: `--root DIR`, `--no-dedupe` (force saving every file). | | `yhkt grab-cookie [--port N]` | Re-harvest cookies from the dedicated Chrome. | Output lines during sync: `+ new` / `~ updated` (instructor re-published) / `= unchanged` / `≈ deduped (content already at …)` / `- download disabled` / `! error` (stderr; exit 1 if any). ## Scheduling recurring syncs - Agent-native: a cron/scheduler entry running `bash scripts/run-sync.sh --all` a few times a week. - Plain cron: `0 8 * * 1,5 cd <repo> && bash scripts/run-sync.sh --all >> ~/yhkt-sync.log 2>&1` - On exit 1 whose stderr says "session expired": notify the user to re-login in the dedicated Chrome and run `yhkt grab-cookie`. The sync itself is idempotent and safe to re-run. ## Verification (run after every sync, evidence before claims) 1. `find <root> -type f -newer <root>/.yhkt_manifest.json 2>/dev/null | head` or just re-list the course sub-trees and confirm the expected files exist with non-zero size. 2. Check the summary line: `done: new X updated Y skipped Z deduped W failed 0` — `failed` must be 0. 3. Spot-check one new file opens (PDF/docx) if the user needs it. ## Gotchas - Signed CDN download URLs are short-lived: always fetch a fresh one per file (the CLI does this); never cache them. - `allow_download=false` files (usually homework **answers** the instructor locked) are skipped by design. - A course showing 0 files is normal if the instructor publishes through a chat app instead of the LMS — check `yhkt activities <cid>` first, don't assume an error. - Course IDs are stable across terms; `my-courses` lists only the current term. - Content dedupe is a name+size heuristic (the LMS publishes no remote hashes): it catches "instructor re-uploaded the same file" and "user already keeps a copy". Same name + *different* size is treated as a new version and downloaded. ## Legal / etiquette Download only materials from courses the user is enrolled in. Respect `allow_download` flags. Do not redistribute course PDFs to people who are not enrolled.
Files in this package (2)
- SKILL.md 6 KB
- references/api-notes.md 2 KB
Versions
The database has no other skills named yanhekt-course-sync.
Database snapshot: 13.11.2026 · package version e0c4a2322da6 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 90lms-query
Query Canvas and Blackboard through lms-cli. Use for finding and connecting schools, courses, announcements, homework, schedules, grades/feedback, messages and course files, connection checks, source-backed local tasks and ICS export. - 100lms-query
Query Canvas and Blackboard through lms-cli. Use for finding and connecting schools, courses, announcements, homework, schedules, grades/feedback, messages and course files, connection checks, source-backed local tasks and ICS export. 查询课程、通知、作业、日程、评分反馈、课程文件,搜索并连接学校,管理本地待办与日历导出。 - 100canvas-student
Work with the Canvas LMS as a student through its REST API, using a bundled zero-dependency Python CLI. It covers courses, grades, assignments and deadlines, the to-do list, planner and calendar, missing work, submitting assignments (text, URL or file uploads), feedback and… - 100canvas-course-builder
Scaffold complete Canvas LMS course structures from specs, templates, or existing courses. Creates modules, pages, assignments, and discussions in bulk. Use when asked to "build a course", "scaffold modules", "create course structure", "set up a new course", or "copy course structure". - 90moodle
Reads the user's Moodle (any Moodle 3.9+ LMS or university e-learning portal, e.g. PWr ePortal) from the terminal. Covers deadlines and overdue work, assignment briefs, submission status and feedback, course materials and files, announcements, forums, grades, calendar and recent… - 100canvas-course-audit
Audit an entire Canvas LMS course against the Four Learning Design Pillars (Clear Structure, Active Content, Continuous Practice, Intuitive UX). Use when users want to evaluate course quality, identify improvement areas, or prepare for course redesign. Requires canvas-mcp server…