moodle-cli 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -3
- package/SKILL.md +4 -3
- package/agents/openai.yaml +1 -1
- package/dist/moodle.js +1224 -635
- package/dist/worker/recovery.js +777 -384
- package/dist/worker/worker.js +777 -384
- package/package.json +2 -2
- package/references/command-reference.md +6 -1
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ moodle news UNIT
|
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
Ambiguous references list candidates. JSON callers receive `error.code: "ambiguous"`;
|
|
99
|
-
|
|
99
|
+
At a terminal you pick the match from a list (arrow keys, or type to filter a long one). A bare number in a section reference matches
|
|
100
100
|
that number in the site's section name, so 7 never matches 17.
|
|
101
101
|
|
|
102
102
|
#### Paste Moodle links directly
|
|
@@ -115,6 +115,24 @@ You can paste the same links into your agent and ask it to inspect the page, fin
|
|
|
115
115
|
|
|
116
116
|
`moodle download` accepts an activity ID or an authenticated Moodle URL. `--dest` sets the exact local path, and `--force` replaces an existing file after the download completes. Folder activities expose `files` so you can choose which files to save.
|
|
117
117
|
|
|
118
|
+
#### Submit assignment files
|
|
119
|
+
|
|
120
|
+
`moodle submit` uploads local files into an assignment through the same pages a browser
|
|
121
|
+
uses, then prints the receipt Moodle shows afterwards: status, files, due date and the
|
|
122
|
+
time it was checked. It is the only command that writes to Moodle.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
moodle submit "UNIT TASK" essay.pdf --dry-run # plan only: limits, statement, existing files
|
|
126
|
+
moodle submit "UNIT TASK" essay.pdf # upload; Moodle keeps a draft where drafts are allowed
|
|
127
|
+
moodle submit "UNIT TASK" --final --accept-statement # submit the draft for grading (cannot be undone)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Every run plans first and asks for confirmation; `--yes` skips the prompt for scripts.
|
|
131
|
+
`--replace` removes the files already in the submission, `--accept-statement` agrees to
|
|
132
|
+
the site's submission statement when one is required, and a file that is too large or of
|
|
133
|
+
the wrong type is refused before anything is uploaded. Assignments without drafts submit
|
|
134
|
+
on save; the receipt reports what the site did.
|
|
135
|
+
|
|
118
136
|
### Remote MCP for web AI
|
|
119
137
|
|
|
120
138
|
A private remote MCP server lets a supported web AI client use Moodle when it cannot run the local CLI. You need a Cloudflare account.
|
|
@@ -128,6 +146,8 @@ moodle mcp status
|
|
|
128
146
|
|
|
129
147
|
The MCP `get_file` tool accepts a resource activity ID, resource URL, or `pluginfile.php` URL and returns files up to 16 MiB directly as an embedded MCP resource. The Moodle session stays inside the local server or private Worker; clients do not need to fetch an authenticated Moodle URL themselves.
|
|
130
148
|
|
|
149
|
+
The remote server is read-only. The local server (`moodle mcp serve`) also offers `submit`, which needs the files on the same machine. It defaults to `dry_run: true`, so an agent has to show the plan and run it again with `dry_run: false` to upload; `final: true` submits for grading.
|
|
150
|
+
|
|
131
151
|
### Update
|
|
132
152
|
|
|
133
153
|
```bash
|
|
@@ -154,7 +174,7 @@ Commands support:
|
|
|
154
174
|
- `--fields units,total` to select envelope fields
|
|
155
175
|
- `-o, --output FILE` to write command output or a download receipt
|
|
156
176
|
|
|
157
|
-
The CLI prints tables in an interactive terminal and JSON when stdout goes to a pipe or file. Structured errors use one JSON object on stderr:
|
|
177
|
+
The CLI prints tables in an interactive terminal and JSON when stdout goes to a pipe or file. In a terminal, a command missing its unit asks for it with a picker (`moodle activities` lists your units); pipes, `--json` and agent shells get the usage error with the usage line instead. Structured errors use one JSON object on stderr:
|
|
158
178
|
|
|
159
179
|
```json
|
|
160
180
|
{"ok":false,"error":{"code":"auth","message":"...","hint":"..."},"exit_code":3}
|
|
@@ -298,7 +318,8 @@ and `name`. Dates include ISO offsets and epoch seconds. Unit detail defaults to
|
|
|
298
318
|
section index; pass a section for activities. `--fields` selects envelope keys.
|
|
299
319
|
|
|
300
320
|
The 11 default MCP tools are home, due, units, unit, find, item, grades, news, thread,
|
|
301
|
-
search_forums and file
|
|
321
|
+
search_forums and file; a local server adds submit, whose `submission` envelope is the
|
|
322
|
+
upload receipt. Old names remain callable through 0.8 with the new envelopes;
|
|
302
323
|
they are deprecated and omitted from default discovery to avoid duplicate catalog cost.
|
|
303
324
|
The local command tree remains available, including courses as an alias for units.
|
|
304
325
|
The unused projects/quiet aliases were removed. `--verbose` (`-v`) prints sanitized
|
package/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: moodle-cli
|
|
3
|
-
description: Read Moodle units, deadlines, grades, announcements and files; diagnose sign-in and manage a private MCP server.
|
|
3
|
+
description: Read Moodle units, deadlines, grades, announcements and files; submit assignment files; diagnose sign-in and manage a private MCP server.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Moodle CLI
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reads Moodle; only `submit` writes. UNIT is a site code/name, id or URL; SECTION is a number or name.
|
|
9
9
|
Never assume code patterns or ask for ids. `moodle units` shows the site's vocabulary.
|
|
10
10
|
|
|
11
11
|
| Intent | Run |
|
|
@@ -19,12 +19,13 @@ Never assume code patterns or ask for ids. `moodle units` shows the site's vocab
|
|
|
19
19
|
| my grades | moodle grades [UNIT] |
|
|
20
20
|
| announcements | moodle news [UNIT] |
|
|
21
21
|
| forum post text | moodle forums search "QUERY" --unit UNIT |
|
|
22
|
+
| upload assignment files | moodle submit "UNIT TASK" FILE... [--final] |
|
|
22
23
|
| download a file | moodle get "UNIT TASK" --to DIR |
|
|
23
24
|
|
|
24
25
|
Pipes emit compact JSON; `--json` forces it, `--pretty` indents it.
|
|
25
26
|
Ambiguity returns `candidates`: pick or refine, never guess.
|
|
26
27
|
Lists report `total`; narrow or page when more exist. Quote ISO dates with offsets.
|
|
27
|
-
Never expose cookies or tokens.
|
|
28
|
+
Never expose cookies or tokens. Download or submit only when asked; dry-run submit first. `--final` cannot be undone.
|
|
28
29
|
Sign-in trouble: `moodle doctor`; remote expiry: `moodle mcp login`.
|
|
29
30
|
Exact syntax: `moodle commands --json` or [reference](references/command-reference.md).
|
|
30
31
|
Setup, MCP and removal: [guide](references/setup-and-auth.md).
|
package/agents/openai.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
interface:
|
|
2
2
|
display_name: "Moodle CLI"
|
|
3
|
-
short_description: "Inspect Moodle
|
|
3
|
+
short_description: "Inspect Moodle, retrieve authenticated course files and submit assignment files"
|
|
4
4
|
default_prompt: "Use $moodle-cli to inspect my Moodle data, retrieve a file through MCP, or download selected files locally with the narrowest relevant operation."
|