treehole

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 (树叶), or PKU forum. Also use when dealing with IAAA login flow for treehole, JWT callback, SMS verification, or treehole REST API endpoints. **Also use whenever the user asks about their course schedule / 课表 / 这学期上什么课 / weekly schedule / academic calendar / 本周日程 — the treehole API exposes these via `treehole course`, `treehole schedule`, `treehole academic-cal`, `treehole activity-cal`, and they are the canonical source. Do NOT use the `course` (Blackboard) or `elective` crate to answer schedule questions — `course` is for teaching-platform content (assignments/files) and `elective` only sees the major program (misses 辅修/双学位).

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "treehole" with this command: npx skills add wjsoj/pku-treehole

Treehole - 北大树洞 CLI

A CLI client for PKU's anonymous discussion platform (PKU Helper Treehole).

Architecture

  • Crate location: crates/treehole/
  • Auth flow: IAAA SSO (app_id="PKU Helper") → JWT callback at /chapi/cas_iaaa_login → optional SMS verify
  • API: JSON REST at /chapi/api/v3/* (modern) and /chapi/api/* (legacy)
  • API docs: docs/treehole-api.md

Key Source Files

  • src/main.rs — Clap CLI definition with all subcommands
  • src/commands.rs — Command implementations (login, post, search, etc.)
  • src/api.rs — HTTP API client, request builders, response types
  • src/display.rs — Terminal output formatting with colored crate
  • src/client.rs — reqwest client builders (build for auth, build_simple for IAAA)

CLI Commands

CommandAliasFunction
loginIAAA password/QR login → JWT
logout / statusSession management
listlsBrowse posts/feed
showView single post with replies
searchFull-text search
postCreate post (text, tags, images, rewards/树叶)
replyReply to a post
like / treadVote on posts
star / unstar / starsBookmark management
follow / unfollowFollow posts
msg / readNotifications
meProfile + own posts
scoreGrade query (with color rendering)
courseWeekly course schedule (canonical source — includes 主修 + 辅修 + 双学位)
scheduleThis week's day-by-day schedule
academic-cal / activity-calAcademic / activity calendar
otpTOTP 2FA management (bind/set/show/clear)

Auto-Login for AI Agents

# Check session status
info-auth check

# Auto-login (reads credentials from OS keyring, no password needed)
treehole login -p

# If SMS verification is needed (first login or periodic):
PKU_SMS_CODE=123456 treehole login -p

Treehole may require SMS verification on first login or periodically (~30 days). When PKU_SMS_CODE env var is set, it auto-confirms sending and submits the code without interactive prompts.

Development Conventions

  • All user-facing strings are in Chinese (prompts, errors, output)
  • Error handling: anyhow::Result with .context("中文描述")
  • HTTP client uses redirect(Policy::none()) for manual redirect handling
  • Session persisted to ~/.config/info/treehole/ via info_common::session::Store
  • Credentials resolved via info_common::credential (keyring → env → interactive)
  • Shared auth from info-common crate (see info-common skill for details)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

PKU CWFW

北京大学财务综合信息门户 (cwfw.pku.edu.cn / WF_CWBS) CLI 工具。当用户提及 cwfw、财务门户、财务综合信息门户、个人酬金、工资查询、报销查询 时使用此 skill。Also use when dealing with cwfw IAAA 登录 (app_id=IIPF)、home...

Registry SourceRecently Updated
590Profile unavailable
Coding

PKU BDKJ

北京大学空间 (bdkj.pku.edu.cn) 学术研讨教室预约 CLI 工具。当用户提及 bdkj、北大空间、学术研讨教室、教室预约、研讨间、借教室 或想要查询/预约/取消 二教/四教/地学 教学楼里的空闲学术研讨教室时使用此 skill。支持保存固定参与人分组(如课题组),重复发起预约时只需 `--grou...

Registry SourceRecently Updated
570Profile unavailable
Coding

PKU Claspider

北京大学课程信息爬取 CLI (dean.pku.edu.cn 教务部 + elective.pku.edu.cn 选课网 + onlineroomse.pku.edu.cn 智云课堂)。当用户提及 claspider、课程爬虫、课程信息爬取、课程目录、全校开课、按院系/教师/关键词查课、合并课程数据 时使用此...

Registry SourceRecently Updated
560Profile unavailable
Coding

Course

PKU Teaching Platform (北大教学网/Blackboard Learn) CLI tool built in Rust. Use this skill when working on the course crate, debugging course commands, adding fea...

Registry SourceRecently Updated
1550Profile unavailable