A CLI client for PKU's anonymous discussion platform (PKU Helper Treehole).
crates/treehole/app_id="PKU Helper") → JWT callback at /chapi/cas_iaaa_login → optional SMS verify/chapi/api/v3/* (modern) and /chapi/api/* (legacy)docs/treehole-api.mdsrc/main.rs — Clap CLI definition with all subcommandssrc/commands.rs — Command implementations (login, post, search, etc.)src/api.rs — HTTP API client, request builders, response typessrc/display.rs — Terminal output formatting with colored cratesrc/client.rs — reqwest client builders ( build for auth, build_simple for IAAA)CommandAliasFunctionloginIAAA password/QR login → JWTlogout / statusSession managementlist``lsBrowse posts/feedshowView single post with repliessearchFull-text searchpostCreate post (text, tags, images, rewards/树叶)replyReply to a postlike / treadVote on postsstar / unstar / starsBookmark managementfollow / unfollowFollow postsmsg / readNotificationsmeProfile + own postsscoreGrade query (with color rendering)courseWeekly course schedule (canonical source — includes 主修 + 辅修 + 双学位)scheduleThis week's day-by-day scheduleacademic-cal / activity-calAcademic / activity calendarotpTOTP 2FA management (bind/set/show/clear)
bash
# 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.
anyhow::Result with .context("中文描述")redirect(Policy::none()) for manual redirect handling~/.config/info/treehole/ via info_common::session::Storeinfo_common::credential (keyring → env → interactive)info-common crate (see info-common skill for details)