elective
/elective
PKU Course Selection (选课网) CLI tool built in Rust. Use this skill when working on the elective crate, debugging elective commands, adding features, or when the user mentions 选课, elective, course selection, auto-enroll, CAPTCHA solving, dual-degree, or elective.pku.edu.cn. Also use when dealing with CAPTCHA recognition backends (utool/ttshitu/yunma), automated course enrollment loops, or elective SSO callback. **NOT for general course schedule / 课表 / 这学期上什么课 questions — use the `treehole` skill (`treehole course`) instead, which gives a unified weekly grid with 主修+辅修+双学位. The `elective show` co
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 23.10.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
PKU Course Selection (选课网) CLI tool built in Rust. Use this skill when working on the elective crate, debugging elective commands, adding features, or when the user mentions 选课, elective, course selection, auto-enroll, CAPTCHA solving, dual-degree, or elective.pku.edu.cn. Also use when dealing with CAPTCHA recognition backends (utool/ttshitu/yunma), automated course enrollment loops, or elective SSO callback. **NOT for general course schedule / 课表 / 这学期上什么课 questions — use the `treehole` skill (`treehole course`) instead, which gives a unified weekly grid with 主修+辅修+双学位. The `elective show` co
Original author description
PKU Course Selection (选课网) CLI tool built in Rust. Use this skill when working on the elective crate, debugging elective commands, adding features, or when the user mentions 选课, elective, course selection, auto-enroll, CAPTCHA solving, dual-degree, or elective.pku.edu.cn. Also use when dealing with CAPTCHA recognition backends (utool/ttshitu/yunma), automated course enrollment loops, or elective SSO callback. **NOT for general course schedule / 课表 / 这学期上什么课 questions — use the `treehole` skill (`treehole course`) instead, which gives a unified weekly grid with 主修+辅修+双学位. The `elective show` co
How it works
- Architecture
- Key Source Files
- CLI Commands
- CAPTCHA Backends
- Auto-Login for AI Agents
- Development Notes
SKILL.md preview
---
name: elective
description: "PKU Course Selection (选课网) CLI tool built in Rust. Use this skill when working on the elective crate, debugging elective commands, adding features, or when the user mentions 选课, elective, course selection, auto-enroll, CAPTCHA solving, dual-degree, or elective.pku.edu.cn. Also use when dealing with CAPTCHA recognition backends (utool/ttshitu/yunma), automated course enrollment loops, or elective SSO callback. **NOT for general course schedule / 课表 / 这学期上什么课 questions — use the `treehole` skill (`treehole course`) instead, which gives a unified weekly grid with 主修+辅修+双学位. The `elective show` command only sees one program at a time and easily misses courses from the other program for dual-degree students.**"
version: 2.0.0
---
# Elective - 北大选课网 CLI
A CLI client for PKU's course selection system with auto-enrollment automation.
## Architecture
- **Crate location**: `crates/elective/`
- **Auth flow**: IAAA SSO (`app_id="syllabus"`, redirect `http://elective.pku.edu.cn:80/elective2008/ssoLogin.do`) → elective SSO endpoint callback
- **API**: HTML scraping + CAPTCHA handling (base64 image recognition)
- **Automation**: Polling loop for auto-enrollment with configurable interval
## Key Source Files
- `src/main.rs` — Clap CLI with subcommands
- `src/commands.rs` — Command implementations including auto-enroll loop
- `src/api.rs` — HTML scraping, CAPTCHA image extraction
- `src/display.rs` — Terminal output formatting
- `src/client.rs` — reqwest client builders
## CLI Commands
| Command | Alias | Function |
|---------|-------|----------|
| `login` | | IAAA login (supports `--dual` for dual-degree students) |
| `logout` / `status` | | Session management |
| `show` | | View current course selections |
| `list` | `ls` | Browse available courses for add/drop |
| `set` | | Add a course to auto-enroll target list |
| `unset` | | Remove from auto-enroll targets |
| `config-captcha` | | Configure CAPTCHA solver backend |
| `launch` | | Start auto-enrollment polling loop |
| `otp` | | TOTP 2FA management |
## CAPTCHA Backends
The `config-captcha` command supports multiple recognition backends:
- `manual` — Display CAPTCHA image, user inputs answer
- `utool` — UTool OCR service
- `ttshitu` — TTShiTu recognition API
- `yunma` — Yunma recognition API
## Auto-Login for AI Agents
```bash
# Check session status
info-auth check
# Auto-login (reads credentials from OS keyring, no password needed)
elective login -p # single degree
elective login -p --dual major # dual degree - major
elective login -p --dual minor # dual degree - minor
```
Note: Dual-degree students MUST specify `--dual major` or `--dual minor`, otherwise login will fail with an error.
## Development Notes
- Auto-enrollment loop: configurable check interval (default 15s), polls for open slots
- Dual-degree students use `--dual` flag at login for separate session
- CAPTCHA images are base64-encoded, decoded and sent to recognition backend
- All user-facing strings in **Chinese**
- Error handling: `anyhow::Result` with `.context("中文描述")`
- Session persisted to `~/.config/info/elective/`
- Credentials resolved via `info_common::credential` (keyring → env → interactive)
Versions
The database has no other skills named elective.
Database snapshot: 13.11.2026 · package version 74d93fdcba1a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100claspider
北京大学课程信息爬取 CLI (dean.pku.edu.cn 教务部 + elective.pku.edu.cn 选课网 + onlineroomse.pku.edu.cn 智云课堂)。当用户提及 claspider、课程爬虫、课程信息爬取、课程目录、全校开课、按院系/教师/关键词查课、合并课程数据 时使用此 skill。适用于要批量导出某学期全部课程(课号/名称/学分/教师/时间地点/简介)做离线查询、语义搜索、选课决策的场景。Also use when dealing with 教务部课表查询 HTML 抓取、选课网分类遍历、智云课堂 JWT… - 100treehole
PKU Treehole (北大树洞) anonymous forum CLI tool built in Rust. Use this skill when working on the treehole crate, debugging treehole commands, adding features to the treehole CLI, understanding the treehole API, or when the user mentions 树洞, treehole, anonymous posts, tree leaves…