Command-line client for the Life@USTC campus platform.
Built with Go around a GitHub CLI-style command model.
Download the latest release from GitHub Releases.
go install github.com/Life-USTC/CLI/cmd/life-ustc@latestgit clone https://github.com/Life-USTC/CLI.git
cd CLI
make build# Set server (default: https://life-ustc.tiankaima.dev)
life-ustc --server http://localhost:3000 auth login
# Or set default server
life-ustc config set-server http://localhost:3000
# Authenticate
life-ustc auth login
life-ustc auth status
life-ustc me
# Personal workflows
life-ustc todo --pending
life-ustc todo create --title "Write report" --priority high
life-ustc todo done <TODO_ID>
life-ustc homework --pending
life-ustc homework create <SECTION_ID> --title "Problem Set 1"
life-ustc homework create
life-ustc homework done <HOMEWORK_ID>
life-ustc upload file ./report.pdf
life-ustc upload download <ID> -o report.pdf
life-ustc calendar get
life-ustc calendar set <SECTION_ID_1> <SECTION_ID_2>
# Browse (no auth required unless noted)
# In a terminal, bare course/section/teacher list commands open an interactive TUI.
life-ustc course
life-ustc course list --search "数学分析"
life-ustc course --no-interactive --limit 20
life-ustc course view <JW_ID>
life-ustc section list --semester-id <ID>
life-ustc section
life-ustc teacher list --search "张"
life-ustc teacher
life-ustc semester list
life-ustc semester current
life-ustc bus query --from east --to west
life-ustc metadata
# Official USTC sources
life-ustc school semesters
life-ustc school semesters --graduate
life-ustc school curriculum --semester-id <ID>
life-ustc school curriculum --graduate
life-ustc school exam
life-ustc school score
life-ustc school homework
life-ustc school sync --dry-run
life-ustc school sync --graduate --dry-run
life-ustc school sync
# Community features
life-ustc comment list --target-type section --target-id <ID>
life-ustc comment create --target-type section --target-id <ID> --body "Great class!"
life-ustc description get --target-type course --target-id <ID>
life-ustc description set --target-type course --target-id <ID> --content "Good for freshmen."
# Raw API access
life-ustc api semesters/current
life-ustc api todos -F title='Write report' -F priority=high
life-ustc api sections --jq '.data[].code'
# Admin
life-ustc admin user list
life-ustc admin comment list --status active
life-ustc admin suspension create --user-id <ID> --reason "spam"meis identity and account status.- Personal resources live at the top level:
todo,homework,calendar,upload. - Browseable campus resources also live at the top level:
course,section,teacher,semester,schedule,bus. schoolgroups official USTC integrations:semesters,curriculum,exam,score,homework, andsync.- Generic cross-resource workflows are available via
comment,description, andapi. - Commands that benefit from guided input open their own TUI by default in an interactive terminal when no list/filter flags are provided, such as
course,section, andteacher; use--no-interactiveto force plain table output.
life-ustc school semestersreads undergraduate semesters fromcatalog.ustc.edu.cn, or graduate semesters from the officialyjs1.ustc.edu.cngraduate apps with--graduate.life-ustc school curriculum,exam, andscoresign in directly from Go without a browser backend. Undergraduate data comes fromjw.ustc.edu.cn; graduate data comes from the officialyjs1.ustc.edu.cngraduate apps with--graduate.life-ustc school homeworkreads Blackboard calendar/homework data fromwww.bb.ustc.edu.cn, or graduate homework from the officialyjs1.ustc.edu.cngraduate apps with--graduate.life-ustc school syncreads lesson codes from the active school system, matches them to Life@USTC sections, and updates your Life@USTC calendar subscriptions. The sync is one-way to Life@USTC only; it does not write back to USTC systems. Use--dry-runto preview matches without updating subscriptions.
Authenticated school commands accept --username, --password, --totp, --undergraduate, --graduate, and sync commands also accept --all-programs. If omitted, the CLI falls back to the configured school program list, then program-specific credentials, then undergraduate. Persist defaults with life-ustc config set-school-programs undergraduate,graduate.
- Undergraduate username:
PASSPORT_UNDERGRADUATE_USERNAME - Graduate username:
PASSPORT_GRADUATE_USERNAME - Password:
PASSPORT_PASSWORD - TOTP:
PASSPORT_TOTP
All commands support --format json or --json for machine-readable output:
life-ustc --json semester list
life-ustc --json course view 12345
life-ustc section list --jq '.data[].code'Install completion into your current shell without manually registering scripts:
life-ustc completion installYou can also target a specific shell:
life-ustc completion install --shell zsh
life-ustc completion install --shell bashManual script generation remains available for package managers or custom setups:
life-ustc completion -s zsh
life-ustc completion -s fishUse life-ustc api for unsupported or newly added endpoints.
# GET /api/metadata
life-ustc api metadata
# POST /api/todos with JSON body inferred from fields
life-ustc api todos -F title='Write report' -F priority=high
# POST exact request body from a file
life-ustc api -X POST todos --input ./todo.json
# Include response headers
life-ustc api -i metadata- Config directory:
~/.config/life-ustc/(or$XDG_CONFIG_HOME/life-ustc/) - Override server per-command:
--server URL - Environment variable:
LIFE_USTC_SERVER - School program default:
life-ustc config set-school-programs undergraduate,graduate
| Option | Description |
|---|---|
--server |
Server URL |
--format |
Output format (table/json) |
--jq |
Filter JSON output with jq |
--no-color |
Disable colored output |
--version |
Show version |
--help |
Show help |
MIT