← 返回
未分类

Treehole

PKU Treehole (北大树洞) anonymous forum CLI tool built in Rust. Use this skill when working on the treehole crate, debugging treehole commands, adding features t...
PKU树洞(北大树洞)是一款用Rust编写的匿名论坛CLI工具。在使用treehole crate、调试treehole命令、添加功能等场景下使用此技能。
wjsoj
未分类 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 402
下载
💾 0
安装
1
版本
#cli#latest#pku#rust#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)

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-03 09:16 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

PKU Campus Card

wjsoj
PKU校园卡 CLI 工具,使用 Rust 编写。适用于处理 campuscard 工具库、调试校园卡命令、添加功能等场景。
★ 0 📥 438

PKU Info Auth

wjsoj
PKU 统一凭据管理 CLI(统一凭据管理)。当用户或 AI Agent 需要对 PKU服务进行身份验证或管理已存储的凭据时使用此技能。
★ 0 📥 431

PKU Info Spider

wjsoj
微信公众号文章爬虫 CLI 工具,使用 Rust 编写。适用于 info‑spider crate 的开发、调试爬虫命令等场景。
★ 0 📥 445