Przejdź do treści
Biblioteka skilli
Edukacja · Automatyzacja

yanhekt-course-sync

/yanhekt-course-sync

Synchronizuje materiały, zadania i terminy egzaminów z platformy uczelni BIT do lokalnych folderów i planuje cykliczne odświeżanie.

Licencja
MIT
Ostatnia zmiana repozytorium
07.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
3
Przestarzałość

Brak sygnałów. Repozytorium zmienione 07.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Synchronizuje materiały, zadania i terminy egzaminów z platformy uczelni BIT do lokalnych folderów i planuje cykliczne odświeżanie.

Oryginalny opis (EN)

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.

Jak działa

  1. Pre-conditions (check before promising results)
  2. Agent state you may or may not have — handle all cases
  3. Bootstrap (fresh environment)
  4. Command reference
  5. Scheduling recurring syncs
  6. Verification (run after every sync, evidence before claims)
  7. Gotchas
  8. Legal / etiquette
Sekcje z nagłówków SKILL.md, w oryginale · 102 linii, 895 słów
Podgląd SKILL.md
---
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.
Pliki w paczce (2)
  • SKILL.md 6 KB
  • references/api-notes.md 2 KB

Wersje

W bazie nie ma innych skilli o nazwie yanhekt-course-sync.

Migawka bazy z 13.11.2026 · wersja paczki e0c4a2322da6 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90lms-query
    Przeszukuje Canvas i Blackboard przez lms-cli: kursy, ogłoszenia, zadania, plan zajęć, oceny, wiadomości i pliki oraz eksportuje ICS.
  • 100lms-query
    Odpytuje Canvas i Blackboard przez lms-cli: szuka i łączy szkoły, kursy, ogłoszenia, zadania, harmonogramy, oceny, wiadomości i pliki, a także eksportuje lokalne zadania do ICS.
  • 100canvas-student
    Pracuje z Canvas LMS przez REST API jako student: kursy, oceny, terminy, przesyłanie prac, materiały, dyskusje i skrzynkę wiadomości.
  • 100canvas-course-builder
    Buduje kompletne struktury kursów Canvas LMS ze specyfikacji, szablonów lub istniejących kursów: masowo tworzy moduły, strony, zadania i dyskusje.
  • 90moodle
    Odczytuje z terminala Moodle uczelni: terminy, zadania, oceny, materiały, ogłoszenia i fora, a zmiany wykonuje po zatwierdzeniu podglądu.
  • 100canvas-course-audit
    Audytuje cały kurs w Canvas LMS względem czterech filarów projektowania nauczania i wskazuje obszary do poprawy, z użyciem serwera canvas-mcp.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.