Skip to content

Commands zh TW

github-actions[bot] edited this page Oct 12, 2026 · 8 revisions

命令指南

English · 首頁

完整 flag 以 moodle <command> --help 為準。以下多數 ID 都可以直接換成從 Moodle 貼來的 URL。

自動產生的完整命令參考逐一說明所有命令與旗標; 功能覆蓋列出三版 registry 的每個 core function。

站台與登入

moodle site add <名稱> <網址>
moodle site list
moodle site use <名稱>
moodle site remove <名稱>

moodle auth methods
moodle auth login [--method token|password|qr|mobilelaunch|browser-session|manual]
moodle auth status
moodle auth logout
moodle auth import-browser [--list-profiles|--store]
moodle auth import-browser --browser safari --store   # macOS Safari
moodle auth import-session --site <name>              # Safari 磁碟檔找不到 session 時隱藏輸入貼上
moodle auth register-handler         # Linux 與 macOS;macOS 首次 mobilelaunch 登入也會自動註冊
moodle auth handler-status
moodle auth unregister-handler

依角色 capability 的讀取功能

moodle doctor
moodle course list
moodle calendar upcoming
moodle grade overview
moodle grade list --course <id|url>
moodle assignment list
moodle assignment overview
moodle assignment show <id|url>
moodle assignment status <id|url>
moodle quiz list
moodle quiz show <id|url>
moodle forum list
moodle forum discussions <id|url>
moodle forum read <id|url>
moodle file download <url>
moodle resolve <url>

doctor 會說明可用 backend 與缺少的 capability,不假設每個站台都有相同函式。論壇讀取不會把文章 標示為已讀。

assignment overview 在一次 CLI 呼叫中逐筆查詢繳交狀態。讀不到的狀態會以 submission: null 和 status_error 表示,不能解讀成「尚未繳交」。quiz list 列出課程中可見的測驗,並非只查行事曆事件。 使用瀏覽器 session 時,有些測驗設定可能未知;解讀空白日期前先看 meta.missing。 MCP 另提供對應的唯讀工具:assignment_overview、quiz_list 和 quiz_show。

交作業

moodle assignment submit <id|url> report.pdf --dry-run
moodle assignment submit <id|url> report.pdf --yes
moodle assignment submit <id|url> report.pdf --draft --yes

非草稿流程會上傳、儲存、在需要時執行獨立的「submit for grading」,最後回讀狀態。--draft 明確停在 尚未交件的狀態;JSON 的 handed_in 才是 Moodle 回報的最終事實。

Typed core service 與 plugin escape hatch

moodle api functions --match assign
moodle api call core_enrol_get_users_courses --param userid=4
moodle ws list --version v52
moodle ws describe core_course_update_courses

Raw call 仍會經過 safety policy。未審查函式視為寫入且不重試;它是用來操作尚未有高階命令的官方函式, 不是繞過安全模型。

自動化與 agent

moodle version --json
moodle commands --json
moodle schema
moodle schema assignment.submit
moodle schema assignment submit --json
moodle assignment list --current --json --fields name,due_date --no-input
moodle mcp serve
moodle mcp serve --allow-write
moodle mcp host                # 啟動對外公開的 Cloudflare quick tunnel
moodle mcp host --public-url https://moodle-mcp.example.com
moodle course list --read-only
moodle course list -v          # 去敏感化的 HTTP 診斷,輸出到 stderr
moodle shell-completion zsh   # tab 補全;名稱不是 completion,那是 Moodle 的活動完成度

--read-only 會移除寫入命令。MCP 除非明確加上 --allow-write,否則維持唯讀。--fields 只保留 指定的 data 欄位,--no-input 讓需要回答的命令直接失敗而不是等待。程式使用輸出前請閱讀 JSON contract,實際範例與可交給 agent 的規則見自動化範例。

Clone this wiki locally