PREREQUISITE: Install and login first:
npm install -g @mo7yw4ng/openape # Manually Login openape login # Or use flags (not recommended for security reasons) openape login --id <student-id> --password <password>If stored credentials already exist but the WS token is missing or expired, run
openape loginfirst to refresh the session before other commands.
openape <command> [subcommand] [args] [flags]
Commands
courses — Course operations
list— List enrolled courses. Flags:--level in_progress|past|future|allinfo <course-id>— Show detailed course informationprogress <course-id>— Show course completion progresssyllabus <course-id>— Show course syllabus (from CMAP)
videos — Video progress operations
list <course-id>— List videos in a course. Flags:--incomplete-onlycomplete <course-id>— Complete all videos in a coursecomplete-all— Complete all incomplete videos across all courses. Flags:--dry-rundownload <course-id>— Download videos from a course. Flags:--output-dir <path>
quizzes — Quiz operations
list <course-id>— List incomplete quizzes in a course. Flags:--alllist-all— List all incomplete quizzes across courses. Flags:--level in_progress|allstart <quiz-id>— Start a new quiz attemptinfo <attempt-id>— Get quiz attempt data and questions. Flags:--page <number>save <attempt-id> '<answers-json>'— Save answers for a quiz attempt. JSON format:[{"slot":1,"answer":"0"}]. Multichoice: number, multichoices:"0,2", shortanswer: textsubmit <attempt-id>— Submit a quiz attempt using currently saved answers
NEVER SUBMIT WITHOUT USER'S PERMISSION, you have to make sure answer is saved before submitting.
Suggested flow:
start <quiz-id>— Read all questions and present them to the usersave <attempt-id> '<answers>'— Save answersinfo <attempt-id>— Verify answers are saved (savedAnswerfield,status: 答案已儲存)- Ask the user for permission, then
submit <attempt-id>
materials — Material/resource operations
list <course-id>— List materials in a courselist-all— List all materials across courses. Flags:--level in_progress|alldownload <course-id>— Download all materials from a coursedownload-file <course-id> <query>— Download one material matching filename, folder/name, or cmid. Flags:--output-dir <path>download-all— Download all materials from all courses. Flags:--output-dir <path>complete <course-id>— Mark all incomplete resources (non-video) as completecomplete-all— Mark all incomplete resources across all in-progress courses
assignments — Assignment operations
list <course-id>— List assignments in a courselist-all— List all assignments across courses. Flags:--level in_progress|allstatus <assignment-id>— Check assignment submission statussubmit <assignment-id>— Submit an assignment. Flags:--text <content>,--file-id <id>
grades — Grade operations
summary— Show grade summary across all coursescourse <course-id>— Show detailed grades for a course
forums — Forum operations
list— List forums from in-progress courseslist-all— List all forums across all courses. Flags:--level in_progress|alldiscussions <forum-id>— List discussions in a forumposts <discussion-id>— Show posts in a discussionpost <forum-id> <subject> <message>— Post a new discussion. Flags:--subscribe,--pinreply <post-id> <subject> <message>— Reply to a discussion post. Flags:--attachment-id <id>,--inline-attachment-id <id>delete <post-id>— Delete a forum post or discussion
announcements — Announcement operations
list-all— List all announcements across courses. Flags:--unread-onlyread <announcement-id>— Read a specific announcement (full content)
calendar — Calendar operations
events— List calendar events. Flags:--course <id>,--upcoming,--days <n>export— Export calendar events to file. Flags:--output <path>,--days <n>
upload — File upload
file <file-path>— Upload a file to Moodle draft area
Suggested flow:
If an assignment (
assignments submit) or forum post (forums post/forums reply) requires a file attachment, first upload the file to the draft area usingupload file <file-path>to obtain an attachment/file ID. Then pass the ID via--file-id(assignments) or--attachment-id/--inline-attachment-id(forums) when executing the command.
pages — Page operations
list <course-id>— List pages in a course (content preview, first 150 chars)list-all— List all pages across courses. Flags:--level in_progress|allshow <cmid>— Show full content of a specific page
skills — Skill management
install [platform]— Install OpenApe skill to an agent platform (claude, codex, opencode)show— Print the raw SKILL.md content
Output Formats
Most data commands support --output: json (default), csv, table, silent
Global flags: --verbose, --headed, --session <path>
Discovering Commands
# Browse all commands
openape --help
# Inspect a command's subcommands and options
openape <command> --help